Repository navigation
Fixture tooling for any SPINE tag: role-named cases and a manifest - #3
Merged
Merged
Conversation
The golden fixtures get two roles. The current set (current_v1, current_v2, current_v1_lite, current_v2_lite, current_v2_fixed_only, current_incomplete) is written by one SPINE tag, by default the model's; the frozen cases (v2root by v0.16.3, v0.11.1_v1 by v0.11.1) keep their release and are written only with --frozen. The v1.4.0_* files and incomplete are renamed once; their .h5 bytes do not change, and each .expected.json changes only its "case" value. make_fixtures.py: - --tag, --sha and --schema choose the writing tag, its commit and the schema read for lite_dropped (defaults: the committed schema and its tag). - The new spine_checkout.py resolves a tag with git ls-remote (the peeled commit of an annotated tag) and clones each commit once into <workdir>/spine_<sha>, checking HEAD, so a moved tag never reuses old code. It imports neither h5py nor numpy. - tests/data/fixtures/manifest.json records each case's role, tag, commit, layout and file names, and the run's warnings and substitutions. It was created with --manifest-only. Later runs merge: the frozen entries of --manifest-base (default the committed manifest) are carried over. - The cross-checks key on role names; a missing pair is a failure, except in a partial run (--only, --no-reader-check), which the manifest and stdout mark. The lite check compares, per class, with the schema's lite_dropped, both ways. A new check: each file has the asked format_version and info@complete. - SPINE's reader of the writing tag is the only one tried, except for v0.11.1_v1, whose own reader cannot read it. A reader that fails is a check failure. - The current set is written with the writing tag's enum values (spine_worker.py write --configure-enums, content.configure()); a label the tag lacks becomes UNKNOWN and is listed as a substitution. A stored value the file's enum does not name is a failure; an unused label is a warning. - --artifacts-dir keeps the unshipped files, the reader output and the worker logs. Standard output is one JSON summary line. - Exit codes: 0 success, 1 a check failed, 2 usage, 3 a worker could not drive SPINE's API (spine_worker.py exits 3 for that), 4 any other error. test_golden.cpp lists the *.expected.json files instead of a fixed list, and skips a case whose writer.complete is false; a new test case checks the current set's names. test_reader.cpp and test_reader_locking.cpp use the role names. The README and EGM.md contracts describe the roles, the manifest, the options, the enum rule and when the current set is rewritten.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Third step of following SPINE releases: the fixture tooling can write the golden test files with any SPINE tag, and records which commit wrote each one. This is what a later step needs to check a new SPINE tag automatically: write the files with that tag, compare, and commit nothing when nothing changed.
What changes
Two roles for the fixtures.
current_v1,current_v2,current_v1_lite,current_v2_lite,current_v2_fixed_only,current_incomplete.--frozen:v2root(v0.16.3) andv0.11.1_v1(v0.11.1).v1.4.0_*files andincompleteare renamed once (git mv). Their.h5bytes do not change, and each.expected.jsonchanges only its"case"value.make_fixtures.py --tag vX.Y.Z [--sha SHA] [--schema PATH]writes the current set with that tag. The defaults are the committed schema and its tag.--schemais read forlite_dropped, which replaces the hard-coded lite list.tools/fixtures/spine_checkout.py(new, no h5py or numpy) does two things:git ls-remote, taking the peeled commit of an annotated tag.<workdir>/spine_<sha>and checksHEAD, so a moved tag never reuses old code. Frozen cases are checked out at their recorded commits.tests/data/fixtures/manifest.json(new) records each case's role, tag, commit, layout and file names, plus the run's warnings and substitutions. No test reads it.--manifest-only, which records the existing files without rewriting them.--manifest-base(default: the committed manifest, read only) are carried over, and the cases a run writes replace their own entries.Checks.
--onlyor--no-reader-check), which is markedpartialin the manifest and on stdout.lite_dropped, both ways.format_versionandinfo@completeit was asked for.HDF5Readeris tried, except forv0.11.1_v1, which its own reader cannot read. A reader that fails counts as a check failure.Enum values follow the writing tag, for the current set only.
spine_worker.py write --configure-enumspasses the tag'sParticleShape,ParticlePID,NuCurrentTypeandNuInteractionSchemeto the newcontent.configure().UNKNOWNand listed as a substitution. This is what makes v1.2.1 and v1.2.2 writable: they have no GIBUU, NUWRO or NEUT scheme.--frozenstill reproducesv2root.Exit codes:
spine_worker.pyexits 3 for this)Standard output is one JSON summary line.
--artifacts-dirkeeps the files a run would otherwise delete: the unshipped cases, the reader output and the worker logs.Tests.
test_golden.cpplistsfixtures/*.expected.jsoninstead of a fixed list, and skips cases whosewriter.completeisfalse.test_reader.cppandtest_reader_locking.cppuse the role names.Docs:
tools/fixtures/README.mdand theEGM.mdcontracts describe:Facts measured at v1.4.0 stay literal, and say so.
Checked
Same files at v1.4.0.
make_fixtures.py --frozen --out <scratch>regenerates all 10 cases with all 36 checks passing. All 8.expected.jsonand the manifest come out byte-identical to the committed files. (The.h5bytes carry timestamps.)Other tags, into scratch directories:
--tag v1.2.2--tag v1.2.3--tag v0.11.1lite_dropped--spine-repoThe C++ tests on another tag's files. With the v1.2.2 current set swapped in for the committed one, the golden tests pass (59,569 assertions), and so does the whole unit suite.
Builds.
spine_reader_real_filesis skipped as designed.ci/sl7-ups.sh(SL7, UPS gcc 12, HDF5 1.12.2): 134 test cases and 108,878 assertions pass.Users of the old names. No CAFMaker branch refers to the renamed files.