test: retarget Pattern-B gates to sep .sepwork layout; 915 off private global (M4 E3, #93)
The driver flip moves build artifacts from next-to-source <stem>.s to a .sepwork/ scratch dir. 29 Pattern-B gates now build `ww build --sep -o <stem>` and read <stem>.sepwork/__root.s (multi-package gates concat all <stem>.sepwork/*.s, since cross-package labels live in per-package .s). All intermediates redirect to /tmp (WW_PKGCACHE + -o), so the corpus runs parallel-safe with no source-tree pollution. Tests pass now (--sep is live) and survive the flip. 915 additionally retargeted off strconv's PRIVATE left_shift_table (a let, not export) — which separate compilation correctly hides — onto a test-local package that exports its own probe table (#96). The combined path only linked it via a single-unit private leak; encapsulation is now honored under sep. Test-only; all 5 *_ww binaries HOLD. 989_m1mangle_run deferred (blocked by #99, imported-package fn main mangling under sep).
This commit is contained in:
@@ -111,13 +111,17 @@ write_src(const char *path, const struct row *r)
|
||||
}
|
||||
|
||||
/* build_run — build `src` to `<stem>` binary via `driver`, run it; return
|
||||
* the binary's exit code, or -1 on a build failure. */
|
||||
* the binary's exit code, or -1 on a build failure.
|
||||
* #93 sep layout: `--sep -o <stem>` emits per-unit asm under
|
||||
* <stem>.sepwork/ (root in __root.s, encoding.utf8 in encoding.utf8.s); the
|
||||
* binary is still <stem>. WW_PKGCACHE is pinned beside <stem>. */
|
||||
static int
|
||||
build_run(const char *driver, const char *src, const char *stem)
|
||||
{
|
||||
char cmd[1024];
|
||||
snprintf(cmd, sizeof cmd, "%s build -o '%s' '%s' 2>/dev/null",
|
||||
driver, stem, src);
|
||||
snprintf(cmd, sizeof cmd,
|
||||
"WW_PKGCACHE='%s.pkgc' timeout 180 %s build --sep -o '%s' '%s' "
|
||||
"2>/dev/null", stem, driver, stem, src);
|
||||
if (runwait(cmd) != 0) return -1;
|
||||
return runwait(stem);
|
||||
}
|
||||
@@ -172,9 +176,9 @@ main(void)
|
||||
fail++;
|
||||
}
|
||||
char cmd[256];
|
||||
snprintf(cmd, sizeof cmd, "rm -f '%s' '%s' '%s.s' "
|
||||
"'%s.o' '%s.combined.ww'", src, stem, stem, stem,
|
||||
stem);
|
||||
/* #93: drop the sep scratch + pinned pkgcache too. */
|
||||
snprintf(cmd, sizeof cmd, "rm -rf '%s' '%s' "
|
||||
"'%s.sepwork' '%s.pkgc'", src, stem, stem, stem);
|
||||
runwait(cmd);
|
||||
}
|
||||
}
|
||||
@@ -183,27 +187,38 @@ main(void)
|
||||
if (access(wdrv, X_OK) == 0) {
|
||||
total++;
|
||||
const struct row *r = &rows[n - 1]; /* all_arms */
|
||||
char csrc[80], cstem[80], cs[96], ws[96], cmd[512];
|
||||
char csrc[80], cstem[80], cmd[512];
|
||||
snprintf(csrc, sizeof csrc, "/tmp/m1union_bid_%d.ww", pid);
|
||||
snprintf(cstem, sizeof cstem, "/tmp/m1union_bid_c_%d", pid);
|
||||
snprintf(cs, sizeof cs, "%s.s", cstem);
|
||||
char wstem[80];
|
||||
snprintf(wstem, sizeof wstem, "/tmp/m1union_bid_w_%d", pid);
|
||||
snprintf(ws, sizeof ws, "%s.s", wstem);
|
||||
if (write_src(csrc, r) == 0) {
|
||||
snprintf(cmd, sizeof cmd, "%s build -o '%s' '%s' "
|
||||
"2>/dev/null", cdrv, cstem, csrc);
|
||||
/* #93 sep layout: each stage emits per-unit asm under
|
||||
* <stem>.sepwork/ (__root.s + encoding.utf8.s); the
|
||||
* rule-10 byte-id gate becomes a recursive diff of the
|
||||
* two sepwork trees. */
|
||||
snprintf(cmd, sizeof cmd,
|
||||
"WW_PKGCACHE='%s.pkgc' %s build --sep -o '%s' '%s' "
|
||||
"2>/dev/null", cstem, cdrv, cstem, csrc);
|
||||
int cb = runwait(cmd);
|
||||
snprintf(cmd, sizeof cmd, "%s build -o '%s' '%s' "
|
||||
"2>/dev/null", wdrv, wstem, csrc);
|
||||
snprintf(cmd, sizeof cmd,
|
||||
"WW_PKGCACHE='%s.pkgc' %s build --sep -o '%s' '%s' "
|
||||
"2>/dev/null", wstem, wdrv, wstem, csrc);
|
||||
int wb = runwait(cmd);
|
||||
if (cb != 0 || wb != 0) {
|
||||
fprintf(stderr, "m1union_run: byte-id build "
|
||||
"failed (cstage=%d wwstage=%d)\n", cb, wb);
|
||||
fail++;
|
||||
} else {
|
||||
snprintf(cmd, sizeof cmd, "cmp -s '%s' '%s'",
|
||||
cs, ws);
|
||||
/* Concat each tree's per-unit *.s (sorted glob
|
||||
* order is deterministic) and cmp — sidesteps a
|
||||
* stray <pkg>.md5tmp the wwstage drops in the
|
||||
* sep dir, which a full `diff -r` would flag. */
|
||||
snprintf(cmd, sizeof cmd,
|
||||
"cat '%s.sepwork/'*.s > '%s.scat' && "
|
||||
"cat '%s.sepwork/'*.s > '%s.scat' && "
|
||||
"cmp -s '%s.scat' '%s.scat'",
|
||||
cstem, cstem, wstem, wstem, cstem, wstem);
|
||||
if (runwait(cmd) != 0) {
|
||||
fprintf(stderr, "m1union_run: cstage.s "
|
||||
"!= wwstage.s (byte-id break)\n");
|
||||
@@ -211,7 +226,7 @@ main(void)
|
||||
}
|
||||
}
|
||||
}
|
||||
snprintf(cmd, sizeof cmd, "rm -f '%s' '%s'* '%s'*", csrc,
|
||||
snprintf(cmd, sizeof cmd, "rm -rf '%s' '%s'* '%s'*", csrc,
|
||||
cstem, wstem);
|
||||
runwait(cmd);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user