xfstests: fix common source file path
[xfstests-dev.git] / check
diff --git a/check b/check
index af6d3172eae772649b29563ec6ddd42f9dd2f3bb..966fbe556b6a6225c38ee3c2619e54034a501000 100755 (executable)
--- a/check
+++ b/check
@@ -34,26 +34,40 @@ have_test_arg=false
 randomize=false
 here=`pwd`
 FSTYP=xfs
+xfile=""
 
-SUPPORTED_TESTS="[0-9][0-9][0-9] [0-9][0-9][0-9][0-9]"
-SRC_GROUPS="generic shared"
-export SRC_DIR="tests"
-export RESULT_BASE=${RESULT_BASE:="results"}
-
-# generic initialization
+# start the initialisation work now
 iam=check
 
+export MSGVERB="text:action"
 export QA_CHECK_FS=${QA_CHECK_FS:=true}
 
-# by default don't output timestamps
-timestamp=${TIMESTAMP:=false}
-
 # number of diff lines from a failed test, 0 for whole output
 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
+
+# we need common/config
+if ! . ./common/config
+then
+    echo "$iam: failed to source common/config"
+    exit 1
+fi
+
+# Autodetect fs type based on what's on $TEST_DEV
+if [ "$HOSTOS" == "Linux" ]; then
+    FSTYP=`blkid -c /dev/null -s TYPE -o value $TEST_DEV`
+fi
+export FSTYP
+
+SUPPORTED_TESTS="[0-9][0-9][0-9] [0-9][0-9][0-9][0-9]"
+SRC_GROUPS="generic shared"
+export SRC_DIR="tests"
+export RESULT_BASE=${RESULT_BASE:="$here/results"}
+
 usage()
 {
     echo "Usage: $0 [options] [testlist]"'
@@ -72,17 +86,12 @@ check options
 testlist options
     -g group[,group...]        include tests from these groups
     -x group[,group...]        exclude tests from these groups
+    -X file            exclude individual tests
     [testlist]         include tests matching names in testlist
 '
            exit 0
 }
 
-_setenvironment()
-{
-    MSGVERB="text:action"
-    export MSGVERB
-}
-
 get_group_list()
 {
        grp=$1
@@ -110,6 +119,30 @@ get_all_tests()
        done
 }
 
+# takes the list of tests to run in $tmp.list, and removes the tests passed to
+# the function from that list.
+trim_test_list()
+{
+       test_list="$*"
+
+       rm -f $tmp.grep
+       numsed=0
+       for t in $test_list
+       do
+           if [ $numsed -gt 100 ]; then
+               grep -v -f $tmp.grep <$tmp.list >$tmp.tmp
+               mv $tmp.tmp $tmp.list
+               numsed=0
+               rm -f $tmp.grep
+           fi
+           echo "^$t\$" >>$tmp.grep
+           numsed=`expr $numsed + 1`
+       done
+       grep -v -f $tmp.grep <$tmp.list >$tmp.tmp
+       mv $tmp.tmp $tmp.list
+}
+
+
 _wallclock()
 {
     date "+%H %M %S" | $AWK_PROG '{ print $1*3600 + $2*60 + $3 }'
@@ -121,24 +154,6 @@ _timestamp()
     echo -n " [$now]"
 }
 
-# start the initialisation work now
-_setenvironment
-
-rm -f $tmp.list $tmp.tmp $tmp.grep $here/$iam.out
-
-# Autodetect fs type based on what's on $TEST_DEV
-if [ "$HOSTOS" == "Linux" ]; then
-    FSTYP=`blkid -c /dev/null -s TYPE -o value $TEST_DEV`
-fi
-export FSTYP
-
-# we need common.config
-if ! . ./common.config
-then
-    echo "$iam: failed to source common.config"
-    exit 1
-fi
-
 # Process command arguments first.
 while [ $# -gt 0 ]; do
        case "$1" in
@@ -177,21 +192,16 @@ while [ $# -gt 0 ]; do
                    exit 1
                fi
 
-               rm -f $tmp.grep
-               numsed=0
-               for t in $group_list
-               do
-                   if [ $numsed -gt 100 ]; then
-                       grep -v -f $tmp.grep <$tmp.list >$tmp.tmp
-                       mv $tmp.tmp $tmp.list
-                       numsed=0
-                       rm -f $tmp.grep
-                   fi
-                   echo "^$t\$" >>$tmp.grep
-                   numsed=`expr $numsed + 1`
+               trim_test_list $group_list
+               ;;
+
+       -X)     xfile=$2; shift ;
+               for d in $SRC_GROUPS $FSTYP; do
+                       [ -f $SRC_DIR/$d/$xfile ] || continue
+                       for f in `cat $SRC_DIR/$d/$xfile`; do
+                               echo $d/$f >> $tmp.xlist
+                       done
                done
-               grep -v -f $tmp.grep <$tmp.list >$tmp.tmp
-               mv $tmp.tmp $tmp.list
                ;;
 
        -l)     diff="diff" ;;
@@ -266,10 +276,10 @@ then
     list=`echo $list | awk -f randomize.awk`
 fi
 
-# we need common.rc
-if ! . ./common.rc
+# we need common/rc
+if ! . ./common/rc
 then
-    echo "check: failed to source common.rc"
+    echo "check: failed to source common/rc"
     exit 1
 fi
 
@@ -413,6 +423,14 @@ 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
+       fi
+
        # slashes now in names, sed barfs on them so use grep
        lasttime=`grep -w ^$seq check.time | awk '// {print $2}'`
        if [ "X$lasttime" != X ]; then