Commit caa9392a authored by Marc Hartmayer's avatar Marc Hartmayer Committed by Thomas Huth
Browse files

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's avatarAndrew Jones <drjones@redhat.com>
Reviewed-by: default avatarCornelia Huck <cohuck@redhat.com>
Reviewed-by: default avatarDavid Hildenbrand <david@redhat.com>
Signed-off-by: default avatarMarc Hartmayer <mhartmay@linux.ibm.com>
Message-Id: <20200923134758.19354-2-mhartmay@linux.ibm.com>
Signed-off-by: default avatarThomas Huth <thuth@redhat.com>
parent 4c1c0997
......@@ -136,9 +136,6 @@ RUNTIME_log_stdout () {
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
......
......@@ -17,7 +17,9 @@ function for_each_unittest()
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 @@ function for_each_unittest()
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}<&-
}
......@@ -83,10 +83,6 @@ function mkstandalone()
{
local testname="$1"
if [ -z "$testname" ]; then
return
fi
if [ -n "$one_testname" ] && [ "$testname" != "$one_testname" ]; then
return
fi
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment