[PATCH] btrfs/298: fix failure when added device supports trim

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



From: Filipe Manana <fdmanana@xxxxxxxx>

A btrfs device add command issues a trim on the device if the device
supports trim, and then it outputs a message to stdout informing that it
performed a trim. If that happens it breaks the golden output and the
test fails like this:

   $ ./check btrfs/298
   FSTYP         -- btrfs
   PLATFORM      -- Linux/x86_64 debian0 6.6.0-rc3-btrfs-next-139+ #1 SMP PREEMPT_DYNAMIC Tue Oct  3 13:52:02 WEST 2023
   MKFS_OPTIONS  -- /dev/sdc
   MOUNT_OPTIONS -- /dev/sdc /home/fdmanana/btrfs-tests/scratch_1

   btrfs/298       - output mismatch (see /home/fdmanana/git/hub/xfstests/results//btrfs/298.out.bad)
       --- tests/btrfs/298.out	2023-10-18 23:29:06.029292800 +0100
       +++ /home/fdmanana/git/hub/xfstests/results//btrfs/298.out.bad	2023-10-19 10:54:29.693210881 +0100
       @@ -1,2 +1,3 @@
        QA output created by 298
       +Performing full device TRIM /dev/sdd (100.00GiB) ...
        Silence is golden
       ...
       (Run 'diff -u /home/fdmanana/git/hub/xfstests/tests/btrfs/298.out /home/fdmanana/git/hub/xfstests/results//btrfs/298.out.bad'  to see the entire diff)
   Ran: btrfs/298
   Failures: btrfs/298
   Failed 1 of 1 tests

Fix this by redirecting the device add's stdout to the $seqres.full file.
Any device add errors are sent to stderr, so we'll notice if errors happen
due to possible future regressions, as it will break the golden output.

Signed-off-by: Filipe Manana <fdmanana@xxxxxxxx>
---
 tests/btrfs/298 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/btrfs/298 b/tests/btrfs/298
index d5536cf3..0cea81d0 100755
--- a/tests/btrfs/298
+++ b/tests/btrfs/298
@@ -25,7 +25,7 @@ _scratch_mkfs "-b 300M" >> $seqres.full 2>&1 || \
 	_fail "Fail to make SCRATCH_DEV with -b 300M"
 $BTRFS_TUNE_PROG -S 1 $SCRATCH_DEV
 _scratch_mount >> $seqres.full 2>&1
-$BTRFS_UTIL_PROG device add $SPARE_DEV $SCRATCH_MNT
+$BTRFS_UTIL_PROG device add $SPARE_DEV $SCRATCH_MNT >> $seqres.full
 _scratch_unmount
 $BTRFS_UTIL_PROG device scan --forget
 
-- 
2.40.1




[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