test/wcc: carrier ownership repair and driver-contract adaptation

Every surviving carrier now owns its artifacts: checked mkdir/mkdtemp/
fopen acquisition, one all-exit cleanup funnel per carrier, ENOENT-
tolerant checked unlinks, exact-path deletion (rm -rf only for an
owned pid-keyed dir or a .sepwork beneath one), and cleanup failure
fails a passing carrier without overwriting its diagnostic. In the
same pass the carriers adapt to the driver contract this branch lands:
--sep and WW_PKGCACHE are gone, -S and the /tmp/ww_run_<pid> scratch
contract are asserted, and rows whose runtime or reject coverage moved
to test/wcc/data fixtures or test/lang @test owners are trimmed to the
byte/artifact/diagnostic observations only they can make.

Repair and adaptation ride together because most files interleave both
in the same hunks; splitting would manufacture intermediate carrier
states that never existed and cannot run against either driver.
This commit is contained in:
2026-08-07 23:02:47 +09:00
parent b2899dd8d3
commit a95a7a316b
132 changed files with 7573 additions and 6172 deletions

View File

@@ -1,5 +1,5 @@
/*
* 991_w6a_ww — phase-10 marker for the ww-side w6a port.
* 991_w6a_ww — explicit bootstrap gate for the ww-side w6a port.
*
* Diffs the C-built `w6a` against the ww-built `w6a_ww` on a corpus of
* .s files. Both must produce byte-identical ELF .o output. The corpus
@@ -104,18 +104,22 @@ main(void)
if (getcwd(cwd, sizeof cwd) == NULL) return 1;
/* #93 sep layout: the selfhost tools no longer leave a single
* next-to-source main.s. Self-build one real tool via `ww build
* --sep` into /tmp and feed EVERY emitted <tool>.sepwork/<pkg>.s as
* next-to-source main.s. Self-build one real tool via the explicit
* main.ww compatibility root and feed EVERY emitted
* <tool>.sepwork/<pkg>.s as
* the generated-asm corpus — the root tool code plus each dep
* package's .s (richer than the old 3 monolithic main.s). Flip-
* invariant: --sep is live on trunk, default post-flip. */
* package's .s (richer than the old 3 monolithic main.s). The directory
* intentionally contains package main plus legacy file-import packages,
* so it is not a directory-package root. */
char stem[256], cmd[4096];
snprintf(stem, sizeof stem, "/tmp/wwa_%d_sh", getpid());
snprintf(cmd, sizeof cmd,
"WW_PKGCACHE=%s.pkgc timeout 400 %s/ww build --sep -o %s "
"%s/selfhost/cmd/w6a >/dev/null 2>&1", stem, bin, stem, cwd);
"timeout 400 %s/ww build -o %s "
"%s/selfhost/cmd/w6a/main.ww >/dev/null 2>&1",
bin, stem, cwd);
if (runwait(cmd) != 0) {
fprintf(stderr, "w6a_ww FAIL: cannot sep-build selfhost/cmd/w6a\n");
fprintf(stderr,
"w6a_ww FAIL: cannot sep-build selfhost/cmd/w6a/main.ww\n");
return 1;
}
@@ -152,8 +156,7 @@ main(void)
globfree(&g);
}
snprintf(cmd, sizeof cmd, "rm -rf %s.sepwork %s.pkgc %s",
stem, stem, stem);
snprintf(cmd, sizeof cmd, "rm -rf %s.sepwork %s", stem, stem);
if (system(cmd)) {}
if (fail) {