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

@@ -63,7 +63,7 @@ main(void)
char cwd[1024];
if (getcwd(cwd, sizeof cwd) == NULL) return 1;
/* #93 sep layout: build the example via `ww build --sep` into a
/* #93 sep layout: build the example via `ww build` into a
* private /tmp stem (NOT next to the tracked example source), then
* link <stem>.sepwork/__root.o — the self-contained single-package
* object the flip emits in place of the old next-to-source .o. */
@@ -71,9 +71,9 @@ main(void)
snprintf(mbstem, sizeof mbstem, "/tmp/wwld_%d_mb", getpid());
snprintf(mbobj, sizeof mbobj, "%s.sepwork/__root.o", mbstem);
snprintf(cmd, sizeof cmd,
"cd %s/examples/mandelbrot && WW_PKGCACHE=%s.pkgc %s/ww build --sep "
"cd %s/examples/mandelbrot && %s/ww build "
"-o %s mandelbrot.ww -L /usr/lib -l c >/dev/null 2>&1",
cwd, mbstem, bin, mbstem);
cwd, bin, mbstem);
if (runwait(cmd) != 0) {
fprintf(stderr, "w6l_ww-dyn FAIL: cannot build mandelbrot.o via C driver\n");
return 1;
@@ -122,8 +122,8 @@ main(void)
}
free(bc); free(bw);
unlink(co); unlink(wo);
/* #93: the sep scratch + tmpdir-pinned pkgcache. */
snprintf(cmd, sizeof cmd, "rm -rf %s.sepwork %s.pkgc %s", mbstem, mbstem, mbstem);
/* #93: the sep scratch + tmpdir-owned outputs. */
snprintf(cmd, sizeof cmd, "rm -rf %s.sepwork %s", mbstem, mbstem);
if (system(cmd)) {}
return rc;
}