diff mbox series

[v2,4/6] ext4/021: check _scratch_mkfs_sized return code

Message ID 20220209123305.253038-5-shinichiro.kawasaki@wdc.com (mailing list archive)
State New, archived
Headers show
Series fstests: fix _scratch_mkfs_sized failure handling | expand

Commit Message

Shinichiro Kawasaki Feb. 9, 2022, 12:33 p.m. UTC
The test cases ext4/021 calls _scratch_mkfs before _scratch_mkfs_sized,
and does not check return code of _scratch_mkfs_sized. Even if
_scratch_mkfs_sized failed, _scratch_mount after it cannot detect the
sized mkfs failure because _scratch_mkfs already created a file system
on the device. This results in unexpected test condition.

To avoid the unexpected test condition, check return code of
_scratch_mkfs_sized.

Suggested-by: Naohiro Aota <naohiro.aota@wdc.com>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
---
 tests/ext4/021 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Darrick J. Wong Feb. 9, 2022, 10:32 p.m. UTC | #1
On Wed, Feb 09, 2022 at 09:33:03PM +0900, Shin'ichiro Kawasaki wrote:
> The test cases ext4/021 calls _scratch_mkfs before _scratch_mkfs_sized,
> and does not check return code of _scratch_mkfs_sized. Even if
> _scratch_mkfs_sized failed, _scratch_mount after it cannot detect the
> sized mkfs failure because _scratch_mkfs already created a file system
> on the device. This results in unexpected test condition.
> 
> To avoid the unexpected test condition, check return code of
> _scratch_mkfs_sized.
> 
> Suggested-by: Naohiro Aota <naohiro.aota@wdc.com>
> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>

LGTM
Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

> ---
>  tests/ext4/021 | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tests/ext4/021 b/tests/ext4/021
> index 62768c60..a9277abf 100755
> --- a/tests/ext4/021
> +++ b/tests/ext4/021
> @@ -24,7 +24,7 @@ _scratch_unmount
>  
>  # With 4k block size, this amounts to 10M FS instance.
>  fssize=$((2560 * $blocksize))
> -_scratch_mkfs_sized $fssize >> $seqres.full 2>&1
> +_scratch_mkfs_sized $fssize >> $seqres.full 2>&1 || _fail "mkfs failed"
>  _require_metadata_journaling $SCRATCH_DEV
>  
>  offset=0
> -- 
> 2.34.1
>
diff mbox series

Patch

diff --git a/tests/ext4/021 b/tests/ext4/021
index 62768c60..a9277abf 100755
--- a/tests/ext4/021
+++ b/tests/ext4/021
@@ -24,7 +24,7 @@  _scratch_unmount
 
 # With 4k block size, this amounts to 10M FS instance.
 fssize=$((2560 * $blocksize))
-_scratch_mkfs_sized $fssize >> $seqres.full 2>&1
+_scratch_mkfs_sized $fssize >> $seqres.full 2>&1 || _fail "mkfs failed"
 _require_metadata_journaling $SCRATCH_DEV
 
 offset=0