]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
check: check and fix the test filesystem after failed tests
authorDarrick J. Wong <djwong@kernel.org>
Wed, 21 May 2025 22:42:54 +0000 (15:42 -0700)
committerZorro Lang <zlang@kernel.org>
Fri, 23 May 2025 13:43:29 +0000 (21:43 +0800)
Currently, ./check calls _check_filesystems after a test passes to make
sure that the test and scratch filesystems are ok, and repairs the test
filesystem if it's not ok.

However, we don't do this for failed tests.  If a test fails /and/
corrupts the test filesystem, every subsequent passing test will be
marked as a failure because of latent corruptions on the test
filesystem.

This is a little silly, so let's call _check_filesystems on the test
filesystem after a test fail so that the badness doesn't spread.

Cc: fstests@vger.kernel.org # v2023.05.01
Fixes: 4a444bc19a836f ("check: _check_filesystems for errors even if test failed")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
check

diff --git a/check b/check
index 826641268f8b52ddc7370ea4c5e0f47b222c02e9..818ce44da28f655bc3073cb0ecedc6fdea5100ba 100755 (executable)
--- a/check
+++ b/check
@@ -986,8 +986,13 @@ function run_section()
                        _dump_err_cont "[failed, exit status $sts]"
                        _test_unmount 2> /dev/null
                        _scratch_unmount 2> /dev/null
-                       rm -f ${RESULT_DIR}/require_test*
                        rm -f ${RESULT_DIR}/require_scratch*
+
+                       # Make sure the test filesystem is ready to go since
+                       # we don't call _check_filesystems for failed tests
+                       (_adjust_oom_score 250; _check_filesystems) || tc_status="fail"
+
+                       rm -f ${RESULT_DIR}/require_test*
                        # Even though we failed, there may be something interesting in
                        # dmesg which can help debugging.
                        _check_dmesg