check: move expunge test into a helper
authorLuis R. Rodriguez <mcgrof@kernel.org>
Sun, 21 Jan 2018 07:24:00 +0000 (23:24 -0800)
committerEryu Guan <eguan@redhat.com>
Mon, 22 Jan 2018 10:32:17 +0000 (18:32 +0800)
Move the expunge test into a helper.

[eguan: make TEST_ID local and use grep -q not io redirection]

Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
check

diff --git a/check b/check
index 6078b1ef3cc94424cf0535cf7c8dfb4441145c3a..84752dae369fb5e2f2a7f316b36469275ffeb645 100755 (executable)
--- a/check
+++ b/check
@@ -487,6 +487,18 @@ _check_filesystems()
        fi
 }
 
+_expunge_test()
+{
+       local TEST_ID="$1"
+       if [ -s $tmp.xlist ]; then
+               if grep -q $TEST_ID $tmp.xlist; then
+                       echo "       [expunged]"
+                       return 1
+               fi
+       fi
+       return 0
+}
+
 _prepare_test_list
 
 if $OPTIONS_HAVE_SECTIONS; then
@@ -674,11 +686,9 @@ for section in $HOST_OPTIONS_SECTIONS; do
                rm -f $seqres.out.bad
 
                # check if we really should run it
-               if [ -s $tmp.xlist ]; then
-                       if grep $seqnum $tmp.xlist > /dev/null 2>&1 ; then
-                               echo "       [expunged]"
-                               continue
-                       fi
+               _expunge_test $seqnum
+               if [ $? -eq 1 ]; then
+                       continue
                fi
 
                # slashes now in names, sed barfs on them so use grep