]> www.infradead.org Git - users/hch/xfstests-dev.git/commitdiff
generic/085: general cleanup for reliability and debugging
authorDave Chinner <dchinner@redhat.com>
Tue, 26 Nov 2024 21:01:43 +0000 (08:01 +1100)
committerZorro Lang <zlang@kernel.org>
Sun, 8 Dec 2024 14:15:06 +0000 (22:15 +0800)
This test was quite unreliable during development of the parallel
check runner. It redirects all errors to /dev/null, so there was no
way to debug it when it failed.

Use common mount/unmount helpers, redirect errors to $seqres.full,
make sure the cleanup code is always run at test exit and only
attempt to kill processes if they are still running during cleanup.

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/085

index 8fbcdce2e5a42ab0e5a698d525e19ec08287b3cf..7671a36ab9524fe79bc8e0260cf6f4e24cf70fe8 100755 (executable)
@@ -16,18 +16,20 @@ _begin_fstest auto freeze mount
 # Override the default cleanup function.
 _cleanup()
 {
+       cleanup_dmdev
        cd /
        rm -f $tmp.*
-       cleanup_dmdev
 }
 
 cleanup_dmdev()
 {
+       if [ -n "$pid" ]; then
+               kill -9 $pid 2>> $seqres.full
+               wait $pid 2>> $seqres.full
+       fi
        # in case it's still suspended and/or mounted
-       $DMSETUP_PROG resume $lvdev >/dev/null 2>&1
-       [ -n "$pid" ] && kill -9 $pid 2>/dev/null
-       wait $pid
-       _unmount $lvdev >/dev/null 2>&1
+       $DMSETUP_PROG resume $lvdev >> $seqres.full 2>&1
+       _unmount -q $SCRATCH_MNT
        _dmsetup_remove $node
 }
 
@@ -64,18 +66,19 @@ setup_dmdev
 # important, as long as they're racing with each other. So just throw away the
 # outputs and ignore the results.
 for ((i=0; i<100; i++)); do
-       $DMSETUP_PROG suspend $lvdev >/dev/null 2>&1
-       $DMSETUP_PROG resume $lvdev >/dev/null 2>&1
+       $DMSETUP_PROG suspend $lvdev >> $seqres.full 2>&1
+       $DMSETUP_PROG resume $lvdev >> $seqres.full 2>&1
 done &
 pid=$!
 for ((i=0; i<100; i++)); do
-       _mount $lvdev $SCRATCH_MNT >/dev/null 2>&1
-       _unmount $lvdev >/dev/null 2>&1
+       _mount $lvdev $SCRATCH_MNT >> $seqres.full 2>&1
+       _unmount $lvdev >> $seqres.full 2>&1
 done &
 pid="$pid $!"
 
 wait $pid
 unset pid
 
+cleanup_dmdev
 status=0
 exit