ww test: fork-isolated record-and-continue harness (lib/test, both stages)

lib/test/run.ww: fork+wait4 runner; each @test runs in its own child,
abort/SEGV/FPE decoded from wait-status, failures recorded and the run
continues; exit = fail count. Tests are hermetic: module globals do not
persist test-to-test (fresh fork image; sanctioned divergence from
harec's shared-process __test_main, no setjmp/signal layer needed).
-T synth (both stages) emits a module-global (str,*fn() void) table +
return run(table) instead of straight-line calls. Driver twins bundle
lib/test under test mode and gain ww test -c/-o (go test -c) so the
byte-id gates diff the same artifact the real path builds. Gates
989/910/997 rewired onto it; new 911 pins record-and-continue across
all three fault classes; 949 +3 rows. (#17-team commit-2)
This commit is contained in:
2026-06-11 00:08:39 +09:00
parent 08a76cf4c8
commit 16c83e70d3
15 changed files with 961 additions and 194 deletions

View File

@@ -5,9 +5,11 @@
* build/run — a lone -I/-L/-l/-o (flag with no following argument) is a
* hard error "ww <cmd>: -X needs an argument" (rc 2), not a
* silently-swallowed positional.
* test — only -I carries meaning; -l/-L/-o and any unknown flag are
* rejected with "ww test: unknown flag" (rc 2); a lone -I is
* "ww test: -I needs an argument" (rc 2).
* test — -I/-c/-o carry meaning; -l/-L and any unknown flag are
* rejected with "ww test: unknown flag" (rc 2); a lone -I/-o
* is "ww test: -X needs an argument" (rc 2); -c/-o without a
* single test file is "ww test: -c/-o need a single test file"
* (rc 2, #17).
* Each row asserts the expected rc + stderr substring AND that the two
* drivers are byte-identical (rule 10): the cstage parse_build_flags /
* do_test must match the wwstage main.ww dobuild/dorun/dotest verbatim.
@@ -36,9 +38,14 @@ static const struct row rows[] = {
{ "run -o", 2, "ww run: -o needs an argument" },
{ "run -l", 2, "ww run: -l needs an argument" },
{ "test -l", 2, "ww test: unknown flag" },
{ "test -o x", 2, "ww test: unknown flag" },
{ "test -zz", 2, "ww test: unknown flag" },
{ "test -I", 2, "ww test: -I needs an argument" },
/* #17: -c (compile-only) + -o are now meaningful for `test`; a lone -o
* needs an arg, and -c/-o require a single test file (not the default
* "." directory enumeration). */
{ "test -o", 2, "ww test: -o needs an argument" },
{ "test -o x", 2, "ww test: -c/-o need a single test file" },
{ "test -c", 2, "ww test: -c/-o need a single test file" },
};
/* Run "<bin>/<drv> <args>" capturing rc + stderr text into err (NUL-