Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate the all Makefile-based tests to the newer dune-controlled cram-like tests / Windows fixes #4504

Merged
merged 68 commits into from
Mar 12, 2021

Conversation

AltGr
Copy link
Member

@AltGr AltGr commented Jan 20, 2021

Wip additional work on #4405

@AltGr AltGr force-pushed the reftests-all2 branch 2 times, most recently from 0088845 to 20d08b4 Compare February 1, 2021 16:50
@rjbou rjbou mentioned this pull request Feb 12, 2021
@kit-ty-kate kit-ty-kate added this to the 2.1.1 milestone Feb 19, 2021
@rjbou rjbou removed this from the 2.1.1 milestone Feb 19, 2021
@AltGr AltGr force-pushed the reftests-all2 branch 3 times, most recently from b9f6605 to 567cb24 Compare February 25, 2021 17:25
@AltGr AltGr force-pushed the reftests-all2 branch 4 times, most recently from 710bf02 to bda80d1 Compare March 4, 2021 23:07
@AltGr AltGr marked this pull request as ready for review March 5, 2021 13:44
Copy link
Member

@dra27 dra27 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once it's fully passing, I think the changes to opam itself should be split (new env variables, sandbox changes, etc.). The changes look fine to me, but I don't think they should be buried in the tests PR

@@ -490,12 +490,11 @@ let check_and_revert_sandboxing root config =
match OpamFilter.commands env sdbx_wrappers with
| [] -> config
| cmd::_ ->
OpamFilename.with_tmp_dir @@ fun tmp ->
let test_file = OpamFilename.(to_string Op.(tmp // "check")) in
let test_file = "$TMPDIR/opam-sandbox-check-out" in
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels dangerous - what happens if TMPDIR is unset?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sandbox script is expected to set it; but indeed that should be documented...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is in order to get canonical output, right? Rather than altering the command, wouldn't it be better to alter OpamProcess.verbose_print_cmd to detect the string and do the conversion instead?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We did something similar with negative debug levels stripping out the timestamps...

@@ -49,8 +49,8 @@ MD5_result = 1b82dec78849680b49ae9a8a365b831b
$(call PKG_SAME,result)

# NB If minimum OCaml version for Dune changes, update DUNE_SECONDARY in configure.ac
URL_dune-local = https://github.com/ocaml/dune/releases/download/2.6.2/dune-2.6.2.tbz
MD5_dune-local = 8fe40bef051975e798537d3450b61129
URL_dune-local = https://github.com/ocaml/dune/releases/download/2.8.0/dune-2.8.0.tbz
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This wants to be 2.8.2

@dra27
Copy link
Member

dra27 commented Mar 5, 2021

SPECTRUM IS GREEN! Congratulations, @AltGr!

src/core/opamProcess.mli Outdated Show resolved Hide resolved
Unix.close_process_full process |> ignore;
fatal e;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be first, I think - I think Unix.close_process_full can also raise?

emillon and others added 4 commits March 11, 2021 12:09
The existing `reftests.ml` are responsible for discovering the tests and
running them, and a Makefile action performs the diff.

This splits the work a bit more so that it plays better with dune (and
becomes compatible with `dune promote`):

- a `gen` executable reads the tests directory and outputs rules to
  execute tests. In addition, it determines the versions of
  opam-repository that are necessary, and outputs rules to download and
  unpack them (these will be shared across runs, and between tests that
  are based on the same version).

- a `run` executable executes a single test with enough context passed
  as arguments: the path to the development `opam` binary, the test
  file, and the opam repository contents.

- the generated rules are checked in the repository as `dune.inc`
  because dune needs to know them statically, but they are checked: if a
  test file is added, `dune runtest` will compute the new rules and they
  can be promoted into `dune.inc`.

Reftests are set up using aliases so that they can be run individually:

- each test has its own alias (e.g. `dune build @reftest-conflict-camlp4`)
- all tests are attached to @reftest (`dune build @reftest` runs all)
- this alias is attached to @runtest too (so `dune runtest` will run these)
It was the largest time cost, now the reftests can be run in a very reasonable
time.
dra27 and others added 24 commits March 12, 2021 09:37
It's technically a mask, although in this case only 0 (files already in
sync) and 1 (files all sync'd with no issues/warnings) should be
accepted.
Should help a lot on Windows. The test themselves will need an update since
rewrites now need a custom syntax rather than grep/shell piping
no more shell pipe sed grep awk hacks \o/
- fix some cases with error return values
- fix unordered output with multiple identical lines
Some tests have unordered output ; put them back to a real order though, some
parts were mixed up because of the older shell awk/sort hacks. It makes more
sense to have retrievals before installs...
in particular, call scripts through their interpreter explicitely.
otherwise network accesses won't work
@AltGr
Copy link
Member Author

AltGr commented Mar 12, 2021

cleaned up! Should be ready to merge

@rjbou
Copy link
Collaborator

rjbou commented Mar 12, 2021

hoorray! \o/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants