test: retarget Pattern-A combined-feed gates to sep .sepwork layout (M4 E3, #94)

94a of the C-mig2 split (rob rule-11): 13 Pattern-A gates that fed a
.combined.ww to w6c/w6c_ww now drive two --sep builds (ww / ww_ww) and
byte-diff the concatenated per-package .sepwork/*.s, mirroring #93's
convention. Lands pre-flip while combined.ww still exists as the
reversible safety net. Test-only; all 5 binary pins HOLD.

989_enumcap_run deferred to 94b (its decisive assertion is a combined.ww
content diff, not a .s diff).
This commit is contained in:
2026-06-18 16:44:41 +09:00
parent 7b6f24adea
commit bbd2ad390a
14 changed files with 377 additions and 391 deletions

View File

@@ -149,11 +149,10 @@ main(void)
bin = absbin;
}
char w6c[1100], w6c_ww[1100];
snprintf(w6c, sizeof w6c, "%s/w6c", bin);
snprintf(w6c_ww, sizeof w6c_ww, "%s/w6c_ww", bin);
if (access(w6c_ww, X_OK) != 0) {
fprintf(stderr, "defdim_struct: w6c_ww missing — cannot run "
char wdrv[1100];
snprintf(wdrv, sizeof wdrv, "%s/ww_ww", bin);
if (access(wdrv, X_OK) != 0) {
fprintf(stderr, "defdim_struct: ww_ww missing — cannot run "
"the cs==ww byte-id gate (the whole point of this test)\n");
return 1;
}
@@ -172,17 +171,6 @@ main(void)
getpid(), i);
mkdir(tmpdir, 0755);
char cmd[2048];
snprintf(cmd, sizeof cmd, "cd %s && %s/ww build %s",
tmpdir, bin, src);
if (runwait(cmd) != 0) {
fprintf(stderr, "row[%s]: cstage build failed\n",
rows[i].label);
fail++;
unlink(src); rmdir(tmpdir);
continue;
}
char base[64];
const char *b = strrchr(src, '/');
b = b ? b + 1 : src;
@@ -190,21 +178,30 @@ main(void)
char *dot = strrchr(base, '.');
if (dot && strcmp(dot, ".ww") == 0) *dot = '\0';
char outbin[160], combined[96], arto[96], arts[96];
/* `ww build` writes the runnable binary into the build cwd
* (tmpdir) but its intermediates — the concatenated module
* source .combined.ww, plus .o/.s — next to the SOURCE. The
* byte-id leg compiles that combined form, not the raw src:
* w6c does no import resolution, so the cross-module row's
* `import os` only folds once concatenated. A same-module row
* combines to itself, so the one path serves every row. */
snprintf(outbin, sizeof outbin, "%s/%s", tmpdir, base);
snprintf(combined, sizeof combined,
"/tmp/wwdds_%d_%d.combined.ww", getpid(), i);
snprintf(arto, sizeof arto, "/tmp/wwdds_%d_%d.o", getpid(), i);
snprintf(arts, sizeof arts, "/tmp/wwdds_%d_%d.s", getpid(), i);
/* #94 sep layout: each driver's --sep build emits the runnable
* binary at <stem> + per-package asm under <stem>.sepwork/.
* Distinct stems so the wwstage sepwork doesn't clobber cstage's;
* pin WW_PKGCACHE under tmpdir so out/.pkgcache is untouched. A
* cross-module row's `import os` resolves per-package, a same-
* module row is just __root — both compare via the sorted glob. */
char cmd[2048], stem_c[160], stem_w[160];
snprintf(stem_c, sizeof stem_c, "%s/%s_c", tmpdir, base);
snprintf(stem_w, sizeof stem_w, "%s/%s_w", tmpdir, base);
int got = runwait(outbin);
snprintf(cmd, sizeof cmd,
"cd %s && WW_PKGCACHE=%s/pkgc_c %s/ww build --sep -o %s %s",
tmpdir, tmpdir, bin, stem_c, src);
if (runwait(cmd) != 0) {
fprintf(stderr, "row[%s]: cstage build failed\n",
rows[i].label);
fail++;
unlink(src);
snprintf(cmd, sizeof cmd, "rm -rf %s", tmpdir);
if (system(cmd)) {}
continue;
}
int got = runwait(stem_c);
if (got != rows[i].want_exit) {
fprintf(stderr, "row[%s]: cstage exit %d, want %d\n",
rows[i].label, got, rows[i].want_exit);
@@ -217,19 +214,21 @@ main(void)
snprintf(ws_s, sizeof ws_s, "/tmp/wwdds_%d_%d_ww.s",
getpid(), i);
snprintf(cmd, sizeof cmd, "%s -o %s %s 2>/dev/null",
w6c, cs_s, combined);
snprintf(cmd, sizeof cmd,
"cd %s && WW_PKGCACHE=%s/pkgc_w %s/ww_ww build --sep -o %s %s "
">/dev/null 2>&1", tmpdir, tmpdir, bin, stem_w, src);
if (runwait(cmd) != 0) {
fprintf(stderr, "row[%s]: w6c failed\n", rows[i].label);
fprintf(stderr, "row[%s]: ww_ww build failed\n",
rows[i].label);
fail++;
} else {
snprintf(cmd, sizeof cmd, "%s -o %s %s 2>/dev/null",
w6c_ww, ws_s, combined);
if (runwait(cmd) != 0) {
fprintf(stderr, "row[%s]: w6c_ww failed\n",
rows[i].label);
fail++;
} else if (slurp_eq(cs_s, ws_s) != 0) {
snprintf(cmd, sizeof cmd,
"cat %s.sepwork/*.s > %s 2>/dev/null", stem_c, cs_s);
if (system(cmd)) {}
snprintf(cmd, sizeof cmd,
"cat %s.sepwork/*.s > %s 2>/dev/null", stem_w, ws_s);
if (system(cmd)) {}
if (slurp_eq(cs_s, ws_s) != 0) {
fprintf(stderr,
"row[%s]: cstage/wwstage .s DIFFER "
"(rule-10 byte-id violation)\n",
@@ -238,8 +237,8 @@ main(void)
}
}
unlink(outbin); rmdir(tmpdir);
unlink(combined); unlink(arto); unlink(arts);
snprintf(cmd, sizeof cmd, "rm -rf %s", tmpdir);
if (system(cmd)) {}
unlink(src); unlink(cs_s); unlink(ws_s);
}