kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Jones <drjones@redhat.com>
To: kvm@vger.kernel.org
Cc: pbonzini@redhat.com, thuth@redhat.com
Subject: [PATCH kvm-unit-tests 2/3] scripts: Save rematch before calling out of for_each_unittest
Date: Wed, 14 Oct 2020 21:14:43 +0200	[thread overview]
Message-ID: <20201014191444.136782-3-drjones@redhat.com> (raw)
In-Reply-To: <20201014191444.136782-1-drjones@redhat.com>

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>
---
 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


  parent reply	other threads:[~2020-10-14 19:14 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-14 19:14 [PATCH kvm-unit-tests 0/3] A few miscellaneous fixes Andrew Jones
2020-10-14 19:14 ` [PATCH kvm-unit-tests 1/3] lib/string: Fix getenv name matching Andrew Jones
2020-10-15  8:19   ` Thomas Huth
2020-10-31 14:31   ` Paolo Bonzini
2020-10-14 19:14 ` Andrew Jones [this message]
2020-10-15  8:22   ` [PATCH kvm-unit-tests 2/3] scripts: Save rematch before calling out of for_each_unittest Thomas Huth
2020-10-14 19:14 ` [PATCH kvm-unit-tests 3/3] arm/arm64: Change dcache_line_size to ulong Andrew Jones
2020-10-15  8:30   ` Thomas Huth
2020-10-31 14:32     ` Paolo Bonzini
2020-11-11 15:06       ` Andrew Jones

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201014191444.136782-3-drjones@redhat.com \
    --to=drjones@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).