All of lore.kernel.org
 help / color / mirror / Atom feed
From: Amir Goldstein <amir73il@gmail.com>
To: Zorro Lang <zlang@redhat.com>
Cc: Yuezhang Mo <Yuezhang.Mo@foxmail.com>,
	Luis Chamberlain <mcgrof@kernel.org>,
	fstests@vger.kernel.org
Subject: [PATCH v2] check: fix parsing expunge file with comments
Date: Mon, 14 Aug 2023 20:31:32 +0300	[thread overview]
Message-ID: <20230814173132.767345-1-amir73il@gmail.com> (raw)

commit 60054d51 ("check: fix excluded tests are only expunged in the
first iteration") change to use exclude_tests array instead of file.

The check if a test is in expunge file was using grep -q $TEST_ID FILE
so it was checking if the test was a non-exact match to one of the
lines, for a common example: "generic/001 # exclude this test" would be
a match to test generic/001.

The commit regressed this example, because the new code checks for exact
match of [ "generic/001" == "generic/001 " ]. Change the code to match a
regular expression to deal with this case and any other suffix correctly.

NOTE that the original code would have matched test generic/100 with lines
like "generic/1000" when we get to 4 digit seqnum, so the regular
expression does an exact match to the first word of the line.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
---

Changes since v1:
- Use regex for whole word match

 check | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/check b/check
index 549725eb..71b9fbd0 100755
--- a/check
+++ b/check
@@ -592,7 +592,9 @@ _expunge_test()
 	local TEST_ID="$1"
 
 	for f in "${exclude_tests[@]}"; do
-		if [ "${TEST_ID}" == "$f" ]; then
+		# $f may contain traling spaces and comments
+		local id_regex="^${TEST_ID}\b"
+		if [[ "$f" =~ ${id_regex} ]]; then
 			echo "       [expunged]"
 			return 0
 		fi
-- 
2.34.1


             reply	other threads:[~2023-08-14 17:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-14 17:31 Amir Goldstein [this message]
2023-08-18 12:34 ` [PATCH v2] check: fix parsing expunge file with comments Zorro Lang

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=20230814173132.767345-1-amir73il@gmail.com \
    --to=amir73il@gmail.com \
    --cc=Yuezhang.Mo@foxmail.com \
    --cc=fstests@vger.kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=zlang@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.