xfs: Verify correctness of upgrading an fs to support large extent counters
[xfstests-dev.git] / check
diff --git a/check b/check
index ba1920429fa0d1fb0fc7c42707d53df0884c7364..de11b37e1346806d80158521b28a1752aeb63092 100755 (executable)
--- a/check
+++ b/check
@@ -116,7 +116,7 @@ examples:
  check -X .exclude -g auto
  check -E ~/.xfstests.exclude
 '
-           exit 0
+           exit 1
 }
 
 get_sub_group_list()
@@ -124,9 +124,9 @@ get_sub_group_list()
        local d=$1
        local grp=$2
 
-       test -s "$SRC_DIR/$d/group" || return 1
+       test -s "$SRC_DIR/$d/group.list" || return 1
 
-       local grpl=$(sed -n < $SRC_DIR/$d/group \
+       local grpl=$(sed -n < $SRC_DIR/$d/group.list \
                -e 's/#.*//' \
                -e 's/$/ /' \
                -e "s;^\($VALID_TEST_NAME\).* $grp .*;$SRC_DIR/$d/\1;p")
@@ -384,7 +384,7 @@ if $have_test_arg; then
                                test_dir=`dirname $t`
                                test_dir=${test_dir#$SRC_DIR/*}
                                test_name=`basename $t`
-                               group_file=$SRC_DIR/$test_dir/group
+                               group_file=$SRC_DIR/$test_dir/group.list
 
                                if egrep -q "^$test_name" $group_file; then
                                        # in group file ... OK
@@ -525,17 +525,20 @@ _summary()
 
 _check_filesystems()
 {
+       local ret=0
+
        if [ -f ${RESULT_DIR}/require_test ]; then
-               _check_test_fs || err=true
+               _check_test_fs || ret=1
                rm -f ${RESULT_DIR}/require_test*
        else
                _test_unmount 2> /dev/null
        fi
        if [ -f ${RESULT_DIR}/require_scratch ]; then
-               _check_scratch_fs || err=true
+               _check_scratch_fs || ret=1
                rm -f ${RESULT_DIR}/require_scratch*
        fi
        _scratch_unmount 2> /dev/null
+       return $ret
 }
 
 _expunge_test()
@@ -558,11 +561,15 @@ test $? -eq 77 && HAVE_SYSTEMD_SCOPES=yes
 
 # Make the check script unattractive to the OOM killer...
 OOM_SCORE_ADJ="/proc/self/oom_score_adj"
-test -w ${OOM_SCORE_ADJ} && echo -1000 > ${OOM_SCORE_ADJ}
+function _adjust_oom_score() {
+       test -w "${OOM_SCORE_ADJ}" && echo "$1" > "${OOM_SCORE_ADJ}"
+}
+_adjust_oom_score -500
 
 # ...and make the tests themselves somewhat more attractive to it, so that if
 # the system runs out of memory it'll be the test that gets killed and not the
-# test framework.
+# test framework.  The test is run in a separate process without any of our
+# functions, so we open-code adjusting the OOM score.
 #
 # If systemd is available, run the entire test script in a scope so that we can
 # kill all subprocesses of the test if it fails to clean up after itself.  This
@@ -801,7 +808,7 @@ function run_section()
                fi
 
                # really going to try and run this one
-               rm -f $seqres.out.bad
+               rm -f $seqres.out.bad $seqres.hints
 
                # check if we really should run it
                _expunge_test $seqnum
@@ -864,6 +871,10 @@ function run_section()
                        notrun="$notrun $seqnum"
                        n_notrun=`expr $n_notrun + 1`
                        tc_status="notrun"
+
+                       # Unmount the scratch fs so that we can wipe the scratch
+                       # dev state prior to the next test run.
+                       _scratch_unmount 2> /dev/null
                        continue;
                fi
 
@@ -875,9 +886,12 @@ function run_section()
                        rm -f ${RESULT_DIR}/require_scratch*
                        err=true
                else
-                       # the test apparently passed, so check for corruption
-                       # and log messages that shouldn't be there.
-                       _check_filesystems
+                       # The test apparently passed, so check for corruption
+                       # and log messages that shouldn't be there.  Run the
+                       # checking tools from a subshell with adjusted OOM
+                       # score so that the OOM killer will target them instead
+                       # of the check script itself.
+                       (_adjust_oom_score 250; _check_filesystems) || err=true
                        _check_dmesg || err=true
                fi
 
@@ -928,6 +942,14 @@ function run_section()
                        fi; } | sed -e 's/^\(.\)/    \1/'
                        err=true
                fi
+               if [ -f $seqres.hints ]; then
+                       if $err; then
+                               echo
+                               cat $seqres.hints
+                       else
+                               rm -f $seqres.hints
+                       fi
+               fi
        done
 
        # make sure we record the status of the last test we ran.