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:
@@ -0,0 +1,46 @@
|
||||
# Shared parallelism default for the test gates (sourced by tools/test.sh and client/e2e/run.sh).
|
||||
#
|
||||
# FFF_TEST_JOBS overrides it (FFF_TEST_JOBS=1 serialises). The default is half the cores, capped at
|
||||
# 8: the host froze under an uncapped, memory-heavy load before, so the gate never saturates it.
|
||||
# The client e2e runs whole browsers (SwiftShader is CPU-hungry per worker), so it caps its workers
|
||||
# lower unless FFF_E2E_JOBS names one explicitly.
|
||||
fff_half_cores() {
|
||||
local n=$(( $(nproc) / 2 ))
|
||||
[ "$n" -ge 1 ] || n=1
|
||||
echo "$n"
|
||||
}
|
||||
|
||||
fff_test_jobs() {
|
||||
local n=${FFF_TEST_JOBS:-}
|
||||
if [ -z "$n" ]; then
|
||||
n=$(fff_half_cores)
|
||||
[ "$n" -le 8 ] || n=8
|
||||
fi
|
||||
echo "$n"
|
||||
}
|
||||
|
||||
fff_e2e_jobs() {
|
||||
local n=${FFF_E2E_JOBS:-}
|
||||
if [ -z "$n" ]; then
|
||||
n=$(fff_test_jobs)
|
||||
[ "$n" -le 4 ] || n=4
|
||||
fi
|
||||
echo "$n"
|
||||
}
|
||||
|
||||
# Test state dirs live on tmpfs when the host has it. Every harness state dir carries a SQLite WAL
|
||||
# with synchronous=FULL commits (authoring) plus transcripts and tile fixtures; on a disk-backed
|
||||
# /tmp, eight suites fanning out at once can stall a first commit long enough for a harness ack to
|
||||
# look lost. /dev/shm keeps the same SQLite/restart semantics (a SIGKILL restart still reads the
|
||||
# same files) without the fsync storm. An explicit TMPDIR is respected; the directory is removed
|
||||
# on exit. FFF_TEST_TMPDIR=dir picks another base.
|
||||
fff_setup_tmpdir() {
|
||||
if [ -n "${FFF_TEST_NO_TMPFS:-}" ] || { [ -n "${TMPDIR:-}" ] && [ "${TMPDIR}" != "/tmp" ]; }; then
|
||||
return 0
|
||||
fi
|
||||
local base=${FFF_TEST_TMPDIR:-/dev/shm}
|
||||
[ -d "$base" ] && [ -w "$base" ] || return 0
|
||||
TMPDIR=$(mktemp -d "$base/fffvtt-run.XXXXXX") || return 0
|
||||
export TMPDIR
|
||||
trap 'rm -rf "$TMPDIR"' EXIT
|
||||
}
|
||||
Reference in New Issue
Block a user