From: Thomas Haller <thaller@redhat.com>
To: NetFilter <netfilter-devel@vger.kernel.org>
Cc: Thomas Haller <thaller@redhat.com>
Subject: [PATCH nft 11/11] tests/shell: set NFT_TEST_JOBS based on $(nproc)
Date: Fri, 8 Sep 2023 00:07:23 +0200 [thread overview]
Message-ID: <20230907220833.2435010-12-thaller@redhat.com> (raw)
In-Reply-To: <20230907220833.2435010-1-thaller@redhat.com>
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>
---
tests/shell/run-tests.sh | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/tests/shell/run-tests.sh b/tests/shell/run-tests.sh
index 35621bac569d..c622c1509500 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
--
2.41.0
prev parent reply other threads:[~2023-09-07 22:10 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-07 22:07 [PATCH nft 00/11] tests/shell: colorize output, fix VALGRIND mode Thomas Haller
2023-09-07 22:07 ` [PATCH nft 01/11] tests/shell: cleanup result handling in "test-wrapper.sh" Thomas Haller
2023-09-07 22:07 ` [PATCH nft 02/11] tests/shell: cleanup print_test_result() and show TAINTED error code Thomas Haller
2023-09-07 22:07 ` [PATCH nft 03/11] tests/shell: colorize terminal output with test result Thomas Haller
2023-09-07 22:07 ` [PATCH nft 04/11] tests/shell: fix handling failures with VALGRIND=y Thomas Haller
2023-09-07 22:07 ` [PATCH nft 05/11] tests/shell: print the NFT setting with the VALGRIND=y wrapper Thomas Haller
2023-09-07 22:07 ` [PATCH nft 06/11] tests/shell: don't redirect error/warning messages to stderr Thomas Haller
2023-09-07 22:07 ` [PATCH nft 07/11] tests/shell: redirect output of test script to file too Thomas Haller
2023-09-07 22:07 ` [PATCH nft 08/11] tests/shell: print "kernel is tainted" separate from test result Thomas Haller
2023-09-07 22:07 ` [PATCH nft 09/11] tests/shell: no longer enable verbose output when selecting a test Thomas Haller
2023-09-07 22:07 ` [PATCH nft 10/11] tests/shell: record wall time of test run in result data Thomas Haller
2023-09-07 22:07 ` Thomas Haller [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230907220833.2435010-12-thaller@redhat.com \
--to=thaller@redhat.com \
--cc=netfilter-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).