]> git-server-git.apps.pok.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
fuzzy: give each test local control over what scrub stress tests get run
authorDarrick J. Wong <djwong@kernel.org>
Fri, 30 Dec 2022 22:12:53 +0000 (14:12 -0800)
committerZorro Lang <zlang@kernel.org>
Sat, 14 Jan 2023 13:49:02 +0000 (21:49 +0800)
Now that we've hoisted the scrub stress code to common/fuzzy, introduce
argument parsing so that each test can specify what they want to test.

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
tests/xfs/422

index de9e398984b078d445e90f88f7a8967dd7148f7d..88ba5fef698123dc7abc7008965f7ab105563871 100644 (file)
@@ -348,12 +348,19 @@ __stress_scrub_freeze_loop() {
        done
 }
 
-# Run xfs online fsck commands in a tight loop.
-__stress_scrub_loop() {
+# Run individual XFS online fsck commands in a tight loop with xfs_io.
+__stress_one_scrub_loop() {
        local end="$1"
+       local scrub_tgt="$2"
+       shift; shift
+
+       local xfs_io_args=()
+       for arg in "$@"; do
+               xfs_io_args+=('-c' "$arg")
+       done
 
        while [ "$(date +%s)" -lt $end ]; do
-               $XFS_IO_PROG -x -c 'repair rmapbt 0' -c 'repair rmapbt 1' $SCRATCH_MNT 2>&1 | \
+               $XFS_IO_PROG -x "${xfs_io_args[@]}" "$scrub_tgt" 2>&1 | \
                        __stress_scrub_filter_output
        done
 }
@@ -390,6 +397,8 @@ _require_xfs_stress_online_repair() {
 
 # Clean up after the loops in case they didn't do it themselves.
 _scratch_xfs_stress_scrub_cleanup() {
+       echo "Cleaning up scrub stress run at $(date)" >> $seqres.full
+
        # Send SIGINT so that bash won't print a 'Terminated' message that
        # distorts the golden output.
        $KILLALL_PROG -INT xfs_io fsstress >> $seqres.full 2>&1
@@ -399,7 +408,25 @@ _scratch_xfs_stress_scrub_cleanup() {
 # Start scrub, freeze, and fsstress in background looping processes, and wait
 # for 30*TIME_FACTOR seconds to see if the filesystem goes down.  Callers
 # must call _scratch_xfs_stress_scrub_cleanup from their cleanup functions.
+#
+# Various options include:
+#
+# -s   Pass this command to xfs_io to test scrub.  If zero -s options are
+#      specified, xfs_io will not be run.
+# -t   Run online scrub against this file; $SCRATCH_MNT is the default.
 _scratch_xfs_stress_scrub() {
+       local one_scrub_args=()
+       local scrub_tgt="$SCRATCH_MNT"
+
+       OPTIND=1
+       while getopts "s:t:" c; do
+               case "$c" in
+                       s) one_scrub_args+=("$OPTARG");;
+                       t) scrub_tgt="$OPTARG";;
+                       *) return 1; ;;
+               esac
+       done
+
        local start="$(date +%s)"
        local end="$((start + (30 * TIME_FACTOR) ))"
 
@@ -408,7 +435,11 @@ _scratch_xfs_stress_scrub() {
 
        __stress_scrub_fsstress_loop $end &
        __stress_scrub_freeze_loop $end &
-       __stress_scrub_loop $end &
+
+       if [ "${#one_scrub_args[@]}" -gt 0 ]; then
+               __stress_one_scrub_loop "$end" "$scrub_tgt" \
+                               "${one_scrub_args[@]}" &
+       fi
 
        # Wait until 2 seconds after the loops should have finished, then
        # clean up after ourselves.
index b3353d2202e3cdccbfd3069f8134f6fbb52caa89..faea5d67928cb1b2467e6d2c5c0e353b3d2b3ac7 100755 (executable)
@@ -31,7 +31,7 @@ _require_xfs_stress_online_repair
 _scratch_mkfs > "$seqres.full" 2>&1
 _scratch_mount
 _require_xfs_has_feature "$SCRATCH_MNT" rmapbt
-_scratch_xfs_stress_online_repair
+_scratch_xfs_stress_online_repair -s "repair rmapbt 0" -s "repair rmapbt 1"
 
 # success, all done
 echo Silence is golden