]> www.infradead.org Git - users/hch/xfstests-dev.git/commitdiff
unmount: resume logging of stdout and stderr for filtering
authorDarrick J. Wong <djwong@kernel.org>
Mon, 3 Feb 2025 22:00:28 +0000 (14:00 -0800)
committerZorro Lang <zlang@kernel.org>
Tue, 18 Feb 2025 04:42:39 +0000 (12:42 +0800)
There's a number of places where a test program calls a variant of
_unmount but then pipes the output through a _filter script or
something.  The new _unmount helper redirects stdout and stderr to
seqres.full, which means that those error messages (some of which are
encoded in the golden outputs) are suppressed.  This leads to test
regressions in generic/050 and other places, so let's resume logging.

This also undoes all the changes that removed /dev/null redirection of
unmount calls.

Cc: <fstests@vger.kernel.org> # v2024.12.08
Fixes: 4c6bc4565105e6 ("fstests: clean up mount and unmount operations")
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
check
common/quota
common/rc
tests/generic/050
tests/generic/085
tests/generic/361
tests/generic/590
tests/generic/746
tests/xfs/149
tests/xfs/530

diff --git a/check b/check
index e79fefc4168c0636ad6ef6215df1acc93f9157b1..ea92b0d62a4ef25e69f8064aec1c48ad18448fe9 100755 (executable)
--- a/check
+++ b/check
@@ -1048,8 +1048,8 @@ function run_section()
 
                if [ $sts -ne 0 ]; then
                        _dump_err_cont "[failed, exit status $sts]"
-                       _test_unmount 2>> $seqres.full
-                       _scratch_unmount 2>> $seqres.full
+                       _test_unmount 2> /dev/null
+                       _scratch_unmount 2> /dev/null
                        rm -f ${RESULT_DIR}/require_test*
                        rm -f ${RESULT_DIR}/require_scratch*
                        # Even though we failed, there may be something interesting in
@@ -1135,6 +1135,12 @@ function run_section()
                _stash_test_status "$seqnum" "$tc_status"
        done
 
+       # Reset these three variables so that unmount output doesn't get
+       # written to $seqres.full of the last test to run.
+       seq="check.$$"
+       check="$RESULT_BASE/check"
+       seqres="$check"
+
        sect_stop=`_wallclock`
        interrupt=false
        _wrapup
index 8688116c6547a9112870047da69666ef88cad775..4dad9b79a27a7f930704c2d13b096c4838ba7f02 100644 (file)
@@ -274,7 +274,7 @@ _choose_prid()
 
 _qmount()
 {
-    _scratch_unmount
+    _scratch_unmount >/dev/null 2>&1
     _try_scratch_mount || _fail "qmount failed"
     # xfs doesn't need these setups and quotacheck even fails on xfs
     # redirect the output to $seqres.full for debug purpose and ignore results
index a8838d29b23a20fc430472247a458779e9bab592..a3d49e861f1f2c8a43c5e235476d26917f25a870 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -479,11 +479,28 @@ _scratch_mount_idmapped()
 }
 
 # Unmount the filesystem based on the directory or device passed.
+# Log everything that happens to seqres.full, and use BASHPID because
+# background subshells have the same $$ as the parent but not the same
+# $BASHPID.
 _unmount()
 {
-       local args="$*"
+       local outlog="$tmp.$BASHPID.umount"
+       local errlog="$tmp.$BASHPID.umount.err"
+
+       rm -f "$outlog" "$errlog"
+       $UMOUNT_PROG "$@" 2> "$errlog" > "$outlog"
+       local res="${PIPESTATUS[0]}"
 
-       $UMOUNT_PROG $args >> $seqres.full 2>&1
+       if [ -s "$outlog" ]; then
+               cat "$outlog" >> $seqres.full
+               cat "$outlog"
+       fi
+       if [ -s "$errlog" ]; then
+               cat "$errlog" >> $seqres.full
+               >&2 cat "$errlog"
+       fi
+       rm -f "$outlog" "$errlog"
+       return $res
 }
 
 _scratch_unmount()
index 8e9456db27900317fa24379508012c039817d953..affb072df5969f3da1cc55f54864088a379f2df9 100755 (executable)
@@ -89,7 +89,7 @@ _try_scratch_mount 2>&1 | _filter_ro_mount | _filter_scratch
 
 # expects an error, so open code the unmount
 echo "unmounting read-only filesystem"
-$UMOUNT_PROG $SCRATCH_DEV 2>&1 | _filter_scratch | _filter_ending_dot
+_scratch_unmount 2>&1 | _filter_scratch | _filter_ending_dot
 
 #
 # This is the way out if the underlying device really is read-only.
index 7671a36ab9524fe79bc8e0260cf6f4e24cf70fe8..d3fa10be9ccaced97081327872db21e854320d75 100755 (executable)
@@ -29,7 +29,7 @@ cleanup_dmdev()
        fi
        # in case it's still suspended and/or mounted
        $DMSETUP_PROG resume $lvdev >> $seqres.full 2>&1
-       _unmount -q $SCRATCH_MNT
+       _unmount -q $SCRATCH_MNT >/dev/null 2>&1
        _dmsetup_remove $node
 }
 
index e2b7984361e87c9df660090e40c503bf73aba15e..b584af475400204a5e78f6ed5a515fd117d518d8 100755 (executable)
@@ -16,7 +16,7 @@ _begin_fstest auto quick
 # Override the default cleanup function.
 _cleanup()
 {
-       _unmount $fs_mnt
+       _unmount $fs_mnt &>> /dev/null
        [ -n "$loop_dev" ] && _destroy_loop_device $loop_dev
        cd /
        rm -f $tmp.*
@@ -54,7 +54,7 @@ $XFS_IO_PROG -fc "pwrite 0 520m" $fs_mnt/testfile >>$seqres.full 2>&1
 # remount should not hang
 $MOUNT_PROG -o remount,ro $fs_mnt >>$seqres.full 2>&1
 
-_unmount $fs_mnt
+_unmount $fs_mnt &>/dev/null
 _destroy_loop_device $loop_dev
 unset loop_dev
 
index 1adeef4c2ad52c82c0b4299ba10d34fcf372b6c2..ba1337a856f15df6731f84c51e85dd4f5165f91e 100755 (executable)
@@ -15,7 +15,7 @@ _begin_fstest auto prealloc preallocrw
 # Override the default cleanup function.
 _cleanup()
 {
-       _scratch_unmount
+       _scratch_unmount &>/dev/null
        [ -n "$loop_dev" ] && _destroy_loop_device $loop_dev
        cd /
        rm -f $tmp.*
index ba8ed25e84577652823e0a3841b4e73a98788fa9..6f02b1cc35478219244093693c9bfa8297215362 100755 (executable)
@@ -223,7 +223,7 @@ while read line; do
 done < $fiemap_after
 echo "done."
 
-_unmount $loop_mnt
+_unmount $loop_mnt &>/dev/null
 _destroy_loop_device $loop_dev
 unset loop_dev
 
index 9a96f82ede17610c46359a82439f9c09f3725cb0..28dfc7f04c17732d73e0c928e9cb4a5fc443a66c 100755 (executable)
@@ -22,7 +22,7 @@ loop_symlink=$TEST_DIR/loop_symlink.$$
 # Override the default cleanup function.
 _cleanup()
 {
-    _unmount $mntdir
+    _unmount $mntdir &>/dev/null
     [ -n "$loop_dev" ] && _destroy_loop_device $loop_dev
     rmdir $mntdir
     rm -f $loop_symlink
index d0d0e2665070f821f2f1a174c89e082aa6b10b47..95ab32f1e1f828ef5d012ab6db97af5094aca61d 100755 (executable)
@@ -116,7 +116,7 @@ done
 echo "Check filesystem"
 _check_scratch_fs
 
-_scratch_unmount
+_scratch_unmount &> /dev/null
 _destroy_loop_device $rt_loop_dev
 unset rt_loop_dev