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

@@ -290,9 +290,10 @@ static const struct scenario scenarios[] = {
};
static int
run_scenario(const char *bin, const char *w6c, const char *w6c_ww,
run_scenario(const char *bin, const char *cdrv, const char *wdrv,
const struct scenario *sc)
{
(void)bin;
char dir[] = "/tmp/ww848_XXXXXX";
if (mkdtemp(dir) == NULL) {
fprintf(stderr, "848[%s]: mkdtemp failed\n", sc->label);
@@ -311,12 +312,11 @@ run_scenario(const char *bin, const char *w6c, const char *w6c_ww,
fclose(f);
}
char comb[1024];
snprintf(comb, sizeof comb, "%s/main.combined.ww", dir);
/* cstage driver build + run: pins parse + runtime field values. */
snprintf(cmd, sizeof cmd, "cd %s && %s/ww build -I %s %s/main.ww",
dir, bin, dir, dir);
/* #94 sep layout: cstage --sep build + run pins parse + runtime field
* values; pin WW_PKGCACHE under the scratch dir. */
snprintf(cmd, sizeof cmd,
"cd %s && WW_PKGCACHE=%s/pkgc_c %s build --sep -I %s -o %s/main %s/main.ww",
dir, dir, cdrv, dir, dir, dir);
if (runwait(cmd) != 0) {
fprintf(stderr, "848[%s]: cstage build failed "
"(qualified struct literal parse reject?)\n", sc->label);
@@ -330,22 +330,25 @@ run_scenario(const char *bin, const char *w6c, const char *w6c_ww,
rc = -1;
}
/* rule-10 discriminator: raw w6c vs w6c_ww on the driver-produced
* combined.ww must be byte-identical .s. */
/* rule-10 discriminator: the wwstage driver's --sep build emits
* per-package w6c_ww asm that must be byte-identical to cstage's. The
* root + each imported pkg compile to separate <stem>.sepwork/<pkg>.s;
* concat (sorted glob, identical set both stages) for the compare. */
char cs_s[1024], ws_s[1024];
snprintf(cs_s, sizeof cs_s, "%s/cs.s", dir);
snprintf(ws_s, sizeof ws_s, "%s/ww.s", dir);
snprintf(cmd, sizeof cmd, "%s -o %s %s 2>/dev/null", w6c, cs_s, comb);
snprintf(cmd, sizeof cmd,
"cd %s && WW_PKGCACHE=%s/pkgc_w %s build --sep -I %s -o %s/mainww %s/main.ww",
dir, dir, wdrv, dir, dir, dir);
if (runwait(cmd) != 0) {
fprintf(stderr, "848[%s]: w6c on combined failed\n", sc->label);
rc = -1; goto done;
}
snprintf(cmd, sizeof cmd, "%s -o %s %s 2>/dev/null", w6c_ww, ws_s, comb);
if (runwait(cmd) != 0) {
fprintf(stderr, "848[%s]: w6c_ww on combined failed "
fprintf(stderr, "848[%s]: ww_ww build failed "
"(qualified struct literal parse reject?)\n", sc->label);
rc = -1; goto done;
}
snprintf(cs_s, sizeof cs_s, "%s/all_cs.s", dir);
snprintf(ws_s, sizeof ws_s, "%s/all_ww.s", dir);
snprintf(cmd, sizeof cmd, "cat %s/main.sepwork/*.s > %s 2>/dev/null",
dir, cs_s); if (system(cmd)) {}
snprintf(cmd, sizeof cmd, "cat %s/mainww.sepwork/*.s > %s 2>/dev/null",
dir, ws_s); if (system(cmd)) {}
if (slurp_eq(cs_s, ws_s) != 0) {
fprintf(stderr, "848[%s]: cs.s/ww.s DIFFER (rule-10 byte-id "
"violation)\n", sc->label);
@@ -371,13 +374,13 @@ main(void)
bin = absbin;
}
char w6c[2100], w6c_ww[2100], wwdump[2100], wwdump_ww[2100];
snprintf(w6c, sizeof w6c, "%s/w6c", bin);
snprintf(w6c_ww, sizeof w6c_ww, "%s/w6c_ww", bin);
char cdrv[2100], wdrv[2100], wwdump[2100], wwdump_ww[2100];
snprintf(cdrv, sizeof cdrv, "%s/ww", bin);
snprintf(wdrv, sizeof wdrv, "%s/ww_ww", bin);
snprintf(wwdump, sizeof wwdump, "%s/wwdump", bin);
snprintf(wwdump_ww, sizeof wwdump_ww, "%s/wwdump_ww", bin);
if (access(w6c_ww, X_OK) != 0 || access(wwdump_ww, X_OK) != 0) {
fprintf(stderr, "848: w6c_ww/wwdump_ww missing — cannot run the "
if (access(wdrv, X_OK) != 0 || access(wwdump_ww, X_OK) != 0) {
fprintf(stderr, "848: ww_ww/wwdump_ww missing — cannot run the "
"cs==ww byte-id gate (the whole point of this test)\n");
return 1;
}
@@ -386,7 +389,7 @@ main(void)
int na = (int)(sizeof ast_cases / sizeof ast_cases[0]);
int fail = 0;
for (int i = 0; i < n; i++) {
if (run_scenario(bin, w6c, w6c_ww, &scenarios[i]) != 0)
if (run_scenario(bin, cdrv, wdrv, &scenarios[i]) != 0)
fail++;
}
for (int i = 0; i < na; i++) {