[PATCH 32/40] fstests: clean up termination of various tests

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]



From: Dave Chinner <dchinner@xxxxxxxxxx>

Accumulated minor fixes to improve reliablity of the termination
of various tests when interrupted.

Signed-off-by: Dave Chinner <dchinner@xxxxxxxxxx>
---
 tests/generic/084 | 12 +++++++++---
 tests/generic/464 | 10 +++++-----
 tests/generic/650 |  8 ++++----
 tests/xfs/013     |  1 +
 tests/xfs/558     |  1 +
 5 files changed, 20 insertions(+), 12 deletions(-)

diff --git a/tests/generic/084 b/tests/generic/084
index 137ba23cf..fe758f118 100755
--- a/tests/generic/084
+++ b/tests/generic/084
@@ -12,6 +12,15 @@
 . ./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
diff --git a/tests/generic/464 b/tests/generic/464
index f114208f9..ebf475094 100755
--- a/tests/generic/464
+++ b/tests/generic/464
@@ -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
diff --git a/tests/generic/650 b/tests/generic/650
index 36a23e48d..60f86fdf5 100755
--- a/tests/generic/650
+++ b/tests/generic/650
@@ -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
diff --git a/tests/xfs/013 b/tests/xfs/013
index 5a92ef084..fd011445d 100755
--- a/tests/xfs/013
+++ b/tests/xfs/013
@@ -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
 
diff --git a/tests/xfs/558 b/tests/xfs/558
index ba137ae8d..c594d8ccd 100755
--- a/tests/xfs/558
+++ b/tests/xfs/558
@@ -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"
-- 
2.45.2





[Index of Archives]     [Linux Filesystems Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux