test harness: add -Dname to scope the corpus to specific examples
`zig build test -Dname=examples/0625-foo.sx[,examples/0626-bar.sx]` runs ONLY the named example(s) — full repo-relative .sx paths, comma-separated (a leading `./` is tolerated). Empty = run everything (unchanged default). Why: a full `-Dupdate-goldens` re-runs and rewrites all ~690 snapshots, so one flaky/host-divergent example (AOT links, cross-arch `target` examples) can clobber a good snapshot. `-Dname` regenerates only the named example(s) and touches nothing else. It also busts the cached test-run result — the corpus enumerates .sx/expected files at runtime, so a bare snapshot edit alone is otherwise served from cache. - build.zig: new `name` option threaded onto corpus_paths. - corpus_run.test.zig: `nameMatchesFilter` + a per-example skip in the run loop. - CLAUDE.md: document the targeted-regen workflow under Snapshot integrity.
This commit is contained in:
17
CLAUDE.md
17
CLAUDE.md
@@ -492,6 +492,23 @@ Safe workflow:
|
||||
2. Only run `zig build test -Dupdate-goldens` when you've intentionally changed output (new feature, new test, changed formatting).
|
||||
3. After regenerating, review the diff (`git diff examples/expected/ issues/expected/`) to confirm no error messages or empty output were captured.
|
||||
|
||||
**Scope a regen to specific examples with `-Dname`.** A *full* `-Dupdate-goldens`
|
||||
re-runs and rewrites all ~690 snapshots, so a single flaky/host-divergent example
|
||||
(AOT links, cross-arch `target` examples, anything that intermittently fails) can
|
||||
silently clobber a good snapshot. To capture just the example(s) you added, pass
|
||||
their full repo-relative `.sx` path(s), comma-separated — this rewrites ONLY those
|
||||
and touches nothing else:
|
||||
|
||||
```sh
|
||||
zig build test -Dname=examples/0625-comptime-weld-struct-field.sx -Dupdate-goldens
|
||||
zig build test -Dname=examples/0625-foo.sx,examples/0626-bar.sx # verify just these
|
||||
```
|
||||
|
||||
`-Dname` also busts the test-run cache (the corpus enumerates `.sx`/`expected/`
|
||||
files at RUNTIME, so editing a snapshot alone does NOT force a re-run — a plain
|
||||
`zig build test` may be served a cached result). Changing `-Dname` — or any
|
||||
compiler source — forces a fresh run.
|
||||
|
||||
### Adding a new language feature
|
||||
|
||||
There is no monolithic smoke file — each feature is its own focused example.
|
||||
|
||||
Reference in New Issue
Block a user