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

@@ -53,21 +53,20 @@ static const struct check checks[] = {
/* build_s — build `src` via `driver`, leaving the unit asm at `<stem>.s`;
* returns 0 on success.
* #93 sep layout: `--sep -o <stem>` splits the asm across
* #93 sep layout: `-o <stem>` splits the asm across
* <stem>.sepwork/<pkg>.s (root in __root.s, the imported encoding.utf8 in
* encoding.utf8.s). The mangled `encoding.utf8.runesz` definition lives in
* the per-pkg .s and `TEXT main,` in __root.s, so we CONCAT all the
* per-unit .s (sorted glob order is deterministic) into a single <stem>.s
* for the needle scans + the rule-10 cmp downstream. WW_PKGCACHE is pinned
* beside <stem> to leave the shared out/.pkgcache untouched. */
* for the needle scans + the rule-10 cmp downstream. */
static int
build_s(const char *driver, const char *src, const char *stem)
{
char cmd[1024];
snprintf(cmd, sizeof cmd,
"WW_PKGCACHE='%s.pkgc' timeout 180 %s build --sep -o '%s' '%s' "
"timeout 180 %s build -S -o '%s' '%s' "
"2>/dev/null && cat '%s.sepwork/'*.s > '%s.s'",
stem, driver, stem, src, stem, stem);
driver, stem, src, stem, stem);
return runwait(cmd);
}
@@ -146,10 +145,18 @@ main(void)
fprintf(stderr, "m1mangle_sym: skip wwstage (no ww_ww)\n");
}
char cmd[256];
/* #93: -rf to also drop the per-stem .sepwork scratch + pinned pkgc. */
snprintf(cmd, sizeof cmd, "rm -rf '%s' '%s'* '%s'*", src, cstem, wstem);
runwait(cmd);
char cmd[512];
/* #93: -rf also drops the per-stem .sepwork scratch. Exact owned
* paths only (`build -S` writes solely under <stem>.sepwork/, plus
* build_s's <stem>.s concat) — no prefix glob; a failed rm must fail
* the carrier, not leak silently. */
snprintf(cmd, sizeof cmd,
"rm -rf '%s' '%s.s' '%s.sepwork' '%s.s' '%s.sepwork'",
src, cstem, cstem, wstem, wstem);
if (runwait(cmd) != 0) {
fprintf(stderr, "m1mangle_sym: cleanup rm failed\n");
fail++;
}
if (fail) {
fprintf(stderr, "m1mangle_sym: %d checks failed\n", fail);