check: fix excluding test groups

The -x flag is used to exclude tests that belong to
certain groups from the test args list.

When the test args list is expressed as a match pattern,
-x fails to exclude the tests that match the pattern
and belong to excluded groups.

For example:
$ ./check -n xfs/??? | wc -l
341
$ ./check -n -x fuzzers,dangerous_fuzzers xfs/??? | wc -l
341

After the fix:
$ ./check -n -x fuzzers,dangerous_fuzzers xfs/??? | wc -l
315

This bug seems to date back to this git repo epoc.

The fix also sorts out filtering of test that are not found
in group files for the patten match input.

For example:
$ ./check xfs/001*
...
xfs/001	 2s
xfs/001.out	 [failed, exit status 127] - no qualified output

After the fix:
$ ./check -n xfs/001*
xfs/001.out - unknown test, ignored
...
xfs/001 2s

[eguan: use grep -q and fix if-then-fi style]

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
This commit is contained in:
Amir Goldstein
2016-12-09 10:50:46 +02:00
committed by Eryu Guan
parent e6111674ea
commit 2257d91fe4
+16 -11
View File
@@ -281,18 +281,23 @@ if $have_test_arg; then
status=1
exit $status
;;
*) test_dir=`dirname $1`
test_dir=${test_dir#$SRC_DIR/*}
test_name=`basename $1`
group_file=$SRC_DIR/$test_dir/group
*) # Expand test pattern (e.g. xfs/???, *fs/001)
list=$(cd $SRC_DIR; echo $1)
for t in $list; do
test_dir=`dirname $t`
test_dir=${test_dir#$SRC_DIR/*}
test_name=`basename $t`
group_file=$SRC_DIR/$test_dir/group
if egrep "^$test_name" $group_file >/dev/null ; then
# in group file ... OK
echo $SRC_DIR/$test_dir/$test_name >>$tmp.arglist
else
# oops
echo "$1 - unknown test, ignored"
fi
if egrep -q "^$test_name" $group_file; then
# in group file ... OK
echo $SRC_DIR/$test_dir/$test_name \
>>$tmp.arglist
else
# oops
echo "$t - unknown test, ignored"
fi
done
;;
esac