diff mbox series

btrfs/298: fix failure when added device supports trim

Message ID ee1d17b6f4956c0638cb7faa6f9c92b7bf3c25ac.1697709904.git.fdmanana@suse.com (mailing list archive)
State New, archived
Headers show
Series btrfs/298: fix failure when added device supports trim | expand

Commit Message

Filipe Manana Oct. 19, 2023, 10:06 a.m. UTC
From: Filipe Manana <fdmanana@suse.com>

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>
---
 tests/btrfs/298 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Zorro Lang Oct. 19, 2023, 6:16 p.m. UTC | #1
On Thu, Oct 19, 2023 at 11:06:14AM +0100, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
> 
> 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>
> ---

Good to me,
Reviewed-by: Zorro Lang <zlang@redhat.com>

>  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
>
Anand Jain Oct. 20, 2023, 12:43 a.m. UTC | #2
LGTM


Reviewed-by: Anand Jain <anand.jain@oracle.com>
diff mbox series

Patch

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