]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
fuzzy: allow FUZZ_REWRITE_DURATION to control fsstress runtime when fuzzing
authorDarrick J. Wong <djwong@kernel.org>
Mon, 3 Jun 2024 20:12:42 +0000 (13:12 -0700)
committerZorro Lang <zlang@kernel.org>
Fri, 7 Jun 2024 10:19:41 +0000 (18:19 +0800)
For each iteration of the fuzz test loop, we try to correct the problem,
and then we run fsstress on the (allegedly corrected) filesystem to
check that subsequent use of the filesystem won't crash the kernel or
panic.

Now that fsstress has a --duration switch, let's add a new config
variable that people can set to constrain the amount of time that a fuzz
test run takes.

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
common/fuzzy

diff --git a/check b/check
index 723a52e30d1ba63f6997e8d5705509b9176d0eb4..9222cd7e4f8197be0db4d3d161caa589bc82d651 100755 (executable)
--- a/check
+++ b/check
@@ -376,6 +376,18 @@ if [ -n "$SOAK_DURATION" ]; then
        fi
 fi
 
+# If the test config specified a fuzz rewrite test duration, see if there are
+# any unit suffixes that need converting to an integer seconds count.
+if [ -n "$FUZZ_REWRITE_DURATION" ]; then
+       FUZZ_REWRITE_DURATION="$(echo "$FUZZ_REWRITE_DURATION" | \
+               sed -e 's/^\([.0-9]*\)\([a-z]\)*/\1 \2/g' | \
+               $AWK_PROG -f $here/src/soak_duration.awk)"
+       if [ $? -ne 0 ]; then
+               status=1
+               exit 1
+       fi
+fi
+
 if [ -n "$subdir_xfile" ]; then
        for d in $SRC_GROUPS $FSTYP; do
                [ -f $SRC_DIR/$d/$subdir_xfile ] || continue
index c07f461b61a69b61418b6c219ef9a1cbb3a64275..ed79dbc7e5fecf2febaab694d8c23d83a5685e32 100644 (file)
@@ -6,16 +6,19 @@
 
 # Modify various files after a fuzzing operation
 _scratch_fuzz_modify() {
+       local fsstress_args=(-n $((TIME_FACTOR * 10000)) -p $((LOAD_FACTOR * 4)) )
+       test -n "${FUZZ_REWRITE_DURATION}" && fsstress_args+=("--duration=${FUZZ_REWRITE_DURATION}")
+
        echo "+++ stressing filesystem"
        mkdir -p $SCRATCH_MNT/data
        [ "$FSTYP" == "xfs" ] && _xfs_force_bdev data $SCRATCH_MNT/data
-       $FSSTRESS_PROG -n $((TIME_FACTOR * 10000)) -p $((LOAD_FACTOR * 4)) -d $SCRATCH_MNT/data
+       $FSSTRESS_PROG "${fsstress_args[@]}" -d $SCRATCH_MNT/data
 
        if [ "$FSTYP" = "xfs" ]; then
                if _xfs_has_feature "$SCRATCH_MNT" realtime; then
                        mkdir -p $SCRATCH_MNT/rt
                        _xfs_force_bdev realtime $SCRATCH_MNT/rt
-                       $FSSTRESS_PROG -n $((TIME_FACTOR * 10000)) -p $((LOAD_FACTOR * 4)) -d $SCRATCH_MNT/rt
+                       $FSSTRESS_PROG "${fsstress_args[@]}" -d $SCRATCH_MNT/rt
                else
                        echo "+++ xfs realtime not configured"
                fi