btrfs: redirect 'btrfs device add' output to seqres.full
authorJosef Bacik <josef@toxicpanda.com>
Thu, 18 Nov 2021 14:53:20 +0000 (09:53 -0500)
committerEryu Guan <guaneryu@gmail.com>
Sun, 21 Nov 2021 14:48:10 +0000 (22:48 +0800)
I updated btrfs-progs on all my test runners and started failing tests
because I was getting the TRIM messages in the golden output.  There
were fixes that went in recently to properly detect TRIM support which
resulted in extra messages being printed.  Fix this by redirecting
stdout to $seqres.full for all 'btrfs device add' calls.  If anything
fails we'll still pollute the output, but normal status messages will
get properly eaten.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
12 files changed:
tests/btrfs/161
tests/btrfs/162
tests/btrfs/163
tests/btrfs/164
tests/btrfs/175
tests/btrfs/176
tests/btrfs/194
tests/btrfs/197
tests/btrfs/216
tests/btrfs/218
tests/btrfs/225
tests/btrfs/238

index 059b95cab843ed0b135dcf2fce3c19cdaeab4c44..ed5b67fac37e013e5ddb355fcdccf5add927878b 100755 (executable)
@@ -42,7 +42,8 @@ create_seed()
 
 create_sprout()
 {
-       _run_btrfs_util_prog device add -f $dev_sprout $SCRATCH_MNT
+       _run_btrfs_util_prog device add -f $dev_sprout $SCRATCH_MNT >> \
+               $seqres.full
        _scratch_unmount
        run_check _mount $dev_sprout $SCRATCH_MNT
        echo -- sprout --
index ba37ef0c9df7880d9b4f0be1b7205c30ade909a5..7680e1e4392eb3bca5629dd5a46f8a299ee3615e 100755 (executable)
@@ -45,7 +45,8 @@ create_seed()
 create_sprout_seed()
 {
        run_check _mount $dev_seed $SCRATCH_MNT
-       _run_btrfs_util_prog device add -f $dev_sprout_seed $SCRATCH_MNT
+       _run_btrfs_util_prog device add -f $dev_sprout_seed $SCRATCH_MNT >>\
+               $seqres.full
        _scratch_unmount
        $BTRFS_TUNE_PROG -S 1 $dev_sprout_seed
 }
@@ -53,7 +54,8 @@ create_sprout_seed()
 create_next_sprout()
 {
        run_check _mount $dev_sprout_seed $SCRATCH_MNT
-       _run_btrfs_util_prog device add -f $dev_sprout $SCRATCH_MNT
+       _run_btrfs_util_prog device add -f $dev_sprout $SCRATCH_MNT >>\
+               $seqres.full
        _scratch_unmount
        run_check _mount $dev_sprout $SCRATCH_MNT
        echo -- sprout --
index 1dc081f1d9e1d97f1b4618c61b1fc7200aba9e3e..59f0461b626ac19a6992f406b761fd91b94ca678 100755 (executable)
@@ -58,7 +58,8 @@ create_seed()
 
 add_sprout()
 {
-       _run_btrfs_util_prog device add -f $dev_sprout $SCRATCH_MNT
+       _run_btrfs_util_prog device add -f $dev_sprout $SCRATCH_MNT >>\
+               $seqres.full
        _run_btrfs_util_prog filesystem show -m $SCRATCH_MNT
        _mount -o remount,rw $dev_sprout $SCRATCH_MNT
        $XFS_IO_PROG -f -c "pwrite -S 0xcd 0 4M" $SCRATCH_MNT/foobar2 >\
index 3e69b35fb641b4dc0c8c6c082f4ffaf50028c9fd..8fd6ab626cfd6862f33f4cfccfc19da4fe50401d 100755 (executable)
@@ -48,7 +48,8 @@ create_seed()
 
 add_sprout()
 {
-       _run_btrfs_util_prog device add -f $dev_sprout $SCRATCH_MNT
+       _run_btrfs_util_prog device add -f $dev_sprout $SCRATCH_MNT >>\
+               $seqres.full
        run_check mount -o rw,remount $dev_seed $SCRATCH_MNT
        _run_btrfs_util_prog filesystem show -m $SCRATCH_MNT
 }
index 6f7832a5602f40827951b56dfcc5aba53a2ad7ce..dc6c19217254bfff26b6105a9e1fbbcf275866f7 100755 (executable)
@@ -49,7 +49,7 @@ _scratch_mount
 # device.
 _format_swapfile "$SCRATCH_MNT/swap" $(($(get_page_size) * 10)) > /dev/null
 scratch_dev2="$(echo "${SCRATCH_DEV_POOL}" | awk '{ print $2 }')"
-$BTRFS_UTIL_PROG device add -f "$scratch_dev2" "$SCRATCH_MNT"
+$BTRFS_UTIL_PROG device add -f "$scratch_dev2" "$SCRATCH_MNT" >> $seqres.full
 swapon "$SCRATCH_MNT/swap" 2>&1 | _filter_scratch
 swapoff "$SCRATCH_MNT/swap" > /dev/null 2>&1
 
index 8d624d5a8e1414376f09cc92f0446c1f749609b4..9a833575b1bc54b3dad414f0d90ed17f2bf92bdf 100755 (executable)
@@ -30,14 +30,14 @@ echo "Remove device"
 _scratch_mkfs >> $seqres.full 2>&1
 _scratch_mount
 _format_swapfile "$SCRATCH_MNT/swap" $(($(get_page_size) * 10)) > /dev/null
-$BTRFS_UTIL_PROG device add -f "$scratch_dev2" "$SCRATCH_MNT"
+$BTRFS_UTIL_PROG device add -f "$scratch_dev2" "$SCRATCH_MNT" >> $seqres.full
 swapon "$SCRATCH_MNT/swap" 2>&1 | _filter_scratch
 # We know the swap file is on device 1 because we added device 2 after it was
 # already created.
 $BTRFS_UTIL_PROG device delete "$scratch_dev1" "$SCRATCH_MNT" 2>&1 | grep -o "Text file busy"
 # Deleting/readding device 2 should still work.
 $BTRFS_UTIL_PROG device delete "$scratch_dev2" "$SCRATCH_MNT"
-$BTRFS_UTIL_PROG device add -f "$scratch_dev2" "$SCRATCH_MNT"
+$BTRFS_UTIL_PROG device add -f "$scratch_dev2" "$SCRATCH_MNT" >> $seqres.full
 swapoff "$SCRATCH_MNT/swap" > /dev/null 2>&1
 # Deleting device 1 should work again after swapoff.
 $BTRFS_UTIL_PROG device delete "$scratch_dev1" "$SCRATCH_MNT"
@@ -48,7 +48,7 @@ echo "Replace device"
 _scratch_mkfs >> $seqres.full 2>&1
 _scratch_mount
 _format_swapfile "$SCRATCH_MNT/swap" $(($(get_page_size) * 10))
-$BTRFS_UTIL_PROG device add -f "$scratch_dev2" "$SCRATCH_MNT"
+$BTRFS_UTIL_PROG device add -f "$scratch_dev2" "$SCRATCH_MNT" >> $seqres.full
 swapon "$SCRATCH_MNT/swap" 2>&1 | _filter_scratch
 # Again, we know the swap file is on device 1.
 $BTRFS_UTIL_PROG replace start -fB "$scratch_dev1" "$scratch_dev3" "$SCRATCH_MNT" 2>&1 | grep -o "Text file busy"
index a994a429628bd8a368845dcf2568da32c9193db3..2431692b9f844570a30cbaa8531a44fbd03b7f9c 100755 (executable)
@@ -55,9 +55,9 @@ _scratch_mount
 # Add and remove device in a loop, each iteration will increase devid by 2.
 # So by 64 iterations, we will definitely hit that 122 limit.
 for (( i = 0; i < 64; i++ )); do
-       $BTRFS_UTIL_PROG device add -f $device_2 $SCRATCH_MNT
+       $BTRFS_UTIL_PROG device add -f $device_2 $SCRATCH_MNT >> $seqres.full
        $BTRFS_UTIL_PROG device del $device_1 $SCRATCH_MNT
-       $BTRFS_UTIL_PROG device add -f $device_1 $SCRATCH_MNT
+       $BTRFS_UTIL_PROG device add -f $device_1 $SCRATCH_MNT >> $seqres.full
        $BTRFS_UTIL_PROG device del $device_2 $SCRATCH_MNT
 done | grep -v 'Resetting device zone'
 _scratch_dev_pool_put
index 597bc36f0fd7fdf080252b2e7583a53b0208a202..22b37b4b2505b010181da5faec3e7680aecfc1ec 100755 (executable)
@@ -55,7 +55,8 @@ workout()
        # don't test with the first device as auto fs check (_check_scratch_fs)
        # picks the first device
        device_1=$(echo $SCRATCH_DEV_POOL | awk '{print $2}')
-       $BTRFS_UTIL_PROG device add -f "$device_1" "$TEST_DIR/$seq.mnt"
+       $BTRFS_UTIL_PROG device add -f "$device_1" "$TEST_DIR/$seq.mnt" >> \
+               $seqres.full
 
        device_2=$(echo $SCRATCH_DEV_POOL | awk '{print $1}')
        _mount -o degraded $device_2 $SCRATCH_MNT
index 38efa0f5f30d288e65c2204757b4d6cec29fba0c..5d6cf902c9d125c1efc6899c17f68fcff0228edc 100755 (executable)
@@ -28,7 +28,7 @@ _mkfs_dev $seed
 $BTRFS_TUNE_PROG -S 1 $seed
 _mount $seed $SCRATCH_MNT >> $seqres.full 2>&1
 cat /proc/self/mounts | grep $seed >> $seqres.full
-$BTRFS_UTIL_PROG device add -f $sprout $SCRATCH_MNT
+$BTRFS_UTIL_PROG device add -f $sprout $SCRATCH_MNT >> $seqres.full
 cat /proc/self/mounts | grep $sprout >> $seqres.full
 
 # check if the show_devname() returns the sprout device instead of seed device.
index 5af54f3b2c0228c96e311410426b53a50c2c8ea3..83ec785ee2a06938fa2c94a3bd0e4d308743b67a 100755 (executable)
@@ -41,7 +41,7 @@ $BTRFS_TUNE_PROG -S 1 $dev_seed
 
 # Mount the seed device and add the rw device
 _mount -o ro $dev_seed $SCRATCH_MNT
-_run_btrfs_util_prog device add -f $dev_sprout $SCRATCH_MNT
+_run_btrfs_util_prog device add -f $dev_sprout $SCRATCH_MNT >> $seqres.full
 $BTRFS_UTIL_PROG device stats $SCRATCH_MNT | _filter_scratch_pool
 _scratch_unmount
 
index 408c03d2074c4047c6cabc06bddd61d0267ffebc..cfb64a342644e4090aa2df87e966f841323ce963 100755 (executable)
@@ -48,7 +48,7 @@ $BTRFS_TUNE_PROG -S 1 $seed
 
 # Mount the seed device and add the rw device
 _mount -o ro $seed $SCRATCH_MNT
-$BTRFS_UTIL_PROG device add -f $sprout $SCRATCH_MNT
+$BTRFS_UTIL_PROG device add -f $sprout $SCRATCH_MNT >> $seqres.full
 _scratch_unmount
 
 # Now remount
index 2622f353b5b4fdcaa29dbb8d5bb38f123bc4b9cd..57245917e16a7d42f748d68552bc56e52262677a 100755 (executable)
@@ -38,7 +38,7 @@ $BTRFS_TUNE_PROG -S 1 $seed
 _mount $seed $SCRATCH_MNT 2>&1 | _filter_ro_mount | _filter_scratch
 md5sum $SCRATCH_MNT/foo | _filter_scratch
 
-$BTRFS_UTIL_PROG device add -f $sprout $SCRATCH_MNT
+$BTRFS_UTIL_PROG device add -f $sprout $SCRATCH_MNT >> $seqres.full
 _scratch_unmount
 
 # Now remount writeable sprout device, create some data and run fstrim