ww: clean per-pid sep-build scratch dir on run/test (#59)

ww run / ww test created /tmp/ww_{run,test}_<pid>.sepwork/ but removed only
the built binary, leaking the scratch DIR every invocation — the tmpfs filler
(98,811 entries blocked the gate twice). Add a keepscratch param to
build_one_sep: a thin wrapper rm -rfs the impl scratch at the single
choke-point when keepscratch==0 AND the path ends ".sepwork" (covers every
return, success+error; fires post-link, pre-run). do_build keeps it (the
byte-id gates read <stem>.sepwork from ww build -o); do_run/do_test clean;
do_test no-o redirects scratch into /tmp. Both stages symmetric; reuses the
existing shell rm -rf idiom (lib/os.removeall = #109). Test 989_sepscratch_run
is self-scoped by child pid (non-flaky) with a KEEP control + revert-verified
non-vacuity. Full gate: 448 pass, zero new run/test leaks. (ww_d_* relic +
historical bulk = one-time sweep + agent-probe discipline, not code.)
This commit is contained in:
2026-06-19 00:58:57 +09:00
parent 5adacd2eee
commit 3bb381ef48
4 changed files with 262 additions and 14 deletions

View File

@@ -564,6 +564,7 @@ TESTS = $(BIN)/test_smoke $(BIN)/test_lex $(BIN)/test_parse $(BIN)/test_check \
$(BIN)/test_m3sep_run \
$(BIN)/test_barefn_collide_run \
$(BIN)/test_sepbuild_run \
$(BIN)/test_sepscratch_run \
$(BIN)/test_sepdotpath_run \
$(BIN)/test_seproot_export_run \
$(BIN)/test_syntaxexport_run \
@@ -3172,6 +3173,16 @@ $(BIN)/test_sepbuild_run: test/wcc/989_sepbuild_run.c $(BIN)/ww $(BIN)/ww_ww \
$(BIN)/w6l $(BIN)/w6l_ww $(LIB)/libwwrt.a | $(BIN)
$(CC) $(CFLAGS) -o $@ $<
# 989_sepscratch_run (#59) — the driver must rm its per-build `.sepwork`
# scratch on `run`/`test` (keepscratch 0) and KEEP it on `build -o`
# (keepscratch 1, the byte-id gates read it). Drives BOTH driver stages on
# a trivial root, so it needs both driver + both compiler + both linker
# stages + libwwrt (a `run` end-to-end build).
$(BIN)/test_sepscratch_run: test/wcc/989_sepscratch_run.c $(BIN)/ww $(BIN)/ww_ww \
$(BIN)/w6c $(BIN)/w6c_ww $(BIN)/w6a $(BIN)/w6a_ww \
$(BIN)/w6l $(BIN)/w6l_ww $(LIB)/libwwrt.a | $(BIN)
$(CC) $(CFLAGS) -o $@ $<
# 989_barefn_collide_run — #84 cgen bare-module fn-leaf collision gate. A
# package-less root's bare `fn run` must stay BARE (distinct from an
# imported `aa.run`), not mis-mangle onto the import (a #263-class silent