]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
common/fuzzy: evaluate xfs_check vs xfs_repair
authorDarrick J. Wong <djwong@kernel.org>
Fri, 30 Dec 2022 22:19:41 +0000 (14:19 -0800)
committerZorro Lang <zlang@kernel.org>
Sat, 25 Feb 2023 13:12:08 +0000 (21:12 +0800)
When fuzzing a filesystem and using the offline repair strategy, compare
the outputs of xfs_check against xfs_repair to ensure that the newer
xfs_repair catches at least as many things as xfs_check does.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
common/fuzzy

index 37a1f33da41adb0f2e7835f309546cf3d8f3c986..bae363b5693d2953dd77196adcb623a1034a6f75 100644 (file)
@@ -253,6 +253,17 @@ __scratch_xfs_fuzz_field_offline() {
        test $res -eq 0 && \
                (>&2 echo "${fuzz_action}: offline scrub didn't fail.")
 
+       # Make sure xfs_repair catches at least as many things as the old
+       # xfs_check did.
+       if [ -n "${SCRATCH_XFS_FUZZ_CHECK}" ]; then
+               __fuzz_notify "+ Detect fuzzed field (xfs_check)"
+               _scratch_xfs_check 2>&1
+               res1=$?
+               if [ $res1 -ne 0 ] && [ $res -eq 0 ]; then
+                       (>&2 echo "${fuzz_action}: xfs_repair passed but xfs_check failed ($res1).")
+               fi
+       fi
+
        # Repair the filesystem offline
        __fuzz_notify "+ Try to repair the filesystem (offline)"
        _repair_scratch_fs -P 2>&1