test: split fast/full, parallelize 995, race-correct two-phase test/run
test/run fans out test/wcc/*.c except 950 and 990-997 across $(nproc) xargs workers, then runs the byte-id gates sequentially in phase 2. Each worker writes <prefix>.status into a mktemp results dir; the collector emits them in glob order for deterministic output. Phase 2 sequentiality sidesteps the race introduced by ww_ww writing intermediates next to every traversed source (#15) — concurrent reads of selfhost/cmd/<tool>/main.{combined.ww,s,o} would see partial bytes (#16). `make test-unit` (UNIT=1) skips phase 2 entirely for a 3.8s inner-loop check; `make test` runs the full 132 in ~8:30. test-unit goal aligns with the selfhost-bootstrap project goal: 990-997 + 950 are the toolchain-rebuild gates, fast feedback is for unit work below them. 990-995 wrap every ww/w6c/w6a/w6l/wwdump invocation in `timeout 180`; 995's hardcoded /tmp/ww_d_hello.ww is now pid-keyed. 995 forks its 5 ww_ww builds concurrently (waitpid for collection) so its solo wall drops from 3:15 to 1:32. Phase-2 split (parallel readers + sequential writers) deferred to #17, post #15. Wall: 9:59 → 8:32 (full) / 3.8s (test-unit, ~158× from baseline).
This commit is contained in:
25
test/run
25
test/run
@@ -46,15 +46,34 @@ trap 'rm -rf "$RESULTS"' EXIT
|
||||
|
||||
JOBS=${JOBS:-$(nproc 2>/dev/null || echo 4)}
|
||||
|
||||
# Emit (prefix, testpath) pairs NUL-separated. The prefix carries the
|
||||
# test's <NNN>_<name> stem so the collector iterates in lexical order,
|
||||
# yielding deterministic output even though workers interleave.
|
||||
# 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.
|
||||
for t in test/wcc/*.c; do
|
||||
[ -f "$t" ] || continue
|
||||
case ${t##*/} in
|
||||
950_*|990_*|991_*|992_*|993_*|994_*|995_*|996_*|997_*) continue ;;
|
||||
esac
|
||||
name=${t##*/}; name=${name%.c}
|
||||
printf '%s/%s\0%s\0' "$RESULTS" "$name" "$t"
|
||||
done | xargs -0 -n2 -P "$JOBS" "$0" --one || true
|
||||
|
||||
# UNIT=1 (make test-unit) is the inner-loop short path: skip the wwstage
|
||||
# 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
|
||||
[ -f "$t" ] || continue
|
||||
name=${t##*/}; name=${name%.c}
|
||||
"$0" --one "$RESULTS/$name" "$t" || true
|
||||
done
|
||||
fi
|
||||
|
||||
fail=0
|
||||
ran=0
|
||||
for s in "$RESULTS"/*.status; do
|
||||
|
||||
Reference in New Issue
Block a user