]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
fmf: Use different heuristic for number of process with many CPUs
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 8 Jan 2025 21:20:42 +0000 (22:20 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 9 Jan 2025 08:15:18 +0000 (09:15 +0100)
Downstream we sometimes end up with machines with lots of CPUs which
leads to running out of memory when trying to run the tests in VMs.
So let's switch to a different heuristic when we have lots of CPUs to
avoid running out of memory.

test/fmf/integration-tests/test.sh

index 4545090c3c1ab1edad4d3ba85ab7b73f206698f6..effe4b2d6f5ccdf15e3e56c4bd88de126d244261 100755 (executable)
@@ -100,6 +100,13 @@ if [[ ! -e /dev/kvm ]]; then
     export TEST_NO_QEMU=1
 fi
 
+NPROC=$(nproc)
+if [[ $NPROC -ge 10 ]]; then
+    NPROC=$((NPROC / 2))
+else
+    NPROC=$((NPROC - 1))
+fi
+
 # Create missing mountpoint for mkosi sandbox.
 mkdir -p /etc/pacman.d/gnupg
 
@@ -115,6 +122,6 @@ mkosi -f sandbox \
     --suite integration-tests \
     --print-errorlogs \
     --no-stdsplit \
-    --num-processes "$(($(nproc) - 1))"
+    --num-processes "$NPROC"
 
 popd