diff mbox series

[v2,3/3] btrfs: fix failure of tests that use defrag on btrfs-progs v6.0+

Message ID e393451cb53b6b81804eaa41c6461b07a910eb62.1668011769.git.fdmanana@suse.com (mailing list archive)
State New, archived
Headers show
Series btrfs: fix some test failures with btrfs-progs 5.19 and 6.0 | expand

Commit Message

Filipe Manana Nov. 9, 2022, 4:44 p.m. UTC
From: Filipe Manana <fdmanana@suse.com>

Starting with btrfs-progs v6.0, the defrag command now prints to stdout
the full path of the files it processes. This makes test cases btrfs/021
and btrfs/256 fail because they don't expect any output from the defrag
command.

The change happened with the following commit in btrfs-progs:

  dd724f21803d ("btrfs-progs: add logic to handle LOG_DEFAULT messages")

So update the tests to ignore the stdout of the defrag command.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
---
 tests/btrfs/021 | 4 +++-
 tests/btrfs/256 | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

Comments

Qu Wenruo Nov. 14, 2022, 11:09 a.m. UTC | #1
On 2022/11/10 00:44, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
> 
> Starting with btrfs-progs v6.0, the defrag command now prints to stdout
> the full path of the files it processes. This makes test cases btrfs/021
> and btrfs/256 fail because they don't expect any output from the defrag
> command.
> 
> The change happened with the following commit in btrfs-progs:
> 
>    dd724f21803d ("btrfs-progs: add logic to handle LOG_DEFAULT messages")
> 
> So update the tests to ignore the stdout of the defrag command.
> 
> Signed-off-by: Filipe Manana <fdmanana@suse.com>

Reviewed-by: Qu Wenruo <wqu@suse.com>

Thanks,
Qu
> ---
>   tests/btrfs/021 | 4 +++-
>   tests/btrfs/256 | 4 +++-
>   2 files changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/btrfs/021 b/tests/btrfs/021
> index 5943da2f..1b55834a 100755
> --- a/tests/btrfs/021
> +++ b/tests/btrfs/021
> @@ -22,8 +22,10 @@ run_test()
>   
>   	sleep 0.5
>   
> +	# In new versions of btrfs-progs (6.0+), the defrag command outputs to
> +	# stdout the path of the files it operates on. So ignore that.
>   	find $SCRATCH_MNT -type f -print0 | xargs -0 \
> -	$BTRFS_UTIL_PROG filesystem defrag -f
> +		$BTRFS_UTIL_PROG filesystem defrag -f > /dev/null
>   
>   	sync
>   	wait
> diff --git a/tests/btrfs/256 b/tests/btrfs/256
> index 1360c2c2..acbbc6fa 100755
> --- a/tests/btrfs/256
> +++ b/tests/btrfs/256
> @@ -50,7 +50,9 @@ $FSSUM_PROG -A -f -w "$checksums_file" "$SCRATCH_MNT"
>   # Now defrag each file.
>   for sz in ${file_sizes[@]}; do
>   	echo "Defragging file with $sz bytes..." >> $seqres.full
> -	$BTRFS_UTIL_PROG filesystem defragment "$SCRATCH_MNT/f_$sz"
> +	# In new versions of btrfs-progs (6.0+), the defrag command outputs to
> +	# stdout the path of the files it operates on. So ignore that.
> +	$BTRFS_UTIL_PROG filesystem defragment "$SCRATCH_MNT/f_$sz" > /dev/null
>   done
>   
>   # Verify the checksums after the defrag operations.
diff mbox series

Patch

diff --git a/tests/btrfs/021 b/tests/btrfs/021
index 5943da2f..1b55834a 100755
--- a/tests/btrfs/021
+++ b/tests/btrfs/021
@@ -22,8 +22,10 @@  run_test()
 
 	sleep 0.5
 
+	# In new versions of btrfs-progs (6.0+), the defrag command outputs to
+	# stdout the path of the files it operates on. So ignore that.
 	find $SCRATCH_MNT -type f -print0 | xargs -0 \
-	$BTRFS_UTIL_PROG filesystem defrag -f
+		$BTRFS_UTIL_PROG filesystem defrag -f > /dev/null
 
 	sync
 	wait
diff --git a/tests/btrfs/256 b/tests/btrfs/256
index 1360c2c2..acbbc6fa 100755
--- a/tests/btrfs/256
+++ b/tests/btrfs/256
@@ -50,7 +50,9 @@  $FSSUM_PROG -A -f -w "$checksums_file" "$SCRATCH_MNT"
 # Now defrag each file.
 for sz in ${file_sizes[@]}; do
 	echo "Defragging file with $sz bytes..." >> $seqres.full
-	$BTRFS_UTIL_PROG filesystem defragment "$SCRATCH_MNT/f_$sz"
+	# In new versions of btrfs-progs (6.0+), the defrag command outputs to
+	# stdout the path of the files it operates on. So ignore that.
+	$BTRFS_UTIL_PROG filesystem defragment "$SCRATCH_MNT/f_$sz" > /dev/null
 done
 
 # Verify the checksums after the defrag operations.