test: fan out the gates and build shared binaries once
Every Nim test file and every Node test file is already isolated (own temp state dir, free ports, own server/nginx), so run them FFF_TEST_JOBS at a time (default half the cores, capped at 8) instead of one at a time. The real server (clean, leakfault, dispfault) and the leak checker are built once per source+flags and shared across the parallel files; nimcaches are worktree-local so two checkouts cannot race on them. The 22 independent fault cases are sharded across processes. The wall-clock gate files (persistence, tiles; e2e map/fog/fogbench/ perf) still run alone first so their budgets are not measured under the suite's own load. No test or assertion changes.
This commit is contained in:
+28
-4
@@ -3,9 +3,18 @@
|
||||
# browser suite against the real server through the TLS/HTTP2 test nginx. Separate from
|
||||
# `devbox run test` so the fast server gate stays fast (TESTING 11.1); the client's own unit tests
|
||||
# are `devbox run client-test`.
|
||||
#
|
||||
# Parallelism: every test gets its own stack (state dir, free ports, nginx, server) and its own
|
||||
# browser, so test files run FFF_E2E_JOBS at a time (default: half the cores, capped at 4;
|
||||
# FFF_TEST_JOBS/FFF_E2E_JOBS=1 serialises). The files whose assertions are timing gates (the
|
||||
# tile-fill budget, the fog costs, the perf overlay) run alone first, unloaded, then the rest fan
|
||||
# out. The client dist and the server binaries are built once, before any worker starts.
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")/../.." || exit 1
|
||||
mkdir -p results
|
||||
. tools/jobs.sh
|
||||
mkdir -p results run/logs
|
||||
fff_setup_tmpdir
|
||||
JOBS=$(fff_e2e_jobs)
|
||||
export CHROMIUM="${CHROMIUM:-$(command -v chromium || true)}"
|
||||
if [ -z "$CHROMIUM" ]; then
|
||||
echo "e2e: chromium not found; it is a root devbox package (devbox.json) - run inside devbox" >&2
|
||||
@@ -14,7 +23,22 @@ fi
|
||||
# npm deps stay out of tools/ (TESTING 10.4) and out of git; install once per checkout.
|
||||
( cd client && { [ -d node_modules ] || npm ci --no-audit --no-fund; } )
|
||||
( cd client && npm run build )
|
||||
node --test --test-concurrency=1 --test-reporter=spec client/e2e/*.test.mjs > results/e2e.log 2>&1
|
||||
rc=$?
|
||||
# Shared Nim build cache: the server binaries the stacks launch (and the leak checker) are built
|
||||
# once here, not once per test file.
|
||||
node tools/prebuild.mjs server-only > run/logs/prebuild-e2e.log 2>&1
|
||||
E2E_SERIAL=(client/e2e/map.test.mjs client/e2e/fog.test.mjs client/e2e/fogbench.test.mjs
|
||||
client/e2e/perf.test.mjs)
|
||||
E2E_PARALLEL=()
|
||||
for f in client/e2e/*.test.mjs; do
|
||||
case " ${E2E_SERIAL[*]} " in
|
||||
*" $f "*) ;;
|
||||
*) E2E_PARALLEL+=("$f") ;;
|
||||
esac
|
||||
done
|
||||
node --test --test-concurrency=1 --test-reporter=spec "${E2E_SERIAL[@]}" \
|
||||
> run/logs/e2e-serial.log 2>&1 || rc=$?
|
||||
node --test --test-concurrency="$JOBS" --test-reporter=spec "${E2E_PARALLEL[@]}" \
|
||||
> run/logs/e2e-parallel.log 2>&1 || rc=$?
|
||||
cat run/logs/e2e-serial.log run/logs/e2e-parallel.log > results/e2e.log
|
||||
cat results/e2e.log
|
||||
exit $rc
|
||||
[ "${rc:-0}" -eq 0 ] || exit "$rc"
|
||||
|
||||
Reference in New Issue
Block a user