]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
fstests: clean up termination of various tests
authorDave Chinner <dchinner@redhat.com>
Tue, 26 Nov 2024 23:29:59 +0000 (10:29 +1100)
committerZorro Lang <zlang@kernel.org>
Sun, 8 Dec 2024 14:16:02 +0000 (22:16 +0800)
Accumulated minor fixes to improve reliablity of the termination
of various tests when interrupted.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Zorro lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
tests/generic/084
tests/generic/464
tests/generic/650
tests/xfs/013
tests/xfs/558

index 137ba23cf240eaf9312dc8d565bffc754e2949de..fe758f118d14305cede108fbabc4ac14f338691b 100755 (executable)
 . ./common/preamble
 _begin_fstest auto metadata quick
 
+_cleanup()
+{
+       [ -n "$link_pids" ] && kill $link_pids
+       [ -n "$open_pid" ] && kill $open_pid
+       wait
+       cd /
+       rm -f $tmp.*
+}
+
 # Import common functions.
 . ./common/filter
 
@@ -57,9 +66,6 @@ done &
 sleep 5
 kill $! >/dev/null 2>&1
 
-kill $open_pid $link_pids >/dev/null 2>&1
-wait $open_pid $link_pids
-
 # all done, no oops/hang expected, _check_filesystems checks SCRATCH_DEV after test
 status=0
 exit
index f114208f9e08e6c37ff511bb7d56855dbff2bf9a..ebf47509449c6f00cf6495f6f5e22250df166437 100755 (executable)
@@ -66,22 +66,22 @@ _scratch_mount
 # for each operation and runs for $LOOP_TIME seconds, and check filesystem
 # consistency after each iteration
 for i in `seq 1 $LOOP_CNT`; do
-       rm -f $stop
+       touch $stop
        for j in `seq 1 $PROC_CNT`; do
-               while [ -e $stop ]; do
+               while [ -e $stop ]; do
                        do_write
                done &
 
-               while [ -e $stop ]; do
+               while [ -e $stop ]; do
                        do_append
                done &
 
-               while [ -e $stop ]; do
+               while [ -e $stop ]; do
                        do_writeback
                done &
        done
        sleep $LOOP_TIME
-       touch $stop
+       rm -f $stop
        wait
 
        _scratch_unmount
index 36a23e48d82b3122031ab5ed168996752aa7a0fc..60f86fdf5189615bea6fcb0ff327e17970677fc7 100755 (executable)
@@ -52,8 +52,6 @@ nr_hotplug_cpus="${#hotplug_cpus[@]}"
 test "$nr_hotplug_cpus" -gt 0 || _notrun "CPU hotplugging not supported"
 
 stress_dir="$TEST_DIR/$seq"
-rm -r -f "$stress_dir"
-mkdir -p "$stress_dir"
 
 echo "Silence is golden."
 
@@ -79,12 +77,14 @@ fsstress_args+=(--duration="$((SOAK_DURATION / 10))")
 nr_ops=$((2500 * TIME_FACTOR))
 fsstress_args+=(-n $nr_ops)
 for ((i = 0; i < 10; i++)); do
-       _run_fsstress_bg -w "${fsstress_args[@]}"
-       _wait_for_fsstress
+       rm -rf "$stress_dir"
+       mkdir -p "$stress_dir"
+       _run_fsstress "${fsstress_args[@]}"
        _test_cycle_mount
 done
 
 rm -f $sentinel_file
+wait
 
 # success, all done
 status=0
index 5a92ef084528f334b8e33c547c1ecaabb7233409..fd011445d2c9f869d1109609482945706b8cc577 100755 (executable)
@@ -120,6 +120,7 @@ _kill_fsstress
 # clean out the competing fsstress allocations, then everything else
 rm -rf $SCRATCH_MNT/fsstress
 rm -rf $SCRATCH_MNT/dir*
+wait
 
 _scratch_unmount
 
index ba137ae8dac33a0c2bcc13346797aeadecf7f9ca..c594d8ccd9e321c5b01f0c5b3655ffa59b986476 100755 (executable)
@@ -193,6 +193,7 @@ wait_for_errortag &
 $XFS_IO_PROG -c "pwrite -S 0x56 $((2 * blksz)) $((2 * blksz))" \
        -c 'fsync' $SCRATCH_MNT/file >> $seqres.full
 rm -f $sentryfile
+wait
 
 cat "$tracefile" >> $seqres.full
 grep -q iomap_invalid "$tracefile"