From a6923a2873a870146923b6f71ffe4905f0b0d3e6 Mon Sep 17 00:00:00 2001 From: Hojun-Cho Date: Mon, 1 Jun 2026 14:36:03 +0900 Subject: [PATCH] =?UTF-8?q?test:=20parallelise=20Phase-2=20byte-id=20gates?= =?UTF-8?q?=20=E2=80=94=20reader=20group=20+=20serial=20writer=20tail=20(#?= =?UTF-8?q?19)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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//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. --- test/run | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/test/run b/test/run index 3dd97a73..186d79b0 100755 --- a/test/run +++ b/test/run @@ -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//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//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