xfs: test what happens when we reset the root dir and it has xattrs
[xfstests-dev.git] / check
diff --git a/check b/check
index 6f8db8585b2683b884a59e06afcc442c0a5fd7a0..ba1920429fa0d1fb0fc7c42707d53df0884c7364 100755 (executable)
--- a/check
+++ b/check
@@ -20,6 +20,7 @@ diff="diff -u"
 showme=false
 have_test_arg=false
 randomize=false
+exact_order=false
 export here=`pwd`
 xfile=""
 subdir_xfile=""
@@ -27,6 +28,7 @@ brief_test_summary=false
 do_report=false
 DUMP_OUTPUT=false
 iterations=1
+istop=false
 
 # This is a global variable used to pass test failure text to reporting gunk
 _err_msg=""
@@ -67,7 +69,9 @@ check options
     -n                 show me, do not run tests
     -T                 output timestamps
     -r                 randomize test order
+    --exact-order      run tests in the exact order specified
     -i <n>             iterate the test list <n> times
+    -I <n>             iterate the test list <n> times, but stops iterating further in case of any test failure
     -d                 dump test output to stdout
     -b                 brief test summary
     -R fmt[,fmt]       generate report in formats specified. Supported format: [xunit]
@@ -249,17 +253,22 @@ _prepare_test_list()
                trim_test_list $list
        done
 
-       # sort the list of tests into numeric order
-       if $randomize; then
-               if type shuf >& /dev/null; then
-                       sorter="shuf"
+       # sort the list of tests into numeric order unless we're running tests
+       # in the exact order specified
+       if ! $exact_order; then
+               if $randomize; then
+                       if type shuf >& /dev/null; then
+                               sorter="shuf"
+                       else
+                               sorter="awk -v seed=$RANDOM -f randomize.awk"
+                       fi
                else
-                       sorter="awk -v seed=$RANDOM -f randomize.awk"
+                       sorter="cat"
                fi
+               list=`sort -n $tmp.list | uniq | $sorter`
        else
-               sorter="cat"
+               list=`cat $tmp.list`
        fi
-       list=`sort -n $tmp.list | uniq | $sorter`
        rm -f $tmp.list
 }
 
@@ -304,8 +313,22 @@ while [ $# -gt 0 ]; do
        -udiff) diff="$diff -u" ;;
 
        -n)     showme=true ;;
-        -r)    randomize=true ;;
+       -r)
+               if $exact_order; then
+                       echo "Cannot specify -r and --exact-order."
+                       exit 1
+               fi
+               randomize=true
+               ;;
+       --exact-order)
+               if $randomize; then
+                       echo "Cannnot specify --exact-order and -r."
+                       exit 1
+               fi
+               exact_order=true
+               ;;
        -i)     iterations=$2; shift ;;
+       -I)     iterations=$2; istop=true; shift ;;
        -T)     timestamp=true ;;
        -d)     DUMP_OUTPUT=true ;;
        -b)     brief_test_summary=true;;
@@ -932,6 +955,11 @@ function run_section()
 for ((iters = 0; iters < $iterations; iters++)) do
        for section in $HOST_OPTIONS_SECTIONS; do
                run_section $section
+               if [ "$sum_bad" != 0 ] && [ "$istop" = true ]; then
+                       interrupt=false
+                       status=`expr $sum_bad != 0`
+                       exit
+               fi
        done
 done