From cfcd8902aa27803d82271cd58a2c23cd46710d2d Mon Sep 17 00:00:00 2001 From: Kevin Burke Date: Mon, 17 Aug 2026 10:27:17 -0700 Subject: [PATCH] gnu tests: limit make jobs to nproc output run-gnu-test.sh put the nproc executable path after a bare -j. GNU make treated -j as unlimited parallelism and the path as another target, oversubscribing the test runner. Resolve and execute nproc, fall back to two jobs if it is unavailable, reject invalid output, and attach the resulting count to -j. --- util/run-gnu-test.sh | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/util/run-gnu-test.sh b/util/run-gnu-test.sh index 013119527b0..5944b6ed7c6 100755 --- a/util/run-gnu-test.sh +++ b/util/run-gnu-test.sh @@ -28,12 +28,20 @@ echo "path_UUTILS='${path_UUTILS}'" echo "path_GNU='${path_GNU}'" # Use GNU nproc for *BSD -NPROC_BIN=$(command -v "${path_GNU}"/src/nproc||command -v nproc) -# `-j` wants a job count: handing it the path to nproc made make read it as a -# (bogus) goal and run with unlimited parallelism, which starves the CI runner. -NPROC=$("${NPROC_BIN}" 2>/dev/null) || NPROC=1 -MAKEFLAGS="${MAKEFLAGS} -j ${NPROC}" +if NPROC_COMMAND=$(command -v "${path_GNU}/src/nproc" || command -v nproc); then + JOBS=$("${NPROC_COMMAND}") +else + JOBS=2 +fi +case "${JOBS}" in + '' | 0* | *[!0-9]*) + echo "Error: invalid make job count: '${JOBS}'" >&2 + exit 1 + ;; +esac +MAKEFLAGS="${MAKEFLAGS:+${MAKEFLAGS} }-j${JOBS}" export MAKEFLAGS +echo "GNU test make job count: ${JOBS}" ### cd "${path_GNU}" && echo "[ pwd:'${PWD}' ]"