Skip to content

Extend the testsuite to test installations#1024

Closed
dra27 wants to merge 13 commits intoocaml:trunkfrom
dra27:installable-testsuite
Closed

Extend the testsuite to test installations#1024
dra27 wants to merge 13 commits intoocaml:trunkfrom
dra27:installable-testsuite

Conversation

@dra27
Copy link
Member

@dra27 dra27 commented Jan 29, 2017

The principal part of this GPR adds a target install-testsuite which installs the testsuite to $OCAMLLIB/testsuite and allows the tests to be run from this directory. In this mode of operation, the compilers and tools are accessed from their installed locations, rather than from within the build tree.

Travis should be using this target for the flambda tests (so one build tests source-tree and another installation).

In order to maintain readability of the diff, I haven't indented Makefile lines - dra27@80b95a1 will be added before this is actually merged.

dra27 added 10 commits January 29, 2017 12:32
Ensure that tests which analyse exception messages explicitly disable
backtrace printing.
Code sharing between the three debugger tests is still pretty awful,
though.
Alters the test to use OCAMLRUN variable directly. Largely same semantic
effect - if an alternate runtime is being tested, it was probably a bug
that this test wouldn't have used it.
Use OCAMLRUN instead of equivalent expression.
@ghost
Copy link

ghost commented Jan 30, 2017

Have you considered requiring an installed version of OCaml in the testsuite and using a local install (in a _install sub directory for instance)? This would avoid the various if in Makefiles which will sometimes be tedious to maintain. All we would need to do is set OCAMLLIB to point to the local directory; I believe that's the only place we hard-code the installation directory.

BTW, I welcome the various Printexc.record_backtrace false to ensure better reproducibility, I always forget to unset OCAMLRUN from my environment. However, I think it would be even more robust to clear this variable, at least by default and explicitly do Printexc.record_backtrace true in the few tests that are testing backtraces.

@dra27
Copy link
Member Author

dra27 commented Jan 30, 2017

@diml - I hadn't, but I'm not convinced by that strategy, given the reasons for doing this. I actually think the number of ifeqs required isn't too bad (I was expecting more Makefiles to need patching, to be honest) - but it does seem to be important to ensure that the testsuite is definitely not run in the build tree, because it allows a mis-ported testsuite Makefile to pick up the build tree by accident. I'd also worry that given that we're wanting to test the install targets by doing this that we'd be moving the logic into make install (it's effectively overriding PREFIX, BINDIR, LIBDIR, etc.) and risk failing to test the very logic that we want to check?

I debated clearing OCAMLRUNPARAM completely too, but decided to leave that for the future. I also like that those tests - which care about exceptions in their output - are explicitly turning it off (I think that the ones which test backtraces either do this or manually add b to OCAMLRUNPARAM already?). The only reason I fixed the backtrace ones is because the expect tests already do this and because I happened to have OCAMLRUNPARAM=b leftover in my environment! I wasn't certain that there mightn't be a use out there (e.g. GC parameters?) why someone might invoke the testsuite and expect OCAMLRUNPARAM to be respected? I also altered the flambda tests to run with OCAMLRUNPARAM=b, so we should notice if future tests accidentally do the same thing!

@dra27 dra27 force-pushed the installable-testsuite branch 9 times, most recently from 758f78c to ea5dbfc Compare February 1, 2017 10:41
@dra27 dra27 force-pushed the installable-testsuite branch from ea5dbfc to c00987c Compare February 1, 2017 11:26
dra27 added 3 commits February 1, 2017 12:03
make [-f Makefile.nt] installs the testsuite to
$(INSTALL_LIBDIR)/testsuite and if executed from this directory, the
testsuite will run using compiler from its installation rather than
compilation directories.
@dra27 dra27 force-pushed the installable-testsuite branch 2 times, most recently from 8ad7090 to 3dd220e Compare February 1, 2017 15:50
@dra27
Copy link
Member Author

dra27 commented Feb 1, 2017

OK, the CIs need to finish catching up, but this should finally be ready to go.

If a particularly keen person with access to an OSX environment were to verify that the unwind test works, I think everything would have been tested.

The first thing to note is that the revised CI would have caught the error in #785.

There are implications to some of these changes, which want further consideration:

  • The first nine commits are just tidying/refactoring with the addition of a guard against backtraces appearing in result files in future (so the flambda Travis test is executed with OCAMLRUNPARAM=b,v=0 to try to force this issue)
  • Switching Travis so that one test is done using the installed testsuite and the other "in-place" means that both branches will be constantly exerised, which should mitigate the chances of bitrot
  • Has anyone run the Fortran interop test in a while? I was surprised at the patches needed to build it with gfortran. It seems sensible to keep this test permanently on, although that slows the CI down slightly because gfortran is not installed by default.
  • Windows only tests one configuration (at the moment) and it seems sensible for that to be the installed version. However, at the moment a big implication of that is that the installation test now happens in a directory with no space in it. This requires a big overhaul of the testsuite logic, which really should use relative directory names, not absolute ones so readily and it seems worth leaving that until after the ocamltest stuff has taken over everything. Installing OCaml (and being able to build it in a directory with spaces in the name) is a high priority for OPAM infrastructure because Windows 10 user names (and hence OPAM roots) have spaces in them in a default installation. @Chris00 - what're your thoughts on this?

@dra27 dra27 force-pushed the installable-testsuite branch from 3dd220e to e00948f Compare February 13, 2017 14:49
@shindere
Copy link
Contributor

shindere commented Feb 15, 2017 via email

@damiendoligez
Copy link
Member

why someone might invoke the testsuite and expect OCAMLRUNPARAM to be respected?

I do, because I sometimes run the testsuite with the debug runtime, which displays GC messages on stderr (which break some tests) unless I also add OCAMLRUNPARAM=v=0 to the environment. So please don't break that.

@damiendoligez damiendoligez added this to the 4.07-or-later milestone Sep 29, 2017
@damiendoligez damiendoligez removed this from the consider-for-4.07 milestone Jun 4, 2018
@xavierleroy
Copy link
Contributor

Two years later, do we want to pursue this PR?

@shindere
Copy link
Contributor

shindere commented Oct 24, 2019 via email

@dra27
Copy link
Member Author

dra27 commented Oct 24, 2019

I haven't got time to look up the reference now, but the motivation for this PR was to ensure that we're installing things correctly, and it was a follow-up to a real bug, even if I've somewhat stupidly not referenced it in the original summary.

A required artefact was not being installed, so the theory was to be able to ensure all the tests pass when OCaml is installed as well as from its build tree as a way of checking for that in future. IIRC the intention was never that a user would install the testsuite, it allowed CI to install it. The alternative would be to clean the tree completely and instruct the testsuite to run on the installed compiler - that may now be much easier to implement thanks to ocamltest than it was with the old Makefile infrastructure.

Offering a way to run the testsuite on an installed compiler may also help some of our friends packaging OCaml when we move things around - Arch has/had a broken 4.09 ocaml-compiler-libs package because we reorganised the middle-end sources (see ocaml/opam#4013). The self-contained-toplevel would have highlighted that packaging error.

@shindere
Copy link
Contributor

shindere commented Oct 24, 2019 via email

@shindere
Copy link
Contributor

shindere commented Oct 24, 2019 via email

@dra27 dra27 closed this Nov 25, 2020
@dra27 dra27 deleted the installable-testsuite branch July 6, 2021 15:09
sadiqj pushed a commit to sadiqj/ocaml that referenced this pull request Feb 21, 2023
stedolan pushed a commit to stedolan/ocaml that referenced this pull request Mar 21, 2023
stedolan pushed a commit to stedolan/ocaml that referenced this pull request Mar 21, 2023
b11eea1 flambda-backend: Introduce Import_info (ocaml#1036)
bc5b135 flambda-backend: Fix `ocamlobjinfo` on flambda2 .cmx files (ocaml#1029)
c8babbd flambda-backend: Compilation_unit optimisations (ocaml#1035)
e8d3e22 flambda-backend: Use 4.14.0 opam switch for building (includes upgrading ocamlformat to 0.24.1) (ocaml#1030)
eb14a86 flambda-backend: Port PR81 from ocaml-jst (ocaml#1024)
131bc12 flambda-backend: Merge ocaml-jst 2022-12-13 (ocaml#1022)
06c189a flambda-backend: Make stack allocation the default (ocaml#1013)
98debd5 flambda-backend: Initial support for value slots not of value kind (ocaml#946)
deb1714 flambda-backend: Add is_last flag to closinfo words (ocaml#938)
d07fce1 flambda-backend: Disable poll insertion in Configure (ocaml#967)
0f1ce0e flambda-backend: Regenerate ocaml/configure autoconf 2.69 (instead of 2.71) (ocaml#1012)
27132d8 flambda-backend: Fix for spurious typing error related to expanding through functor arguments (ocaml#997)
724fb68 flambda-backend: Use `Compilation_unit.t` instead of `Ident.t` for globals (ocaml#871)
396d5b8 flambda-backend: Add a test for frametable setup in natdynlinked libraries (ocaml#983)
b73ab12 flambda-backend: Fix invocation of `caml_shared_startup` in native dynlink (ocaml#980)
7c7d75a flambda-backend: Fix split_default_wrapper which did not trigger anymore with flambda2 (ocaml#970)
8fb75bd flambda-backend: Port ocaml#11727 and ocaml#11732 (ocaml#965)
fdb7987 flambda-backend: Fix include functor issue after 4.14 merge. (ocaml#948)
9745cdb flambda-backend: Print -dprofile/-dtimings output to stdout like 4.12 (ocaml#943)
5f51f21 flambda-backend: Merge pull request ocaml#932 from mshinwell/4.14-upgrade
841687d flambda-backend: Run make alldepend in ocaml/ (ocaml#936)
72a7658 flambda-backend: Remove reformatting changes only in dynlink/dune (preserving PR889 and adjusting to minimise diff)
6d758cd flambda-backend: Revert whitespace changes in dune files, to match upstream
c86bf6e flambda-backend: Remove duplicate tests for polling
971dbeb flambda-backend: Testsuite fixes
32f8356 flambda-backend: Topeval fix for symbols patch
befea01 flambda-backend: Compilation fixes / rectify merge faults
a84543f flambda-backend: Merge ocaml-jst
8e65056 flambda-backend: Merge ocaml-jst
4d70045 flambda-backend: Remove filename from system frametable (amd64) (ocaml#920)
5e57b7d flambda-backend: Bugfix for runtime frame_descr logic for C frames (ocaml#918)
6423d5e flambda-backend: Merge pull request ocaml#914 from mshinwell/merge-ocaml-jst-2022-10-24
ead605c flambda-backend: Add a missing Extract_exception (ocaml#916)
c8f1481 flambda-backend: Resolve conflicts and add specialise/specialised attributes to Builtin_attributes
cf4d0d3 flambda-backend: Merge fixes (ocaml#21)
c2f742f flambda-backend: Re-enable some tests for Flambda2 (ocaml#881)
3d38d13 flambda-backend: Long frames in frametable (ocaml#797)
85aec7b flambda-backend: Add loop attribute to Builtin_attributes
c0f16e3 flambda-backend: Compilation fixes
90dea23 flambda-backend: Merge flambda-backend/main
5acc6ea flambda-backend: Fixes after merge
e501946 flambda-backend: Merge ocaml-jst
115083b flambda-backend: Merge ocaml-jst
9943b2e flambda-backend: Revert "Revert "Transform tail-recursive functions into recursive continuations (ocaml#893)"" (ocaml#909)
ce339f1 flambda-backend: Fix alloc modes and call kinds for overapplications (ocaml#902)
e6a317c flambda-backend: Revert "Transform tail-recursive functions into recursive continuations (ocaml#893)"
853c488 flambda-backend: Transform tail-recursive functions into recursive continuations (ocaml#893)
5a977e4 flambda-backend: Fix missing End_region primitives on switch arms (ocaml#898)
7fa7f9d flambda-backend: Add missing dependencies to Dune files (ocaml#889)
3cd36f0 flambda-backend: Have Lambda `Pgetglobal` and `Psetglobal` take `Compilation_unit.t` (ocaml#896)
7565915 flambda-backend: [@poll error] attribute (ocaml#745)
9eb9448 flambda-backend: Backport the main safepoints PRs (ocaml#740)
689bdda flambda-backend: Add strict mode for ocamldep (ocaml#892)

git-subtree-dir: ocaml
git-subtree-split: b11eea1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants