test: re-point 990/994/#110 off combined.ww-input to sep-feed (M4 E4-keystone, #22)
The E3 driver flip makes build_one_sep the sole path; it writes .sepwork/*.unit.ww, not <stem>.combined.ww, so the flip stops producing combined.ww. Migrate its consumers to sep-feed first, while both build paths still exist (reversible; all 5 stage binaries stay byte-identical): - 990_selfhost: resolveunit drives `ww build --sep` and reads <stem>.sepwork/__root.unit.ww; probe_cgen_match gains err.ww (sep inlines fmt's .wwi only, so cs==ww holds); probe_ww_links re-expressed as `ww_ww build --sep`->run; probe_bootstrap_fixed_point removed (the monolith path it tested is deleted by E4 -- the self-application axis lives in `make bootstrap`, the cs==ww axis in 995). - 994_w6c_ww: drop the combined-fed emit_eq + corpus; keep the live per-package cs-sep==ww-sep oracle (cmp_sepwork + diff_one + bad[]). - #110 combined_ww_fresh gate removed (its regen-vs-committed premise dies with its producer). Non-vacuity proven: a one-line emitter mutation reddens 994's per-package cs!=ww check across 15 packages; revert restores green.
This commit is contained in:
@@ -120,41 +120,6 @@ files_eq(const char *a, const char *b)
|
||||
return eq ? 0 : 1;
|
||||
}
|
||||
|
||||
/* Tier-C oracle helper (rob-c6-spec §2 / amendment-B): a sep-built w6c at
|
||||
* `sepw6c` must EMIT byte-identical asm to the combined-built `w6c_ww` on
|
||||
* `target`. (We assert OUTPUT equivalence, never `cmp` the tool binaries —
|
||||
* sep vs combined differ by a constant link-layout delta.) Returns 0 on
|
||||
* byte-identical .s, non-zero otherwise. */
|
||||
static int
|
||||
emit_eq(const char *sepw6c, const char *w6c_ww, const char *target,
|
||||
const char *label)
|
||||
{
|
||||
char a[64], b[64], cmd[4096];
|
||||
snprintf(a, sizeof a, "/tmp/wwc6tc_%d_sep.s", getpid());
|
||||
snprintf(b, sizeof b, "/tmp/wwc6tc_%d_comb.s", getpid());
|
||||
snprintf(cmd, sizeof cmd, "timeout 240 %s -o %s %s 2>/dev/null",
|
||||
sepw6c, a, target);
|
||||
if (runwait(cmd) != 0) {
|
||||
fprintf(stderr, "Tier-C FAIL: sep-w6c emit errored on %s\n", label);
|
||||
unlink(a);
|
||||
return 1;
|
||||
}
|
||||
snprintf(cmd, sizeof cmd, "timeout 240 %s -o %s %s 2>/dev/null",
|
||||
w6c_ww, b, target);
|
||||
if (runwait(cmd) != 0) {
|
||||
fprintf(stderr, "Tier-C FAIL: combined-w6c_ww emit errored on %s\n",
|
||||
label);
|
||||
unlink(a); unlink(b);
|
||||
return 1;
|
||||
}
|
||||
int rc = files_eq(a, b);
|
||||
if (rc != 0)
|
||||
fprintf(stderr, "Tier-C FAIL: %s — sep-out != combined-out "
|
||||
"(M4 output-equivalence broken)\n", label);
|
||||
unlink(a); unlink(b);
|
||||
return rc == 0 ? 0 : 1;
|
||||
}
|
||||
|
||||
/* cs==ww over a sep-build's per-package artifacts: every .s/.o/.wwi the
|
||||
* cstage driver produced in `csdir` must be byte-identical to the wwstage
|
||||
* driver's same-named file in `wwdir` (rule 10; the .wwi interface files
|
||||
@@ -309,17 +274,6 @@ main(void)
|
||||
{ NULL, NULL },
|
||||
};
|
||||
|
||||
/* Source-tree corpus: the same .combined.ww files the bootstrap
|
||||
* fixed point chews on. Confirms w6c_ww handles realistic inputs,
|
||||
* not just hand-tailored ones. */
|
||||
const char *combined_rel[] = {
|
||||
"selfhost/cmd/wwdump/main.combined.ww",
|
||||
"selfhost/cmd/w6a/main.combined.ww",
|
||||
"selfhost/cmd/w6l/main.combined.ww",
|
||||
"selfhost/cmd/ww/main.combined.ww",
|
||||
NULL,
|
||||
};
|
||||
|
||||
int fail = 0, n = 0;
|
||||
|
||||
for (int i = 0; progs[i].label; i++) {
|
||||
@@ -330,12 +284,6 @@ main(void)
|
||||
unlink(src);
|
||||
n++;
|
||||
}
|
||||
for (int i = 0; combined_rel[i]; i++) {
|
||||
char p[2048];
|
||||
snprintf(p, sizeof p, "%s/%s", cwd, combined_rel[i]);
|
||||
if (diff_one(bin, combined_rel[i], p) != 0) fail++;
|
||||
n++;
|
||||
}
|
||||
|
||||
/* #50: the check pass is wired into both wwdump_ww -c and
|
||||
* w6c_ww in front of cgen. Pre-#50, a hard type error parsed
|
||||
@@ -376,22 +324,19 @@ main(void)
|
||||
n++;
|
||||
}
|
||||
|
||||
/* ---- Tier-C capstone (#46 c6, rob-c6-spec §2 / amendment-B) ----------
|
||||
* Fold the dual-path soak into this bootstrap oracle: a w6c built by
|
||||
* SEPARATE compilation must EMIT byte-identical .s to the combined-built
|
||||
* w6c_ww on every real bootstrap input, and both driver stages must
|
||||
* sep-produce byte-identical per-package .s/.o/.wwi (cs==ww on the real
|
||||
* tool's sep artifacts). This is the load-bearing M4 proof — the
|
||||
* combined-out==sep-out leg the bootstrap fixed point alone cannot reach.
|
||||
* We assert OBSERVABLE OUTPUT, never `cmp` the tool binaries (sep vs
|
||||
* combined differ by a constant link-layout delta). COLD (pid-keyed
|
||||
* scratch, wiped); heavy (≈ one bootstrap leg) → this gate is phase-2. */
|
||||
/* ---- Tier-C capstone (#46 c6, rob-c6-spec §2 / amendment-B; M4 #89) ---
|
||||
* The load-bearing M4 oracle: build w6c by SEPARATE compilation under
|
||||
* BOTH driver stages and prove they sep-produce byte-identical per-package
|
||||
* .s/.o/.wwi (cs==ww on the real tool's sep artifacts, rule 10). The
|
||||
* combined corpus + the sep-out==combined-out leg are gone — combined-mode
|
||||
* is being retired (E3 flip), so combined.ww is no longer fed as compiler
|
||||
* INPUT; the per-pkg cs==ww comparison is the surviving live oracle. COLD
|
||||
* (pid-keyed scratch, wiped); heavy (≈ one bootstrap leg) → phase-2. */
|
||||
{
|
||||
char inc[4096], cmd[16384];
|
||||
snprintf(inc, sizeof inc,
|
||||
"-I %s/lib -I %s/lib/ww -I %s/selfhost/cmd/wcc", cwd, cwd, cwd);
|
||||
char w6c_ww[2048], root[2048];
|
||||
snprintf(w6c_ww, sizeof w6c_ww, "%s/w6c_ww", bin);
|
||||
char root[2048];
|
||||
snprintf(root, sizeof root, "%s/selfhost/cmd/w6c/main.ww", cwd);
|
||||
|
||||
struct { const char *drv, *tag; char prog[2048]; int ok; }
|
||||
@@ -415,29 +360,6 @@ main(void)
|
||||
n++;
|
||||
}
|
||||
|
||||
/* OUTPUT equivalence on every real bootstrap input: each built
|
||||
* sep-w6c vs the combined w6c_ww (the M4 combined-out==sep-out bar;
|
||||
* cs==ww follows since both sep stages match the same reference). */
|
||||
const char *targ[] = {
|
||||
"selfhost/cmd/w6c/main.combined.ww",
|
||||
"selfhost/cmd/wwdump/main.combined.ww",
|
||||
"selfhost/cmd/w6a/main.combined.ww",
|
||||
"selfhost/cmd/w6l/main.combined.ww",
|
||||
"selfhost/cmd/ww/main.combined.ww",
|
||||
NULL,
|
||||
};
|
||||
for (int s = 0; s < 2; s++) {
|
||||
if (!stg[s].ok) continue;
|
||||
for (int i = 0; targ[i]; i++) {
|
||||
char t[2048], label[256];
|
||||
snprintf(t, sizeof t, "%s/%s", cwd, targ[i]);
|
||||
snprintf(label, sizeof label, "sep-%s emit %s",
|
||||
stg[s].tag, targ[i]);
|
||||
if (emit_eq(stg[s].prog, w6c_ww, t, label) != 0) fail++;
|
||||
n++;
|
||||
}
|
||||
}
|
||||
|
||||
/* cs==ww on the real tool's sep .s/.o/.wwi (rule 10). */
|
||||
if (stg[0].ok && stg[1].ok) {
|
||||
char csdir[2176], wwdir[2176];
|
||||
@@ -458,9 +380,8 @@ main(void)
|
||||
fprintf(stderr, "w6c_ww: %d/%d diff(s) failed\n", fail, n);
|
||||
return 1;
|
||||
}
|
||||
printf("w6c_ww: byte-identical to wwdump_ww -c on %d corpus inputs "
|
||||
"(in-source + selfhost combined.ww) + Tier-C: sep-built w6c emits "
|
||||
"== combined w6c_ww on all bootstrap inputs, cs==ww sep .s/.o/.wwi\n",
|
||||
printf("w6c_ww: byte-identical to wwdump_ww -c on %d in-source corpus "
|
||||
"inputs + Tier-C: cs==ww sep .s/.o/.wwi on the real w6c build\n",
|
||||
n);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user