summaryrefslogtreecommitdiffstats
path: root/tests/run.sh
diff options
context:
space:
mode:
authorRuediger Meier2018-03-09 13:04:41 +0100
committerKarel Zak2018-03-19 11:46:11 +0100
commit07b1ea7c44a38d5df504524a5279de06220903b5 (patch)
treedd4f19b757721dd134787ee071d609c0fb2de75e /tests/run.sh
parentcolumn: update column.1 (diff)
downloadkernel-qcow2-util-linux-07b1ea7c44a38d5df504524a5279de06220903b5.tar.gz
kernel-qcow2-util-linux-07b1ea7c44a38d5df504524a5279de06220903b5.tar.xz
kernel-qcow2-util-linux-07b1ea7c44a38d5df504524a5279de06220903b5.zip
tests: handle xargs errors and invalid args
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Diffstat (limited to 'tests/run.sh')
-rwxr-xr-xtests/run.sh14
1 files changed, 12 insertions, 2 deletions
diff --git a/tests/run.sh b/tests/run.sh
index 4c89b8c1e..f40c9f801 100755
--- a/tests/run.sh
+++ b/tests/run.sh
@@ -82,6 +82,10 @@ while [ -n "$1" ]; do
;;
--parallel=*)
paraller_jobs="${1##--parallel=}"
+ if ! [ "$paraller_jobs" -ge 0 2>/dev/null ]; then
+ echo "invalid argument '$paraller_jobs' for --parallel="
+ exit 1
+ fi
;;
--parallel)
paraller_jobs=$(num_cpus)
@@ -184,8 +188,10 @@ printf "%13s: %-30s " "kernel" "$(uname -r)"
echo
echo
-if [ $paraller_jobs -gt 1 ]; then
- echo " Executing the tests in parallel ($paraller_jobs jobs) "
+if [ "$paraller_jobs" -ne 1 ]; then
+ tmp=$paraller_jobs
+ [ "$paraller_jobs" -eq 0 ] && tmp=infinite
+ echo " Executing the tests in parallel ($tmp jobs) "
echo
OPTS="$OPTS --parallel"
fi
@@ -196,6 +202,10 @@ printf "%s\n" ${comps[*]} |
sort |
xargs -I '{}' -P $paraller_jobs -n 1 bash -c "'{}' \"$OPTS\" ||
echo 1 >> $top_builddir/tests/failures"
+if [ $? != 0 ]; then
+ echo "xargs error" >&2
+ exit 1
+fi
declare -a fail_file
fail_file=( $( < $top_builddir/tests/failures ) ) || exit 1
rm -f $top_builddir/tests/failures