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

@@ -268,51 +268,55 @@ run_row(const char *driver, const char *cwd, const struct row *r, int seq)
return rc;
}
/* asm_byte_identical — build combined.ww via the cstage driver (needs
* the -I lib fmt import resolution that raw w6c can't do), then compile
* that combined.ww with both w6c and w6c_ww and diff the asm. Proves no
* cs!=ww tag/render divergence on the widened union. */
/* asm_byte_identical — #94 sep layout: the cstage driver's --sep build
* (which needs -I lib for fmt import resolution that raw w6c can't do)
* emits per-package w6c asm to <stem>_c.sepwork/, and the wwstage driver's
* --sep build emits per-package w6c_ww asm to <stem>_w.sepwork/. Concat
* (sorted glob, identical package set) and diff — proves no cs!=ww
* tag/render divergence on the widened union. */
static int
asm_byte_identical(const char *bin, const char *cdrv, const char *cwd,
asm_byte_identical(const char *cdrv, const char *wdrv, const char *cwd,
const struct row *r, int seq)
{
char tmpdir[256], base[64], src[512], combined[640], cs[640], ws[640];
char tmpdir[256], base[64], src[512], cs[640], ws[640];
char cmd[2048];
snprintf(tmpdir, sizeof tmpdir, "/tmp/fic_%d_b_%d", getpid(), seq);
snprintf(base, sizeof base, "main815b");
snprintf(src, sizeof src, "%s/%s.ww", tmpdir, base);
snprintf(combined, sizeof combined, "%s/%s.combined.ww", tmpdir, base);
snprintf(cs, sizeof cs, "%s/%s_c.s", tmpdir, base);
snprintf(ws, sizeof ws, "%s/%s_w.s", tmpdir, base);
snprintf(cs, sizeof cs, "%s/all_cs.s", tmpdir);
snprintf(ws, sizeof ws, "%s/all_ww.s", tmpdir);
mkdir(tmpdir, 0755);
if (write_source(src, r->src) != 0) { cleanup_tmp(tmpdir, base); return -1; }
snprintf(cmd, sizeof cmd,
"cd %s && timeout 180 %s build -I %s/lib %s 2>/dev/null",
tmpdir, cdrv, cwd, src);
if (runwait(cmd) != 0) {
fprintf(stderr, "fmt_int_run[byteid][%s]: combined.ww build failed\n",
r->label);
cleanup_tmp(tmpdir, base);
if (write_source(src, r->src) != 0) {
snprintf(cmd, sizeof cmd, "rm -rf %s", tmpdir);
if (system(cmd)) {}
return -1;
}
int rc = 0;
snprintf(cmd, sizeof cmd, "%s/w6c -o %s %s 2>/dev/null", bin, cs, combined);
snprintf(cmd, sizeof cmd,
"cd %s && WW_PKGCACHE=%s/pkgc_c timeout 180 %s build --sep -I %s/lib "
"-o %s/%s_c %s 2>/dev/null", tmpdir, tmpdir, cdrv, cwd, tmpdir, base, src);
if (runwait(cmd) != 0) {
fprintf(stderr, "fmt_int_run[byteid][%s]: w6c errored\n", r->label);
fprintf(stderr, "fmt_int_run[byteid][%s]: cstage sep build failed\n",
r->label);
rc = -1;
}
if (rc == 0) {
snprintf(cmd, sizeof cmd, "%s/w6c_ww -o %s %s 2>/dev/null",
bin, ws, combined);
snprintf(cmd, sizeof cmd,
"cd %s && WW_PKGCACHE=%s/pkgc_w timeout 180 %s build --sep "
"-I %s/lib -o %s/%s_w %s 2>/dev/null",
tmpdir, tmpdir, wdrv, cwd, tmpdir, base, src);
if (runwait(cmd) != 0) {
fprintf(stderr, "fmt_int_run[byteid][%s]: w6c_ww errored\n",
r->label);
fprintf(stderr, "fmt_int_run[byteid][%s]: wwstage sep build "
"failed\n", r->label);
rc = -1;
}
}
if (rc == 0) {
snprintf(cmd, sizeof cmd, "cat %s/%s_c.sepwork/*.s > %s 2>/dev/null",
tmpdir, base, cs); if (system(cmd)) {}
snprintf(cmd, sizeof cmd, "cat %s/%s_w.sepwork/*.s > %s 2>/dev/null",
tmpdir, base, ws); if (system(cmd)) {}
FILE *fc = fopen(cs, "rb");
FILE *fw = fopen(ws, "rb");
if (!fc || !fw) {
@@ -333,8 +337,8 @@ asm_byte_identical(const char *bin, const char *cdrv, const char *cwd,
r->label);
}
unlink(cs); unlink(ws);
cleanup_tmp(tmpdir, base);
snprintf(cmd, sizeof cmd, "rm -rf %s", tmpdir);
if (system(cmd)) {}
return rc;
}
@@ -382,7 +386,7 @@ main(void)
if (wwpresent) {
for (int i = 0; i < n; i++) {
total++;
if (asm_byte_identical(bin, cdrv, cwd, &rows[i], seq++) != 0)
if (asm_byte_identical(cdrv, wdrv, cwd, &rows[i], seq++) != 0)
fail++;
}
} else {