test: parallelise Phase-2 byte-id gates — reader group + serial writer tail (#19)

Phase-2 (950/990-997) was blanket-serial only because ww_ww writes build intermediates next to source (#15), so gates race on selfhost/cmd/<tool>/main.* stems. Per-gate FS-footprint audit (ken): the reader group {990,991,992,994,996,997} writes only /tmp or disjoint tracked stems (smoke/mandelbrot) — parallelise race-free via the Phase-1 xargs -P machinery; the source-tree writers {993,995,950} stay a serial tail; combined_ww_fresh last. Verdict set identical (byte-id-neutral — parallelism alters scheduling, not emitted bytes); 2 stable green runs (237 each). make test ~459s -> ~390s.
This commit is contained in:
2026-06-01 14:36:03 +09:00
parent befb042647
commit a6923a2873

View File

@@ -46,12 +46,12 @@ trap 'rm -rf "$RESULTS"' EXIT
JOBS=${JOBS:-$(nproc 2>/dev/null || echo 4)}
# Phase 2 runs the wwstage byte-id gates (990-997) + 950_selfcheck
# sequentially. ww_ww writes intermediates next to every traversed source
# (task #15), so 991/992/994's reads of selfhost/cmd/<tool>/main.{s,o,
# combined.ww} race against any concurrent driver-using test that emits
# a sibling .combined.ww (task #16). Phase 1 stays parallel for unit
# coverage; phase 2 sequential keeps the byte-id gates honest.
# Phase 2 runs the wwstage byte-id gates (990-997) + 950_selfcheck.
# ww_ww writes intermediates next to every traversed source (task #15),
# so 991/992/994's reads of selfhost/cmd/<tool>/main.{s,o,combined.ww}
# race against any concurrent driver-using test that emits a sibling
# .combined.ww (task #16). Phase 1 stays parallel for unit coverage; the
# wwstage-driver tests stay out of phase 1 to keep those reads honest.
for t in test/wcc/*.c; do
[ -f "$t" ] || continue
case ${t##*/} in
@@ -65,9 +65,27 @@ done | xargs -0 -n2 -P "$JOBS" "$0" --one || true
# byte-id gates (990-997) and 950_selfcheck entirely. Pre-push uses
# `make test` for the full suite.
if [ "${UNIT:-0}" != "1" ]; then
for t in test/wcc/950_*.c test/wcc/990_*.c test/wcc/991_*.c \
test/wcc/992_*.c test/wcc/993_*.c test/wcc/994_*.c \
test/wcc/995_*.c test/wcc/996_*.c test/wcc/997_*.c; do
# Phase 2 is partitioned (#3): the pure-reader byte-id gates run in
# parallel; the source-tree writers run in a serial tail afterward.
#
# PARALLEL GROUP — 990/991/992/994/996/997. Each reads only committed
# or make-all-produced files and writes only /tmp or a disjoint tracked
# stem (990→out smoke.*, 996→examples/mandelbrot/*, 997→/tmp fixture
# copy). No group member writes a stem another member reads (per-gate FS
# footprint audited race-free, #3), so they fan out via the same
# xargs -P "$JOBS" machinery as phase 1.
for t in test/wcc/990_*.c test/wcc/991_*.c test/wcc/992_*.c \
test/wcc/994_*.c test/wcc/996_*.c test/wcc/997_*.c; do
[ -f "$t" ] || continue
name=${t##*/}; name=${name%.c}
printf '%s/%s\0%s\0' "$RESULTS" "$name" "$t"
done | xargs -0 -n2 -P "$JOBS" "$0" --one || true
# SERIAL TAIL — 993/995/950, the only source-tree writers. 993 & 995
# both write cmd/wwdump/main.* (995 writes all 5 cmd/*/main.*), so they
# run sequentially w.r.t. each other AND after the parallel group, so
# the group's readers see stable make-all output, never a torn write.
for t in test/wcc/993_*.c test/wcc/995_*.c test/wcc/950_*.c; do
[ -f "$t" ] || continue
name=${t##*/}; name=${name%.c}
"$0" --one "$RESULTS/$name" "$t" || true