Keep CMake reader/writer test artifacts in the build tree - #1716
Open
vzer200 wants to merge 3 commits into
Open
Conversation
|
| Filename | Overview |
|---|---|
| test/runjsontests.py | Adds optional output-directory creation, input copying with same-file protection, and redirects generated artifacts while retaining source expected-result comparisons. |
| src/jsontestrunner/CMakeLists.txt | Configures separate build-tree artifact directories for the custom target and CTests while retaining serialization between the two CTests. |
| CONTRIBUTING.md | Documents default manual artifact placement, the new output-directory option, and CMake’s build-tree behavior. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
S[Source fixtures and expected results] --> R[runjsontests.py]
R -->|jsoncpp_check| J[Build tree: test-output/jsoncpp_check]
R -->|CTest reader/writer tests| C[Build tree: test-output/ctest]
C --> L[CTest resource lock serializes shared artifacts]
J --> V[Compare generated results with source expectations]
C --> V
Reviews (3): Last reviewed commit: "Separate CTest and custom target output ..." | Re-trigger Greptile
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.
Out-of-source CMake tests still write
.actual,.rewrite,.actual-rewrite, and.process-outputbeside the source fixtures. With a read-only source tree, both reader/writer CTests fail while the unit test passes.Add an optional
runjsontests.py --output-dirand use separate build-tree directories for CTest (test-output/ctest) andjsoncpp_check(test-output/jsoncpp_check). The runner copies writer-test inputs there on each run, keeps expected results in the original source directory, and leaves parse-only fixtures in place. Manual calls without the option retain their existing behavior. Existing same-file inputs are recognized by file identity, including case aliases and hardlinks. Directory creation tolerates another caller creating that directory concurrently. The two reader/writer CTests retain their resource lock, and a concurrent custom-target run uses separate files. Multiple independently launched instances of the same entry point still require caller coordination or distinct output directories.Fixes #1515.
Validation on Windows with LLVM-MinGW Clang 23, CMake 4.4.3, Ninja, and Python 3.12:
-j 3andjsoncpp_checkwhile writes to source fixtures were denied: all passed. Verified the denial was effective and all 401 fixture files retained their content and modification times; restored the original permissions afterward.jsoncpp_check/CTest pairs with source writes denied. All six commands passed; both output directories had matching artifact contents, all 401 source fixtures were unchanged, and source permissions were restored.git diff --checkpassed. No C++ library or ABI changes.Prepared with Codex and reviewed by a separate automated agent. The review found two same-file alias failures in the initial implementation; both were corrected and the final revision was rechecked before submission. No human review is claimed. The read-only reproduction used Windows ACLs, not a Unix read-only mount.