[PATCH] check: fix parsing expunge file with comments

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



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 use
prefix match to deal with this case and any other suffix correctly.

While the original code would also match line "exclude test generic/001"
I don't think that non-prefix match is a real use case.

Signed-off-by: Amir Goldstein <amir73il@xxxxxxxxx>
---
 check | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

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




[Index of Archives]     [Linux Filesystems Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux