diff mbox series

[4/7] xfs/015: check _scratch_mkfs_sized return code

Message ID 20220207065541.232685-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. 7, 2022, 6:55 a.m. UTC
The test cases xfs/015 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/xfs/015 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Darrick J. Wong Feb. 9, 2022, 12:36 a.m. UTC | #1
On Mon, Feb 07, 2022 at 03:55:38PM +0900, Shin'ichiro Kawasaki wrote:
> The test cases xfs/015 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>

Looks good,
Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

> ---
>  tests/xfs/015 | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tests/xfs/015 b/tests/xfs/015
> index 86fa6336..2bb7b8d5 100755
> --- a/tests/xfs/015
> +++ b/tests/xfs/015
> @@ -43,7 +43,7 @@ _scratch_mount
>  _require_fs_space $SCRATCH_MNT 131072
>  _scratch_unmount
>  
> -_scratch_mkfs_sized $((32 * 1024 * 1024)) > $tmp.mkfs.raw
> +_scratch_mkfs_sized $((32 * 1024 * 1024)) > $tmp.mkfs.raw || _fail "mkfs failed"
>  cat $tmp.mkfs.raw | _filter_mkfs >$seqres.full 2>$tmp.mkfs
>  # get original data blocks number and agcount
>  . $tmp.mkfs
> -- 
> 2.34.1
>
diff mbox series

Patch

diff --git a/tests/xfs/015 b/tests/xfs/015
index 86fa6336..2bb7b8d5 100755
--- a/tests/xfs/015
+++ b/tests/xfs/015
@@ -43,7 +43,7 @@  _scratch_mount
 _require_fs_space $SCRATCH_MNT 131072
 _scratch_unmount
 
-_scratch_mkfs_sized $((32 * 1024 * 1024)) > $tmp.mkfs.raw
+_scratch_mkfs_sized $((32 * 1024 * 1024)) > $tmp.mkfs.raw || _fail "mkfs failed"
 cat $tmp.mkfs.raw | _filter_mkfs >$seqres.full 2>$tmp.mkfs
 # get original data blocks number and agcount
 . $tmp.mkfs