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:
@@ -144,8 +144,13 @@ run_build(const char *driver, const struct row *r, int i)
|
||||
snprintf(dir, sizeof dir, "/tmp/m1usehint_%d_%d", getpid(), i);
|
||||
if (layout(dir, r) != 0) return -2;
|
||||
|
||||
snprintf(cmd, sizeof cmd, "cd '%s' && %s build main.ww 2>/dev/null",
|
||||
dir, driver);
|
||||
/* #93 sep layout: `--sep -o main` emits per-unit asm under
|
||||
* main.sepwork/ (each dir-pkg in its own <pkgpath>.s); binary stays
|
||||
* <dir>/main. WW_PKGCACHE pinned under <dir>; the whole tree is
|
||||
* rm -rf'd below, so the scratch dies with it. */
|
||||
snprintf(cmd, sizeof cmd,
|
||||
"cd '%s' && WW_PKGCACHE='%s/pkgc' %s build --sep -o main "
|
||||
"main.ww 2>/dev/null", dir, dir, driver);
|
||||
int brc = runwait(cmd);
|
||||
|
||||
int got = -1;
|
||||
@@ -165,18 +170,29 @@ static int
|
||||
byteid(const char *cdrv, const char *wdrv, const struct row *r)
|
||||
{
|
||||
char dir[64], cmd[2048];
|
||||
char cs[96], ws[96];
|
||||
char cstem[80], wstem[80], cs[96], ws[96];
|
||||
snprintf(dir, sizeof dir, "/tmp/m1usehint_bid_%d", getpid());
|
||||
if (layout(dir, r) != 0) return -1;
|
||||
snprintf(cs, sizeof cs, "/tmp/m1usehint_c_%d.s", getpid());
|
||||
snprintf(ws, sizeof ws, "/tmp/m1usehint_w_%d.s", getpid());
|
||||
snprintf(cstem, sizeof cstem, "/tmp/m1usehint_c_%d", getpid());
|
||||
snprintf(wstem, sizeof wstem, "/tmp/m1usehint_w_%d", getpid());
|
||||
snprintf(cs, sizeof cs, "%s.s", cstem);
|
||||
snprintf(ws, sizeof ws, "%s.s", wstem);
|
||||
|
||||
/* #93 sep layout: each stage emits per-unit asm under <stem>.sepwork/
|
||||
* (a.math.s, b.math.s, one.s, two.s, __root.s). The rule-10 byte-id
|
||||
* gate concats each tree's per-unit *.s (sorted glob order is
|
||||
* deterministic) into a flat <stem>.s and cmps the two. WW_PKGCACHE
|
||||
* is pinned per-stem so the shared out/.pkgcache stays untouched. */
|
||||
int rc = -1;
|
||||
snprintf(cmd, sizeof cmd, "cd '%s' && %s build -o '/tmp/m1usehint_c_%d' "
|
||||
"main.ww 2>/dev/null", dir, cdrv, getpid());
|
||||
snprintf(cmd, sizeof cmd,
|
||||
"cd '%s' && WW_PKGCACHE='%s.pkgc' %s build --sep -o '%s' "
|
||||
"main.ww 2>/dev/null && cat '%s.sepwork/'*.s > '%s'",
|
||||
dir, cstem, cdrv, cstem, cstem, cs);
|
||||
int cb = runwait(cmd);
|
||||
snprintf(cmd, sizeof cmd, "cd '%s' && %s build -o '/tmp/m1usehint_w_%d' "
|
||||
"main.ww 2>/dev/null", dir, wdrv, getpid());
|
||||
snprintf(cmd, sizeof cmd,
|
||||
"cd '%s' && WW_PKGCACHE='%s.pkgc' %s build --sep -o '%s' "
|
||||
"main.ww 2>/dev/null && cat '%s.sepwork/'*.s > '%s'",
|
||||
dir, wstem, wdrv, wstem, wstem, ws);
|
||||
int wb = runwait(cmd);
|
||||
if (cb == 0 && wb == 0) {
|
||||
snprintf(cmd, sizeof cmd, "cmp -s '%s' '%s'", cs, ws);
|
||||
@@ -185,8 +201,7 @@ byteid(const char *cdrv, const char *wdrv, const struct row *r)
|
||||
fprintf(stderr, "m1usehint_run: byte-id build failed "
|
||||
"(cstage=%d wwstage=%d)\n", cb, wb);
|
||||
}
|
||||
snprintf(cmd, sizeof cmd, "rm -rf '%s' '/tmp/m1usehint_c_%d'* "
|
||||
"'/tmp/m1usehint_w_%d'*", dir, getpid(), getpid());
|
||||
snprintf(cmd, sizeof cmd, "rm -rf '%s' '%s'* '%s'*", dir, cstem, wstem);
|
||||
runwait(cmd);
|
||||
return rc;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user