summaryrefslogtreecommitdiffstats
path: root/tests/shell/run-tests.sh
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2023-09-08 00:07:23 +0200
committerFlorian Westphal <fw@strlen.de>2023-09-08 11:50:41 +0200
commit6560e2fe6bbb6c60bb1e964b7ba881f98f3c2373 (patch)
tree40aaa716d6313a9452fe4be0c75ecbdff1095350 /tests/shell/run-tests.sh
parentd5df3b9e148af22d715173bc0cc1c02537c73b90 (diff)
tests/shell: set NFT_TEST_JOBS based on $(nproc)
Choose 150% of $(nproc) for the default vlaue of NFT_TEST_JOBS (rounded up). The minimal value chosen by default is 2. Signed-off-by: Thomas Haller <thaller@redhat.com> Signed-off-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'tests/shell/run-tests.sh')
-rwxr-xr-xtests/shell/run-tests.sh10
1 files changed, 7 insertions, 3 deletions
diff --git a/tests/shell/run-tests.sh b/tests/shell/run-tests.sh
index 35621bac..c622c150 100755
--- a/tests/shell/run-tests.sh
+++ b/tests/shell/run-tests.sh
@@ -154,7 +154,7 @@ usage() {
echo " mount namespace."
echo " This is only honored when \$NFT_TEST_UNSHARE_CMD= is set. Otherwise it's detected."
echo " NFT_TEST_KEEP_LOGS=*|y: Keep the temp directory. On success, it will be deleted by default."
- echo " NFT_TEST_JOBS=<NUM}>: number of jobs for parallel execution. Defaults to \"12\" for parallel run."
+ echo " NFT_TEST_JOBS=<NUM}>: number of jobs for parallel execution. Defaults to \"\$(nproc)*1.5\" for parallel run."
echo " Setting this to \"0\" or \"1\", means to run jobs sequentially."
echo " Setting this to \"0\" means also to perform global cleanups between tests (remove"
echo " kernel modules)."
@@ -167,13 +167,17 @@ NFT_TEST_BASEDIR="$(dirname "$0")"
# Export the base directory. It may be used by tests.
export NFT_TEST_BASEDIR
+_NFT_TEST_JOBS_DEFAULT="$(nproc)"
+[ "$_NFT_TEST_JOBS_DEFAULT" -gt 0 ] 2>/dev/null || _NFT_TEST_JOBS_DEFAULT=1
+_NFT_TEST_JOBS_DEFAULT="$(( _NFT_TEST_JOBS_DEFAULT + (_NFT_TEST_JOBS_DEFAULT + 1) / 2 ))"
+
VERBOSE="$(bool_y "$VERBOSE")"
DUMPGEN="$(bool_y "$DUMPGEN")"
VALGRIND="$(bool_y "$VALGRIND")"
KMEMLEAK="$(bool_y "$KMEMLEAK")"
NFT_TEST_KEEP_LOGS="$(bool_y "$NFT_TEST_KEEP_LOGS")"
NFT_TEST_HAS_REALROOT="$NFT_TEST_HAS_REALROOT"
-NFT_TEST_JOBS="${NFT_TEST_JOBS:-12}"
+NFT_TEST_JOBS="${NFT_TEST_JOBS:-$_NFT_TEST_JOBS_DEFAULT}"
DO_LIST_TESTS=
TESTS=()
@@ -345,7 +349,7 @@ export NFT_TEST_HAS_UNSHARED_MOUNT
# normalize the jobs number to be an integer.
case "$NFT_TEST_JOBS" in
- ''|*[!0-9]*) NFT_TEST_JOBS=12 ;;
+ ''|*[!0-9]*) NFT_TEST_JOBS=_NFT_TEST_JOBS_DEFAULT ;;
esac
if [ -z "$NFT_TEST_UNSHARE_CMD" -a "$NFT_TEST_JOBS" -gt 1 ] ; then
NFT_TEST_JOBS=1