summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Moore <paul@paul-moore.com>2021-01-07 21:22:18 -0500
committerPaul Moore <paul@paul-moore.com>2021-01-14 09:54:41 -0500
commit4c19425fa69cfb4f7de5225d676a26ef0b442e28 (patch)
tree0f153d3df672d3c5e04ab8d538b8a1c85cfadc6a
parent5878cf2383ccedca3536f47155b13145809ae08e (diff)
downloadlibseccomp-master.tar.gz
tests: add support for the LIBSECCOMP_TSTCFG_JOBS env variablemaster
The LIBSECCOMP_TSTCFG_JOBS environment variable allows the caller to specify the number of test jobs through the environment as opposed to the command line. This is primarily useful for running the tests through scripts or via the 'make check' command. The LIBSECCOMP_TSTCFG_JOBS environment variable value behaves the same as the '-j <JOBS>' command line argument. Reviewed-by: Tom Hromatka <tom.hromatka@oracle.com> Signed-off-by: Paul Moore <paul@paul-moore.com>
-rwxr-xr-xtests/regression13
1 files changed, 8 insertions, 5 deletions
diff --git a/tests/regression b/tests/regression
index 4f3f2ac..25043af 100755
--- a/tests/regression
+++ b/tests/regression
@@ -96,6 +96,7 @@ libseccomp regression test automation script
optional arguments:
-h show this help message and exit
-j JOBS run up to JOBS test jobs in parallel
+ can also be set via LIBSECCOMP_TSTCFG_JOBS env variable
-m MODE specified the test mode [c (default), python]
can also be set via LIBSECCOMP_TSTCFG_MODE_LIST env variable
-a specifies all tests are to be run
@@ -1075,11 +1076,7 @@ while getopts "ab:gj:l:m:s:t:T:vh" opt; do
batch_count=$(($batch_count+1))
;;
j)
- if [[ $OPTARG -lt 1 ]]; then
- jobs=$(cat /proc/cpuinfo | grep "^processor" | wc -l)
- else
- jobs=$OPTARG
- fi
+ jobs=$OPTARG
;;
l)
logfile="$OPTARG"
@@ -1121,6 +1118,12 @@ done
# use mode list from environment if provided
[[ -z $mode_list && -n $LIBSECCOMP_TSTCFG_MODE_LIST ]] && mode_list=$LIBSECCOMP_TSTCFG_MODE_LIST
+# use job count from environment if provided and do some sanity checking
+[[ -n $LIBSECCOMP_TSTCFG_JOBS ]] && jobs=$LIBSECCOMP_TSTCFG_JOBS
+if [[ $jobs -lt 1 ]]; then
+ jobs=$(cat /proc/cpuinfo | grep "^processor" | wc -l)
+fi
+
# determine the mode test automatically
if [[ -z $mode_list ]]; then
# always perform the native c tests