]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
common/fuzzy: fix some problems with the no-repair strategy
authorDarrick J. Wong <djwong@kernel.org>
Fri, 30 Dec 2022 22:19:40 +0000 (14:19 -0800)
committerZorro Lang <zlang@kernel.org>
Sat, 25 Feb 2023 13:10:45 +0000 (21:10 +0800)
While auditing the fuzz tester code, I noticed there were numerous
problems with the no repair strategy -- the stages of the strategy
are not consistently logged to the kernel log, and we don't actually
verify that either online or offline scrubs notice the fuzz.  Rework the
error messages to make reading the golden output easier.

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 d869d2418baccab8ad702023c680f7290aca6664..0dcc43fb60c014e328f007239587f95e22ff9f37 100644 (file)
@@ -274,15 +274,29 @@ __scratch_xfs_fuzz_field_offline() {
 __scratch_xfs_fuzz_field_norepair() {
        local fuzz_action="$1"
 
+       # Make sure offline scrub will catch whatever we fuzzed
+       __fuzz_notify "+ Detect fuzzed field (offline)"
+       _scratch_xfs_repair -P -n 2>&1
+       res=$?
+       test $res -eq 0 && \
+               (>&2 echo "${fuzz_action}: offline scrub didn't fail.")
+
        # Mount or else we can't do anything in norepair mode
-       echo "+ Mount filesystem to try no repair"
+       __fuzz_notify "+ Mount filesystem to try online scan"
        _try_scratch_mount 2>&1
        res=$?
        if [ $res -ne 0 ]; then
-               (>&2 echo "mount failed ($res) with ${fuzz_action}.")
-               return 0
+               (>&2 echo "${fuzz_action}: mount failed ($res).")
+               return 1
        fi
 
+       # Make sure online scrub will catch whatever we fuzzed
+       __fuzz_notify "++ Detect fuzzed field (online)"
+       _scratch_scrub -n -a 1 -e continue 2>&1
+       res=$?
+       test $res -eq 0 && \
+               (>&2 echo "${fuzz_action}: online scrub didn't fail.")
+
        __scratch_xfs_fuzz_unmount
 
        return 0