[PATCH kvm-unit-tests 2/3] scripts: Save rematch before calling out of for_each_unittest

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 scripts/common.bash | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/scripts/common.bash b/scripts/common.bash
index a6044b7c6c35..7b983f7d6dd6 100644
--- a/scripts/common.bash
+++ b/scripts/common.bash
@@ -13,15 +13,17 @@ function for_each_unittest()
 	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=""
-- 
2.26.2




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux