From 6d63f23987a629b4f7dd6e57e5b67ba37a3b742e Mon Sep 17 00:00:00 2001 From: Amir Goldstein Date: Mon, 14 Aug 2023 20:31:32 +0300 Subject: check: fix parsing expunge file with comments 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 Reviewed-by: Zorro Lang Signed-off-by: Zorro Lang --- 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 -- cgit v1.2.3