]> www.infradead.org Git - users/hch/xfstests-dev.git/commitdiff
btrfs/298: fix failure when added device supports trim
authorFilipe Manana <fdmanana@suse.com>
Thu, 19 Oct 2023 10:06:14 +0000 (11:06 +0100)
committerZorro Lang <zlang@kernel.org>
Sun, 22 Oct 2023 06:45:42 +0000 (14:45 +0800)
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@suse.com>
Reviewed-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
tests/btrfs/298

index d5536cf3eddd1a6c41f7cadc6b68ea682c9a0ba3..0cea81d099d8c88daaff14c1dc82653dff20546f 100755 (executable)
@@ -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