scripts: Save rematch before calling out of for_each_unittest
If we don't save BASH_REMATCH before calling another function,
and that other function also uses [[...]], then we'll lose the
test.
Signed-off-by: Andrew Jones <drjones@redhat.com>
Message-Id: <20201014191444.136782-3-drjones@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
diff --git a/scripts/common.bash b/scripts/common.bash
index a6044b7..7b983f7 100644
--- a/scripts/common.bash
+++ b/scripts/common.bash
@@ -13,15 +13,17 @@
local check
local accel
local timeout
+ local rematch
exec {fd}<"$unittests"
while read -r -u $fd line; do
if [[ "$line" =~ ^\[(.*)\]$ ]]; then
+ rematch=${BASH_REMATCH[1]}
if [ -n "${testname}" ]; then
$(arch_cmd) "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout"
fi
- testname=${BASH_REMATCH[1]}
+ testname=$rematch
smp=1
kernel=""
opts=""