Skip to content

Manifezt: handle dep annotations from the Manifest

Romain requested to merge nomadic-labs/tezos:romain-manifezt-2 into master

See milestone: %Conditional Octez tests

What

This MR makes Manifezt take some annotations from the Manifest into account:

  • dep_files
  • preprocessor_deps
  • dep_globs
  • dep_globs_rec

Why

In the Manifest, Tezt test targets can be annotated to declare that they depend on files. If those files are modified, such tests may break, so they should be run. Before this MR, manifest/manifezt.sh could fail to select those tests, although it would often select them anyway for other reasons. For instance, if the files were in the same directory as the test, Manifezt thought that the source file of the test changed, and thus it would run the test anyway. So this is mostly important for files in subdirectories.

How

dep_files and preprocessor_deps are easy, as they refer to fixed paths. So one can just check whether they are in the list of changes. Although one needs to be careful about using canonical paths (i.e. consider x/../toto and toto to be the same).

dep_globs and dep_globs_rec use glob syntax, documented here: https://dune.readthedocs.io/en/stable/concepts/dependency-spec.html#glob Since glob syntax is not simple, I didn't want to implement a parser for it for now. So I use an overapproximation. In Dune's glob syntax, the glob part is only in the filename, not in the directory part. So I just take the directory into account; if any file inside it is changed, then the glob matches. This means that unnecessary tests may be selected, but I think it is an acceptable compromise. If we were to support glob syntax, instead of making a parser we could make an AST and require annotations to use the AST directly to avoid the parsing phase.

Manually testing the MR

Before this MR:

$ make -C manifest
$ manifest/manifest --manifezt src/lib_bls12_381/test/test_vectors/hash_to_curve_g1/g1_fips_186_3_B233
false

false meant no test was selected.

After this MR:

$ make -C manifest
$ manifest/manifest --manifezt src/lib_bls12_381/test/test_vectors/hash_to_curve_g1/g1_fips_186_3_B233
file = "src/lib_bls12_381/test/ff_pbt.ml" || file = "src/lib_bls12_381/test/test_ec_make.ml" || file = "src/lib_bls12_381/test/test_fq12.ml" || file = "src/lib_bls12_381/test/test_fr.ml" || file = "src/lib_bls12_381/test/test_g1.ml" || file = "src/lib_bls12_381/test/test_g2.ml" || file = "src/lib_bls12_381/test/test_gt.ml" || file = "src/lib_bls12_381/test/test_hash_to_curve.ml" || file = "src/lib_bls12_381/test/test_pairing.ml" || file = "src/lib_bls12_381/test/test_random_state.ml" || file = "src/lib_bls12_381/test/utils.ml"

Tests are correctly selected. Those correspond to the annotation ~dep_globs_rec:["test_vectors/*"].

Checklist

  • Document the interface of any function added or modified (see the coding guidelines)
  • Document any change to the user interface, including configuration parameters (see node configuration)
  • Provide automatic testing (see the testing guide).
  • For new features and bug fixes, add an item in the appropriate changelog (docs/protocols/alpha.rst for the protocol and the environment, CHANGES.rst at the root of the repository for everything else).
  • Select suitable reviewers using the Reviewers field below.
  • Select as Assignee the next person who should take action on that MR

Merge request reports