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 @@
/*
* 994_w6c_ww — phase-10 marker for the ww-side w6c port.
* 994_w6c_ww — explicit bootstrap gate for the ww-side w6c port.
*
* w6c_ww is a thin packaging of selfhost/cmd/wcc/cgen.ww: it slurps a
* .ww file, runs lex+parse+cgen, and writes Plan 9 amd64 asm to the
@@ -331,8 +331,8 @@ main(void)
* .s/.o/.wwi (cs==ww on the real tool's sep artifacts, rule 10). The
* combined corpus + the sep-out==combined-out leg are gone — combined-mode
* is being retired (E3 flip), so combined.ww is no longer fed as compiler
* INPUT; the per-pkg cs==ww comparison is the surviving live oracle. COLD
* (pid-keyed scratch, wiped); heavy (≈ one bootstrap leg) → phase-2. */
* INPUT; the per-pkg cs==ww comparison is the surviving live oracle. Its
* cold pid-keyed scratch is wiped after the explicit bootstrap gate. */
{
char inc[4096], cmd[16384];
snprintf(inc, sizeof inc,
@@ -345,16 +345,14 @@ main(void)
for (int s = 0; s < 2; s++) {
snprintf(stg[s].prog, sizeof stg[s].prog,
"/tmp/wwc6tc_%d_%s", getpid(), stg[s].tag);
/* Isolated per-(pid,stage) WW_PKGCACHE → COLD + race-free
* (rob-c6-spec §4): the default out/.pkgcache is shared with
* the other phase-2 gates' `ww build`s and would both perturb
* this gate and corrupt under concurrent writes. */
/* Per-(pid,stage) output stems isolate every artifact used by
* this gate. */
snprintf(cmd, sizeof cmd,
"WW_PKGCACHE='%s.cache' timeout 600 %s/%s build --sep "
"timeout 600 %s/%s build "
"%s -o %s %s >/dev/null 2>&1",
stg[s].prog, bin, stg[s].drv, inc, stg[s].prog, root);
bin, stg[s].drv, inc, stg[s].prog, root);
if (runwait(cmd) != 0) {
fprintf(stderr, "Tier-C FAIL: %s build --sep w6c\n",
fprintf(stderr, "Tier-C FAIL: %s build w6c\n",
stg[s].drv);
fail++;
} else stg[s].ok = 1;