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 @@
/*
* 990_selfhost — phase-10 marker test. Three probes:
* 990_selfhost — explicit bootstrap/self-host gate. Three probes:
*
* 1. The selfhost stubs (mem.ww, err.ww) must parse, typecheck and
* codegen via C-side `w6c`.
@@ -521,7 +521,7 @@ cleanup:
}
/* resolveunit — produce <fixture>'s RESOLVED translation unit the way
* the sep driver does. `ww build --sep` composes the root package's
* the sep driver does. `ww build` composes the root package's
* <stem>.sepwork/__root.unit.ww: the transitive deps' `.wwi` interface
* stubs followed by the root package body — the single self-contained
* unit w6c/wwdump consume for the root (the producer compiles it with no
@@ -552,7 +552,7 @@ resolveunit(const char *bin, const char *cwd, const char *fixture,
snprintf(cmd, sizeof cmd, "cp %s/%s %s", cwd, fixture, tmpsrc);
runwait(cmd);
snprintf(cmd, sizeof cmd,
"cd %s && timeout 180 %s/ww build --sep %s >/dev/null 2>&1",
"cd %s && timeout 180 %s/ww build %s >/dev/null 2>&1",
td, bin, base);
runwait(cmd);
char stem[768];
@@ -661,7 +661,7 @@ probe_dump_stable(const char *bin)
return fail ? -1 : 0;
}
/* Probe 7: end-to-end via the ww driver's sep path. `ww_ww build --sep`
/* Probe 7: end-to-end via the ww driver's sep path. `ww_ww build`
* drives the ww-side toolchain (w6c_ww → w6a_ww → w6l_ww) over the
* fixture's package graph — per-package compile, archive, reverse-topo
* link — and we run the result, comparing the exit code to the fixture's
@@ -670,7 +670,7 @@ probe_dump_stable(const char *bin)
* dep stack (sym/typ/ast via the syntax package, in a SEPARATE `.o`) into
* a functionally correct binary. The single-`.s` link the combined path
* used is gone with combined-mode (the syntax symbols live in their own
* `.o` under --sep, not in the root unit). */
* `.o` under , not in the root unit). */
static int
probe_ww_links(const char *bin)
{
@@ -698,18 +698,16 @@ probe_ww_links(const char *bin)
char cmd[4096];
snprintf(cmd, sizeof cmd, "cp %s/%s %s", cwd, fix, tmpsrc);
runwait(cmd);
/* Isolated WW_PKGCACHE: the default out/.pkgcache is shared with
* the other phase-2 gates' sep builds (perturb + race). -o + the
* absolute src/-I paths route every side file into tmpdir, so no
* cwd dependency. */
/* -o plus absolute source and include paths route every side file
* into tmpdir, so the probe has no cwd dependency. */
char wexep[512];
snprintf(wexep, sizeof wexep, "%s_w", stem);
snprintf(cmd, sizeof cmd,
"WW_PKGCACHE='%s.cache' timeout 180 %s/ww_ww build --sep "
"timeout 180 %s/ww_ww build "
"-o %s -I %s/lib/ww -I %s/selfhost/cmd/wcc %s >/dev/null 2>&1",
stem, bin, wexep, cwd, cwd, tmpsrc);
bin, wexep, cwd, cwd, tmpsrc);
if (runwait(cmd) != 0) {
fprintf(stderr, "ww-links FAIL: ww_ww build --sep %s\n", fix);
fprintf(stderr, "ww-links FAIL: ww_ww build %s\n", fix);
fail++;
goto cleanup;
}
@@ -808,12 +806,12 @@ main(void)
}
/* The ww1->ww2->ww3 binary fixed point is no longer reproducible here:
* it self-compiled wwdump as a monolith from main.combined.ww, a model
* combined-mode provided and --sep retires (the sep root unit holds only
* the retired combined mode provided (the sep root unit holds only
* the root body + dep INTERFACE stubs, not a linkable whole program). The
* two axes it covered now live elsewhere: the self-application fixed point
* (iterated self-compile converges, ww2==ww3==ww4) is `make bootstrap`'s
* sep-path gate (migrated E2-C1); the orthogonal wwstage==cstage byte
* identity is 995_self_rebuild, which drives ww_ww --sep over all five
* identity is 995_self_rebuild, which drives ww_ww over all five
* tools (wwdump included) and byte-compares against the cstage binaries. */
printf("selfhost: codegen ok; smoke=42; wwdump stable; "
"ww lexer matches C on 8 fixtures (-t); "