Use up to 8 cores when testing to make it faster

Allow changing it explicitly by CORES and MAXCORES variables.
MAXCORES=0 disables upper limit.
This commit is contained in:
Petr Menšík 2025-02-07 14:53:53 +01:00
commit 73d55d35b2

View file

@ -39,7 +39,10 @@
: ${PACKAGE:=bind}
USER="user$RANDOM"
CORES=1
: ${CORES:=auto}
# Limit maximal number of cores used at the same time.
# May cause more failures.
: ${MAXCORES:=8}
: ${WITHOUT:=--without DOC --without EXPORT_LIBS}
rlJournalStart
@ -80,8 +83,10 @@ rlJournalStart
KNOWNERROR=`readlink -f knownerror`
fi
if [ -z "$CORES" ]; then
rlRun "CORES=$(grep '^processor\s*:' /proc/cpuinfo | wc -l)" 0 "Count available CPU cores"
if [ -z "$CORES" ] || [ "$CORES" = "auto" ]; then
rlRun "CORES=$(lscpu -p | grep -v '^\s*#' | wc -l)" 0 "Get available CPU cores"
[[ CORES -lt 1 ]] && CORES=1
[[ MAXCORES -gt 0 ]] && [[ CORES -gt MAXCORES ]] && rlRun "CORES=$MAXCORES" 0 "Limit max used cores"
fi
if [ -n "$QUICK" ]; then