diff mbox series

[7/7] check: move test exclusion handling to _prepare_test_list

Message ID 20190121163316.20616-7-jeffm@suse.com (mailing list archive)
State New, archived
Headers show
Series [1/7] btrfs/010: don't run without /sys/fs/btrfs | expand

Commit Message

Jeff Mahoney Jan. 21, 2019, 4:33 p.m. UTC
From: Jeff Mahoney <jeffm@suse.com>

In order to simplify combining excluded tests specified on the command
line vs specified via config files, it makes sense to push the handling
into _prepare_test_list.  This means we start with a fresh $tmp.xlist
and rebuild it each time _prepare_test_list is called.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
 check | 41 ++++++++++++++++++++++++-----------------
 1 file changed, 24 insertions(+), 17 deletions(-)

Comments

Dave Chinner Jan. 21, 2019, 11:09 p.m. UTC | #1
On Mon, Jan 21, 2019 at 11:33:16AM -0500, jeffm@suse.com wrote:
> From: Jeff Mahoney <jeffm@suse.com>
> 
> In order to simplify combining excluded tests specified on the command
> line vs specified via config files,

You mean defining excludes in configs/<hostname>.config files,
right? i.e. in config sections?

But the section code only calls _prepare_test_list if the test dev
is recreated by each section, right? So you can't really change the
expunge list from the config files without forcing a test dev
reformat, right?

> it makes sense to push the handling
> into _prepare_test_list.  This means we start with a fresh $tmp.xlist
> and rebuild it each time _prepare_test_list is called.

The patch does more than that, right?

> Signed-off-by: Jeff Mahoney <jeffm@suse.com>
> ---
>  check | 41 ++++++++++++++++++++++++-----------------
>  1 file changed, 24 insertions(+), 17 deletions(-)
> 
> diff --git a/check b/check
> index 77a06b00..17073c4e 100755
> --- a/check
> +++ b/check
> @@ -230,7 +230,28 @@ _prepare_test_list()
>  		done
>  	fi
>  
> -	# Specified groups to exclude
> +	:> $tmp.xlist
> +
> +	# Per-fstype/generic/shared file of tests to exclude (-X)
> +	for xfile in $XGROUP_FILES; do

That adds support for multiple group exclude files (i.e. multiple -X
options), right?

> +		for d in $SRC_GROUPS $FSTYP; do
> +			[ -f $SRC_DIR/$d/$xfile ] || continue
> +			for f in `sed "s/#.*$//" $SRC_DIR/$d/$xfile`; do
> +				echo "$d/$f command line" >> $tmp.xlist
> +			done
> +		done
> +	done
> +
> +	# External file of tests to exclude (-E)
> +	for xfile in $EXCLUDE_FILES; do
> +		if [ -f $xfile ]; then
> +			sed -e "s/#.*$//" \
> +			    -e "s;$; file $xfile;" "$xfile" \

And I have no idea what problem this second expression is solving -
it wasn't in the original code that got copied here.

Cheers,

Dave.
Jeff Mahoney Jan. 23, 2019, 1:59 a.m. UTC | #2
On 1/21/19 6:09 PM, Dave Chinner wrote:
> On Mon, Jan 21, 2019 at 11:33:16AM -0500, jeffm@suse.com wrote:
>> From: Jeff Mahoney <jeffm@suse.com>
>>
>> In order to simplify combining excluded tests specified on the command
>> line vs specified via config files,
> 
> You mean defining excludes in configs/<hostname>.config files,
> right? i.e. in config sections?

Yes.

> But the section code only calls _prepare_test_list if the test dev
> is recreated by each section, right? So you can't really change the
> expunge list from the config files without forcing a test dev
> reformat, right?

Right.  In my testing I didn't hit this situation, but it's there.  I
can fix that.

>> it makes sense to push the handling
>> into _prepare_test_list.  This means we start with a fresh $tmp.xlist
>> and rebuild it each time _prepare_test_list is called.
> 
> The patch does more than that, right?
> 
>> Signed-off-by: Jeff Mahoney <jeffm@suse.com>
>> ---
>>  check | 41 ++++++++++++++++++++++++-----------------
>>  1 file changed, 24 insertions(+), 17 deletions(-)
>>
>> diff --git a/check b/check
>> index 77a06b00..17073c4e 100755
>> --- a/check
>> +++ b/check
>> @@ -230,7 +230,28 @@ _prepare_test_list()
>>  		done
>>  	fi
>>  
>> -	# Specified groups to exclude
>> +	:> $tmp.xlist
>> +
>> +	# Per-fstype/generic/shared file of tests to exclude (-X)
>> +	for xfile in $XGROUP_FILES; do
> 
> That adds support for multiple group exclude files (i.e. multiple -X
> options), right?

Yes.  I'll document that in the commit message.

>> +		for d in $SRC_GROUPS $FSTYP; do
>> +			[ -f $SRC_DIR/$d/$xfile ] || continue
>> +			for f in `sed "s/#.*$//" $SRC_DIR/$d/$xfile`; do
>> +				echo "$d/$f command line" >> $tmp.xlist
>> +			done
>> +		done
>> +	done
>> +
>> +	# External file of tests to exclude (-E)
>> +	for xfile in $EXCLUDE_FILES; do
>> +		if [ -f $xfile ]; then
>> +			sed -e "s/#.*$//" \
>> +			    -e "s;$; file $xfile;" "$xfile" \
> 
> And I have no idea what problem this second expression is solving -
> it wasn't in the original code that got copied here.

This series is part of a larger set I've been using for a while.  I
reordered them and pulled out the least controversial.  This was
originally after a patch that adds reporting for why a test was expunged
to the check output.  We can ignore this part for now.

Thanks for the review,

-Jeff
diff mbox series

Patch

diff --git a/check b/check
index 77a06b00..17073c4e 100755
--- a/check
+++ b/check
@@ -230,7 +230,28 @@  _prepare_test_list()
 		done
 	fi
 
-	# Specified groups to exclude
+	:> $tmp.xlist
+
+	# Per-fstype/generic/shared file of tests to exclude (-X)
+	for xfile in $XGROUP_FILES; do
+		for d in $SRC_GROUPS $FSTYP; do
+			[ -f $SRC_DIR/$d/$xfile ] || continue
+			for f in `sed "s/#.*$//" $SRC_DIR/$d/$xfile`; do
+				echo "$d/$f command line" >> $tmp.xlist
+			done
+		done
+	done
+
+	# External file of tests to exclude (-E)
+	for xfile in $EXCLUDE_FILES; do
+		if [ -f $xfile ]; then
+			sed -e "s/#.*$//" \
+			    -e "s;$; file $xfile;" "$xfile" \
+			    >> $tmp.xlist
+	        fi
+	done
+
+	# Specified groups to exclude (-x)
 	for xgroup in $XGROUP_LIST; do
 		list=$(get_group_list $xgroup)
 		if [ -z "$list" ]; then
@@ -273,13 +294,8 @@  while [ $# -gt 0 ]; do
 		XGROUP_LIST="$XGROUP_LIST ${xgroup//,/ }"
 		;;
 
-	-X)	subdir_xfile=$2; shift ;
-		;;
-	-E)	xfile=$2; shift ;
-		if [ -f $xfile ]; then
-			sed "s/#.*$//" "$xfile" >> $tmp.xlist
-	        fi
-		;;
+	-X)	XGROUP_FILES="$XGROUP_FILES $2" ; shift ;;
+	-E)	EXCLUDE_FILES="$EXCLUDE_FILES $2" ; shift ;;
 	-s)	RUN_SECTION="$RUN_SECTION $2"; shift ;;
 	-S)	EXCLUDE_SECTION="$EXCLUDE_SECTION $2"; shift ;;
 	-l)	diff="diff" ;;
@@ -320,15 +336,6 @@  if ! . ./common/rc; then
 	exit 1
 fi
 
-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
-		done
-	done
-fi
-
 # Process tests from command line now.
 if $have_test_arg; then
 	while [ $# -gt 0 ]; do