common.bash: run `cmd` only if a test case was found
It's only useful to run `cmd` in `for_each_unittest` if a test case
was found. This change allows us to remove the guards from the
functions `run_task` and `mkstandalone`.
Reviewed-by: Andrew Jones <drjones@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Message-Id: <20200923134758.19354-2-mhartmay@linux.ibm.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
diff --git a/run_tests.sh b/run_tests.sh
index d7cad9b..65108e7 100755
--- a/run_tests.sh
+++ b/run_tests.sh
@@ -136,9 +136,6 @@
function run_task()
{
local testname="$1"
- if [ -z "$testname" ]; then
- return
- fi
while (( $(jobs | wc -l) == $unittest_run_queues )); do
# wait for any background test to finish
diff --git a/scripts/common.bash b/scripts/common.bash
index 9a6ebbd..96655c9 100644
--- a/scripts/common.bash
+++ b/scripts/common.bash
@@ -17,7 +17,9 @@
while read -r -u $fd line; do
if [[ "$line" =~ ^\[(.*)\]$ ]]; then
- "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout"
+ if [ -n "${testname}" ]; then
+ "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout"
+ fi
testname=${BASH_REMATCH[1]}
smp=1
kernel=""
@@ -45,6 +47,8 @@
timeout=${BASH_REMATCH[1]}
fi
done
- "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout"
+ if [ -n "${testname}" ]; then
+ "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout"
+ fi
exec {fd}<&-
}
diff --git a/scripts/mkstandalone.sh b/scripts/mkstandalone.sh
index 9d506cc..cefdec3 100755
--- a/scripts/mkstandalone.sh
+++ b/scripts/mkstandalone.sh
@@ -83,10 +83,6 @@
{
local testname="$1"
- if [ -z "$testname" ]; then
- return
- fi
-
if [ -n "$one_testname" ] && [ "$testname" != "$one_testname" ]; then
return
fi