FS/XFS testing framework
 help / color / mirror / Atom feed
* [PATCH] check: fix excluded tests are only expunged in the first iteration
@ 2023-06-30 12:28 yuezhang.mo
  2023-06-30 13:33 ` Bill O'Donnell
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: yuezhang.mo @ 2023-06-30 12:28 UTC (permalink / raw)
  To: fstests; +Cc: Yuezhang Mo

From: Yuezhang Mo <yuezhang.mo@foxmail.com>

If iterating more than once and excluding some tests, the
excluded tests are expunged in the first iteration, but run in
subsequent iterations. This is not expected.

The problem was caused by the temporary file saving the excluded
tests being deleted at the end of the first iteration.

This commit saves the excluded tests into a variable instead of a
temp file.

Signed-off-by: Yuezhang Mo <yuezhang.mo@foxmail.com>
---
 check | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/check b/check
index e36978c1..a8071121 100755
--- a/check
+++ b/check
@@ -27,6 +27,7 @@ DUMP_OUTPUT=false
 iterations=1
 istop=false
 loop_on_fail=0
+exclude_tests=()
 
 # This is a global variable used to pass test failure text to reporting gunk
 _err_msg=""
@@ -46,7 +47,7 @@ export DIFF_LENGTH=${DIFF_LENGTH:=10}
 # by default don't output timestamps
 timestamp=${TIMESTAMP:=false}
 
-rm -f $tmp.list $tmp.tmp $tmp.grep $here/$iam.out $tmp.xlist $tmp.report.* $tmp.arglist
+rm -f $tmp.list $tmp.tmp $tmp.grep $here/$iam.out $tmp.report.* $tmp.arglist
 
 SRC_GROUPS="generic shared"
 export SRC_DIR="tests"
@@ -302,13 +303,13 @@ while [ $# -gt 0 ]; do
 		;;
 	-e)
 		xfile=$2; shift ;
-		echo "$xfile" | tr ', ' '\n\n' >> $tmp.xlist
+		exclude_tests+=($(echo "$xfile" | tr ', ' '\n\n'))
 		;;
 
 	-E)	xfile=$2; shift ;
 		if [ -f $xfile ]; then
-			sed "s/#.*$//" "$xfile" >> $tmp.xlist
-	        fi
+			exclude_tests+=($(sed "s/#.*$//" "$xfile"))
+		fi
 		;;
 	-s)	RUN_SECTION="$RUN_SECTION $2"; shift ;;
 	-S)	EXCLUDE_SECTION="$EXCLUDE_SECTION $2"; shift ;;
@@ -383,7 +384,7 @@ if [ -n "$subdir_xfile" ]; then
 	for d in $SRC_GROUPS $FSTYP; do
 		[ -f $SRC_DIR/$d/$subdir_xfile ] || continue
 		for f in `sed "s/#.*$//" $SRC_DIR/$d/$subdir_xfile`; do
-			echo $d/$f >> $tmp.xlist
+			exclude_tests+=($d/$f)
 		done
 	done
 fi
@@ -570,11 +571,10 @@ _check_filesystems()
 _expunge_test()
 {
 	local TEST_ID="$1"
-	if [ -s $tmp.xlist ]; then
-		if grep -q $TEST_ID $tmp.xlist; then
-			echo "       [expunged]"
-			return 1
-		fi
+
+	if echo ${exclude_tests[*]} | grep -q $TEST_ID; then
+		echo "       [expunged]"
+		return 1
 	fi
 	return 0
 }
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-07-04  0:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-30 12:28 [PATCH] check: fix excluded tests are only expunged in the first iteration yuezhang.mo
2023-06-30 13:33 ` Bill O'Donnell
2023-06-30 15:41 ` Darrick J. Wong
2023-07-03 14:51 ` Zorro Lang
2023-07-03 15:44   ` Darrick J. Wong
2023-07-04  0:24   ` Yuezhang Mo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox