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

Backporting 2.5.0 bis #787

Merged
merged 22 commits into from
Sep 5, 2023
Merged

Conversation

@Halbaroth Halbaroth added this to the 2.5.0 milestone Aug 23, 2023
Halbaroth and others added 10 commits August 23, 2023 18:02
The current implementation of test generation is quite high friction:

 - When adding new tests, running tests directly with dune doesn't work,
   because the dune files must be generated by `make gentest`
   beforehand.  There is `make runtest`, but that always runs all the
   tests, and does not allow specifying only some tests to run (which,
   given that our test suite is quite big, is sometimes needed for quick
   iterations).

 - The generated dune files are not commited to the repository, which
   means that it is easy to forget to run `make gentest` when switching
   branches -- which either causes some tests to silently not run, or
   errors because some files are missing.

This patch solves both issues by integrating the test generation with
dune, using the `include` stanza. More precisely:

 - The test generation script (gentest.ml) is modified to write all the
   test cases on the standard output as a single file, rather than
   creating the dune test files by itself. The generated file makes use
   of the `subdir` stanza to locate the targets appropriately.

 - There is a new `dune.inc` file that is included by the `dune` file in
   `tests`, and a `diff` rule that generates the content of that
   `dune.inc` file using the `gentest.ml` script.  This is the way rules
   generation must work in dune, and it means that the `dune.inc` file
   must be commited to the repository --- which may not be such a bad
   thing, see above.

The rule generation is added to the `gentest`, `runtest`,
`runtest-quick` and `runtest-ci` aliases.

The advantage of the new approach is that since the dependency is known
to dune (and not only to make), running a command such as
`dune build @tests/issues/XXX/runtest-quick` will always regenerate the
tests, and also that we won't have to delete `dune` files manually when
switching branches, since everything is in the file that gets
re-generated.

It means that running tests is slightly slower, because it always
requires running the `gentest` script --- but that is probably fine,
until we have many more tests than currently.
@Halbaroth Halbaroth merged commit c4a238a into OCamlPro:v2.5.x Sep 5, 2023
10 checks passed
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.

2 participants