diff mbox series

fstests: remove unnecessary stdout/stderr redirection for run_check calls

Message ID 742c2d98a000e324106a9f5bd3498f2985bb2706.1722441541.git.fdmanana@suse.com (mailing list archive)
State New, archived
Headers show
Series fstests: remove unnecessary stdout/stderr redirection for run_check calls | expand

Commit Message

Filipe Manana July 31, 2024, 3:59 p.m. UTC
From: Filipe Manana <fdmanana@suse.com>

It's pointless, and confusing, to have calls to run_check redirect the
stdout and/or stderr, because run_check already redirects it:

   $ cat common/rc
   (...)
   run_check()
   {
       echo "# $@" >> $seqres.full 2>&1
       "$@" >> $seqres.full 2>&1 || _fail "failed: '$@'"
   }
   (...)

So remove those redirections.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
---
 tests/btrfs/004   | 4 ++--
 tests/btrfs/030   | 4 ++--
 tests/btrfs/038   | 6 +++---
 tests/btrfs/039   | 4 ++--
 tests/btrfs/040   | 4 ++--
 tests/btrfs/057   | 6 ++----
 tests/btrfs/284   | 2 +-
 tests/generic/482 | 2 +-
 8 files changed, 15 insertions(+), 17 deletions(-)

Comments

Qu Wenruo July 31, 2024, 11:30 p.m. UTC | #1
在 2024/8/1 01:29, fdmanana@kernel.org 写道:
> From: Filipe Manana <fdmanana@suse.com>
>
> It's pointless, and confusing, to have calls to run_check redirect the
> stdout and/or stderr, because run_check already redirects it:
>
>     $ cat common/rc
>     (...)
>     run_check()
>     {
>         echo "# $@" >> $seqres.full 2>&1
>         "$@" >> $seqres.full 2>&1 || _fail "failed: '$@'"
>     }
>     (...)
>
> So remove those redirections.
>
> Signed-off-by: Filipe Manana <fdmanana@suse.com>

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

Thanks,
Qu

> ---
>   tests/btrfs/004   | 4 ++--
>   tests/btrfs/030   | 4 ++--
>   tests/btrfs/038   | 6 +++---
>   tests/btrfs/039   | 4 ++--
>   tests/btrfs/040   | 4 ++--
>   tests/btrfs/057   | 6 ++----
>   tests/btrfs/284   | 2 +-
>   tests/generic/482 | 2 +-
>   8 files changed, 15 insertions(+), 17 deletions(-)
>
> diff --git a/tests/btrfs/004 b/tests/btrfs/004
> index e89697d2..5a2ce993 100755
> --- a/tests/btrfs/004
> +++ b/tests/btrfs/004
> @@ -165,7 +165,7 @@ workout()
>   	_btrfs subvolume snapshot $SCRATCH_MNT \
>   		$SCRATCH_MNT/$snap_name
>
> -	run_check _scratch_unmount >/dev/null 2>&1
> +	run_check _scratch_unmount
>   	_scratch_mount "-o compress=lzo"
>
>   	# make some noise but ensure we're not touching existing data
> @@ -179,7 +179,7 @@ workout()
>   	# now make more files to get a higher tree
>   	run_check $FSSTRESS_PROG -d $clean_dir -w -p $procs -n 2000 \
>   		$FSSTRESS_AVOID
> -	run_check _scratch_unmount >/dev/null 2>&1
> +	run_check _scratch_unmount
>   	_scratch_mount "-o atime"
>
>   	if [ $do_bg_noise -ne 0 ]; then
> diff --git a/tests/btrfs/030 b/tests/btrfs/030
> index bedbb728..0c84000a 100755
> --- a/tests/btrfs/030
> +++ b/tests/btrfs/030
> @@ -150,10 +150,10 @@ _scratch_mkfs >/dev/null 2>&1
>   _scratch_mount
>
>   _btrfs receive -f $tmp/1.snap $SCRATCH_MNT
> -run_check $FSSUM_PROG -r $tmp/1.fssum $SCRATCH_MNT/mysnap1 2>> $seqres.full
> +run_check $FSSUM_PROG -r $tmp/1.fssum $SCRATCH_MNT/mysnap1
>
>   _btrfs receive -f $tmp/2.snap $SCRATCH_MNT
> -run_check $FSSUM_PROG -r $tmp/2.fssum $SCRATCH_MNT/mysnap2 2>> $seqres.full
> +run_check $FSSUM_PROG -r $tmp/2.fssum $SCRATCH_MNT/mysnap2
>
>   _scratch_unmount
>   _check_btrfs_filesystem $SCRATCH_DEV
> diff --git a/tests/btrfs/038 b/tests/btrfs/038
> index bdef4f41..1e6defa9 100755
> --- a/tests/btrfs/038
> +++ b/tests/btrfs/038
> @@ -76,13 +76,13 @@ _scratch_mkfs >/dev/null 2>&1
>   _scratch_mount
>
>   _btrfs receive -f $tmp/1.snap $SCRATCH_MNT
> -run_check $FSSUM_PROG -r $tmp/1.fssum $SCRATCH_MNT/mysnap1 2>> $seqres.full
> +run_check $FSSUM_PROG -r $tmp/1.fssum $SCRATCH_MNT/mysnap1
>
>   _btrfs receive -f $tmp/clones.snap $SCRATCH_MNT
> -run_check $FSSUM_PROG -r $tmp/clones.fssum $SCRATCH_MNT/clones_snap 2>> $seqres.full
> +run_check $FSSUM_PROG -r $tmp/clones.fssum $SCRATCH_MNT/clones_snap
>
>   _btrfs receive -f $tmp/2.snap $SCRATCH_MNT
> -run_check $FSSUM_PROG -r $tmp/2.fssum $SCRATCH_MNT/mysnap2 2>> $seqres.full
> +run_check $FSSUM_PROG -r $tmp/2.fssum $SCRATCH_MNT/mysnap2
>
>   _scratch_unmount
>   _check_btrfs_filesystem $SCRATCH_DEV
> diff --git a/tests/btrfs/039 b/tests/btrfs/039
> index e7cea325..2306ffe0 100755
> --- a/tests/btrfs/039
> +++ b/tests/btrfs/039
> @@ -91,10 +91,10 @@ _scratch_mkfs >/dev/null 2>&1
>   _scratch_mount
>
>   _btrfs receive -f $tmp/1.snap $SCRATCH_MNT
> -run_check $FSSUM_PROG -r $tmp/1.fssum $SCRATCH_MNT/mysnap1 2>> $seqres.full
> +run_check $FSSUM_PROG -r $tmp/1.fssum $SCRATCH_MNT/mysnap1
>
>   _btrfs receive -f $tmp/2.snap $SCRATCH_MNT
> -run_check $FSSUM_PROG -r $tmp/2.fssum $SCRATCH_MNT/mysnap2 2>> $seqres.full
> +run_check $FSSUM_PROG -r $tmp/2.fssum $SCRATCH_MNT/mysnap2
>
>   _scratch_unmount
>   _check_btrfs_filesystem $SCRATCH_DEV
> diff --git a/tests/btrfs/040 b/tests/btrfs/040
> index 5d346be3..4fc4db44 100755
> --- a/tests/btrfs/040
> +++ b/tests/btrfs/040
> @@ -84,10 +84,10 @@ _scratch_mkfs >/dev/null 2>&1
>   _scratch_mount
>
>   _btrfs receive -f $tmp/1.snap $SCRATCH_MNT
> -run_check $FSSUM_PROG -r $tmp/1.fssum $SCRATCH_MNT/mysnap1 2>> $seqres.full
> +run_check $FSSUM_PROG -r $tmp/1.fssum $SCRATCH_MNT/mysnap1
>
>   _btrfs receive -f $tmp/2.snap $SCRATCH_MNT
> -run_check $FSSUM_PROG -r $tmp/2.fssum $SCRATCH_MNT/mysnap2 2>> $seqres.full
> +run_check $FSSUM_PROG -r $tmp/2.fssum $SCRATCH_MNT/mysnap2
>
>   _scratch_unmount
>   _check_btrfs_filesystem $SCRATCH_DEV
> diff --git a/tests/btrfs/057 b/tests/btrfs/057
> index 07e60557..6c399946 100755
> --- a/tests/btrfs/057
> +++ b/tests/btrfs/057
> @@ -19,14 +19,12 @@ _scratch_mkfs_sized $((1024 * 1024 * 1024)) >> $seqres.full 2>&1
>   _scratch_mount
>
>   # -w ensures that the only ops are ones which cause write I/O
> -run_check $FSSTRESS_PROG -d $SCRATCH_MNT -w -p 5 -n 1000 \
> -		$FSSTRESS_AVOID >&/dev/null
> +run_check $FSSTRESS_PROG -d $SCRATCH_MNT -w -p 5 -n 1000 $FSSTRESS_AVOID
>
>   _btrfs subvolume snapshot $SCRATCH_MNT \
>   	$SCRATCH_MNT/snap1
>
> -run_check $FSSTRESS_PROG -d $SCRATCH_MNT/snap1 -w -p 5 -n 1000 \
> -       $FSSTRESS_AVOID >&/dev/null
> +run_check $FSSTRESS_PROG -d $SCRATCH_MNT/snap1 -w -p 5 -n 1000 $FSSTRESS_AVOID
>
>   _btrfs quota enable $SCRATCH_MNT
>   _btrfs quota rescan -w $SCRATCH_MNT
> diff --git a/tests/btrfs/284 b/tests/btrfs/284
> index 19ffbbe6..6c554f32 100755
> --- a/tests/btrfs/284
> +++ b/tests/btrfs/284
> @@ -50,7 +50,7 @@ run_send_test()
>   	# Use a single process so that in case of failure it's easier to
>   	# reproduce by using the same seed (logged in $seqres.full).
>   	run_check $FSSTRESS_PROG -d $SCRATCH_MNT -p 1 -n $((LOAD_FACTOR * 200)) \
> -		  -w $FSSTRESS_AVOID -x "$snapshot_cmd" >> $seqres.full
> +		  -w $FSSTRESS_AVOID -x "$snapshot_cmd"
>
>   	$BTRFS_UTIL_PROG subvolume snapshot -r $SCRATCH_MNT $SCRATCH_MNT/snap2 \
>   			 >> $seqres.full
> diff --git a/tests/generic/482 b/tests/generic/482
> index 04026c4c..54fee07d 100755
> --- a/tests/generic/482
> +++ b/tests/generic/482
> @@ -77,7 +77,7 @@ _log_writes_mkfs >> $seqres.full 2>&1
>   _log_writes_mark mkfs
>
>   _log_writes_mount
> -run_check $FSSTRESS_PROG $fsstress_args > /dev/null 2>&1
> +run_check $FSSTRESS_PROG $fsstress_args
>   _log_writes_unmount
>
>   _log_writes_remove
diff mbox series

Patch

diff --git a/tests/btrfs/004 b/tests/btrfs/004
index e89697d2..5a2ce993 100755
--- a/tests/btrfs/004
+++ b/tests/btrfs/004
@@ -165,7 +165,7 @@  workout()
 	_btrfs subvolume snapshot $SCRATCH_MNT \
 		$SCRATCH_MNT/$snap_name
 
-	run_check _scratch_unmount >/dev/null 2>&1
+	run_check _scratch_unmount
 	_scratch_mount "-o compress=lzo"
 
 	# make some noise but ensure we're not touching existing data
@@ -179,7 +179,7 @@  workout()
 	# now make more files to get a higher tree
 	run_check $FSSTRESS_PROG -d $clean_dir -w -p $procs -n 2000 \
 		$FSSTRESS_AVOID
-	run_check _scratch_unmount >/dev/null 2>&1
+	run_check _scratch_unmount
 	_scratch_mount "-o atime"
 
 	if [ $do_bg_noise -ne 0 ]; then
diff --git a/tests/btrfs/030 b/tests/btrfs/030
index bedbb728..0c84000a 100755
--- a/tests/btrfs/030
+++ b/tests/btrfs/030
@@ -150,10 +150,10 @@  _scratch_mkfs >/dev/null 2>&1
 _scratch_mount
 
 _btrfs receive -f $tmp/1.snap $SCRATCH_MNT
-run_check $FSSUM_PROG -r $tmp/1.fssum $SCRATCH_MNT/mysnap1 2>> $seqres.full
+run_check $FSSUM_PROG -r $tmp/1.fssum $SCRATCH_MNT/mysnap1
 
 _btrfs receive -f $tmp/2.snap $SCRATCH_MNT
-run_check $FSSUM_PROG -r $tmp/2.fssum $SCRATCH_MNT/mysnap2 2>> $seqres.full
+run_check $FSSUM_PROG -r $tmp/2.fssum $SCRATCH_MNT/mysnap2
 
 _scratch_unmount
 _check_btrfs_filesystem $SCRATCH_DEV
diff --git a/tests/btrfs/038 b/tests/btrfs/038
index bdef4f41..1e6defa9 100755
--- a/tests/btrfs/038
+++ b/tests/btrfs/038
@@ -76,13 +76,13 @@  _scratch_mkfs >/dev/null 2>&1
 _scratch_mount
 
 _btrfs receive -f $tmp/1.snap $SCRATCH_MNT
-run_check $FSSUM_PROG -r $tmp/1.fssum $SCRATCH_MNT/mysnap1 2>> $seqres.full
+run_check $FSSUM_PROG -r $tmp/1.fssum $SCRATCH_MNT/mysnap1
 
 _btrfs receive -f $tmp/clones.snap $SCRATCH_MNT
-run_check $FSSUM_PROG -r $tmp/clones.fssum $SCRATCH_MNT/clones_snap 2>> $seqres.full
+run_check $FSSUM_PROG -r $tmp/clones.fssum $SCRATCH_MNT/clones_snap
 
 _btrfs receive -f $tmp/2.snap $SCRATCH_MNT
-run_check $FSSUM_PROG -r $tmp/2.fssum $SCRATCH_MNT/mysnap2 2>> $seqres.full
+run_check $FSSUM_PROG -r $tmp/2.fssum $SCRATCH_MNT/mysnap2
 
 _scratch_unmount
 _check_btrfs_filesystem $SCRATCH_DEV
diff --git a/tests/btrfs/039 b/tests/btrfs/039
index e7cea325..2306ffe0 100755
--- a/tests/btrfs/039
+++ b/tests/btrfs/039
@@ -91,10 +91,10 @@  _scratch_mkfs >/dev/null 2>&1
 _scratch_mount
 
 _btrfs receive -f $tmp/1.snap $SCRATCH_MNT
-run_check $FSSUM_PROG -r $tmp/1.fssum $SCRATCH_MNT/mysnap1 2>> $seqres.full
+run_check $FSSUM_PROG -r $tmp/1.fssum $SCRATCH_MNT/mysnap1
 
 _btrfs receive -f $tmp/2.snap $SCRATCH_MNT
-run_check $FSSUM_PROG -r $tmp/2.fssum $SCRATCH_MNT/mysnap2 2>> $seqres.full
+run_check $FSSUM_PROG -r $tmp/2.fssum $SCRATCH_MNT/mysnap2
 
 _scratch_unmount
 _check_btrfs_filesystem $SCRATCH_DEV
diff --git a/tests/btrfs/040 b/tests/btrfs/040
index 5d346be3..4fc4db44 100755
--- a/tests/btrfs/040
+++ b/tests/btrfs/040
@@ -84,10 +84,10 @@  _scratch_mkfs >/dev/null 2>&1
 _scratch_mount
 
 _btrfs receive -f $tmp/1.snap $SCRATCH_MNT
-run_check $FSSUM_PROG -r $tmp/1.fssum $SCRATCH_MNT/mysnap1 2>> $seqres.full
+run_check $FSSUM_PROG -r $tmp/1.fssum $SCRATCH_MNT/mysnap1
 
 _btrfs receive -f $tmp/2.snap $SCRATCH_MNT
-run_check $FSSUM_PROG -r $tmp/2.fssum $SCRATCH_MNT/mysnap2 2>> $seqres.full
+run_check $FSSUM_PROG -r $tmp/2.fssum $SCRATCH_MNT/mysnap2
 
 _scratch_unmount
 _check_btrfs_filesystem $SCRATCH_DEV
diff --git a/tests/btrfs/057 b/tests/btrfs/057
index 07e60557..6c399946 100755
--- a/tests/btrfs/057
+++ b/tests/btrfs/057
@@ -19,14 +19,12 @@  _scratch_mkfs_sized $((1024 * 1024 * 1024)) >> $seqres.full 2>&1
 _scratch_mount
 
 # -w ensures that the only ops are ones which cause write I/O
-run_check $FSSTRESS_PROG -d $SCRATCH_MNT -w -p 5 -n 1000 \
-		$FSSTRESS_AVOID >&/dev/null
+run_check $FSSTRESS_PROG -d $SCRATCH_MNT -w -p 5 -n 1000 $FSSTRESS_AVOID
 
 _btrfs subvolume snapshot $SCRATCH_MNT \
 	$SCRATCH_MNT/snap1
 
-run_check $FSSTRESS_PROG -d $SCRATCH_MNT/snap1 -w -p 5 -n 1000 \
-       $FSSTRESS_AVOID >&/dev/null
+run_check $FSSTRESS_PROG -d $SCRATCH_MNT/snap1 -w -p 5 -n 1000 $FSSTRESS_AVOID
 
 _btrfs quota enable $SCRATCH_MNT
 _btrfs quota rescan -w $SCRATCH_MNT
diff --git a/tests/btrfs/284 b/tests/btrfs/284
index 19ffbbe6..6c554f32 100755
--- a/tests/btrfs/284
+++ b/tests/btrfs/284
@@ -50,7 +50,7 @@  run_send_test()
 	# Use a single process so that in case of failure it's easier to
 	# reproduce by using the same seed (logged in $seqres.full).
 	run_check $FSSTRESS_PROG -d $SCRATCH_MNT -p 1 -n $((LOAD_FACTOR * 200)) \
-		  -w $FSSTRESS_AVOID -x "$snapshot_cmd" >> $seqres.full
+		  -w $FSSTRESS_AVOID -x "$snapshot_cmd"
 
 	$BTRFS_UTIL_PROG subvolume snapshot -r $SCRATCH_MNT $SCRATCH_MNT/snap2 \
 			 >> $seqres.full
diff --git a/tests/generic/482 b/tests/generic/482
index 04026c4c..54fee07d 100755
--- a/tests/generic/482
+++ b/tests/generic/482
@@ -77,7 +77,7 @@  _log_writes_mkfs >> $seqres.full 2>&1
 _log_writes_mark mkfs
 
 _log_writes_mount
-run_check $FSSTRESS_PROG $fsstress_args > /dev/null 2>&1
+run_check $FSSTRESS_PROG $fsstress_args
 _log_writes_unmount
 
 _log_writes_remove