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

@@ -239,9 +239,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;
/* Private fixture dir — #215: srcd is this dir (not shared /tmp),
* so the driver's srcd-first import search can't pick up a
* polluting same-name file. mkdtemp gives a unique path. */
@@ -263,9 +264,11 @@ run_scenario(const char *bin, const char *w6c, const char *w6c_ww,
fclose(f);
}
/* cstage driver build + run: pins runtime. */
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 runtime; pin
* WW_PKGCACHE under the scratch dir so out/.pkgcache is untouched. */
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, "784[%s]: cstage build failed\n", sc->label);
rc = -1; goto done;
@@ -278,23 +281,24 @@ run_scenario(const char *bin, const char *w6c, const char *w6c_ww,
rc = -1;
}
/* Byte-id net (the #223 discriminator): raw w6c vs w6c_ww on the
* driver-produced combined.ww. Pre-fix the dispatcher diverges. */
char cs_s[1024], ws_s[1024], comb[1024];
snprintf(comb, sizeof comb, "%s/main.combined.ww", dir);
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);
/* Byte-id net (the #223 discriminator): the wwstage driver's --sep
* build emits per-package w6c_ww asm; pre-fix the dispatcher diverges.
* 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(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, "784[%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, "784[%s]: w6c_ww on combined failed\n",
sc->label);
fprintf(stderr, "784[%s]: ww_ww build failed\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, "784[%s]: cs.s/ww.s DIFFER (rule-10 byte-id "
"violation — #223 regression)\n", sc->label);
@@ -321,11 +325,11 @@ main(void)
bin = absbin;
}
char w6c[2100], w6c_ww[2100];
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, "784: w6c_ww missing — cannot run the cs==ww "
char cdrv[2100], wdrv[2100];
snprintf(cdrv, sizeof cdrv, "%s/ww", bin);
snprintf(wdrv, sizeof wdrv, "%s/ww_ww", bin);
if (access(wdrv, X_OK) != 0) {
fprintf(stderr, "784: ww_ww missing — cannot run the cs==ww "
"byte-id gate (the whole point of this test)\n");
return 1;
}
@@ -333,7 +337,7 @@ main(void)
int n = (int)(sizeof scenarios / sizeof scenarios[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++;
}