The test cases generic/{171,172,173,174,204} call _scratch_mkfs before
_scratch_mkfs_sized, and they do 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 of the test cases.
To avoid the unexpected test condition, check return code of
_scratch_mkfs_sized in the test cases.
Suggested-by: Naohiro Aota <[email protected]>
Signed-off-by: Shin'ichiro Kawasaki <[email protected]>
---
tests/generic/171 | 2 +-
tests/generic/172 | 2 +-
tests/generic/173 | 2 +-
tests/generic/174 | 2 +-
tests/generic/204 | 3 ++-
5 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/tests/generic/171 b/tests/generic/171
index fb2a6f14..f823a454 100755
--- a/tests/generic/171
+++ b/tests/generic/171
@@ -42,7 +42,7 @@ sz_bytes=$((nr_blks * 8 * blksz))
if [ $sz_bytes -lt $((32 * 1048576)) ]; then
sz_bytes=$((32 * 1048576))
fi
-_scratch_mkfs_sized $sz_bytes >> $seqres.full 2>&1
+_scratch_mkfs_sized $sz_bytes >> $seqres.full 2>&1 || _fail "mkfs failed"
_scratch_mount >> $seqres.full 2>&1
rm -rf $testdir
mkdir $testdir
diff --git a/tests/generic/172 b/tests/generic/172
index ab5122fa..383824b9 100755
--- a/tests/generic/172
+++ b/tests/generic/172
@@ -40,7 +40,7 @@ umount $SCRATCH_MNT
file_size=$((768 * 1024 * 1024))
fs_size=$((1024 * 1024 * 1024))
-_scratch_mkfs_sized $fs_size >> $seqres.full 2>&1
+_scratch_mkfs_sized $fs_size >> $seqres.full 2>&1 || _fail "mkfs failed"
_scratch_mount >> $seqres.full 2>&1
rm -rf $testdir
mkdir $testdir
diff --git a/tests/generic/173 b/tests/generic/173
index 0eb313e2..e1493278 100755
--- a/tests/generic/173
+++ b/tests/generic/173
@@ -42,7 +42,7 @@ sz_bytes=$((nr_blks * 8 * blksz))
if [ $sz_bytes -lt $((32 * 1048576)) ]; then
sz_bytes=$((32 * 1048576))
fi
-_scratch_mkfs_sized $sz_bytes >> $seqres.full 2>&1
+_scratch_mkfs_sized $sz_bytes >> $seqres.full 2>&1 || _fail "mkfs failed"
_scratch_mount >> $seqres.full 2>&1
rm -rf $testdir
mkdir $testdir
diff --git a/tests/generic/174 b/tests/generic/174
index 1505453e..c7a177b8 100755
--- a/tests/generic/174
+++ b/tests/generic/174
@@ -43,7 +43,7 @@ sz_bytes=$((nr_blks * 8 * blksz))
if [ $sz_bytes -lt $((32 * 1048576)) ]; then
sz_bytes=$((32 * 1048576))
fi
-_scratch_mkfs_sized $sz_bytes >> $seqres.full 2>&1
+_scratch_mkfs_sized $sz_bytes >> $seqres.full 2>&1 || _fail "mkfs failed"
_scratch_mount >> $seqres.full 2>&1
rm -rf $testdir
mkdir $testdir
diff --git a/tests/generic/204 b/tests/generic/204
index a3dabb71..b5deb443 100755
--- a/tests/generic/204
+++ b/tests/generic/204
@@ -35,7 +35,8 @@ _scratch_mkfs 2> /dev/null | _filter_mkfs 2> $tmp.mkfs > /dev/null
[ $FSTYP = "xfs" ] && MKFS_OPTIONS="$MKFS_OPTIONS -l size=16m -i maxpct=50"
SIZE=`expr 115 \* 1024 \* 1024`
-_scratch_mkfs_sized $SIZE $dbsize 2> /dev/null > $tmp.mkfs.raw
+_scratch_mkfs_sized $SIZE $dbsize 2> /dev/null > $tmp.mkfs.raw \
+ || _fail "mkfs failed"
cat $tmp.mkfs.raw | _filter_mkfs 2> $tmp.mkfs > /dev/null
_scratch_mount
--
2.34.1
On Mon, Feb 07, 2022 at 03:55:36PM +0900, Shin'ichiro Kawasaki wrote:
> The test cases generic/{171,172,173,174,204} call _scratch_mkfs before
> _scratch_mkfs_sized, and they do 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 of the test cases.
>
> To avoid the unexpected test condition, check return code of
> _scratch_mkfs_sized in the test cases.
>
> Suggested-by: Naohiro Aota <[email protected]>
> Signed-off-by: Shin'ichiro Kawasaki <[email protected]>
Hm. I wonder, are there other tests that employ this _scratch_mkfs ->
scratch_mkfs_sized sequence and need patching?
$ git grep -l _scratch_mkfs_sized | while read f; do grep -q
'_scratch_mkfs[[:space:]]' $f && echo $f; done
common/encrypt
common/rc
tests/ext4/021
tests/generic/171
tests/generic/172
tests/generic/173
tests/generic/174
tests/generic/204
tests/generic/520
tests/generic/525
tests/xfs/015
generic/520 is a false positive, and you patched the rest. OK, good.
I wonder if the maintainer will ask for the _scratch_mkfs_sized in the
failure output, but as far as I'm concerned:
Reviewed-by: Darrick J. Wong <[email protected]>
--D
> ---
> tests/generic/171 | 2 +-
> tests/generic/172 | 2 +-
> tests/generic/173 | 2 +-
> tests/generic/174 | 2 +-
> tests/generic/204 | 3 ++-
> 5 files changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/tests/generic/171 b/tests/generic/171
> index fb2a6f14..f823a454 100755
> --- a/tests/generic/171
> +++ b/tests/generic/171
> @@ -42,7 +42,7 @@ sz_bytes=$((nr_blks * 8 * blksz))
> if [ $sz_bytes -lt $((32 * 1048576)) ]; then
> sz_bytes=$((32 * 1048576))
> fi
> -_scratch_mkfs_sized $sz_bytes >> $seqres.full 2>&1
> +_scratch_mkfs_sized $sz_bytes >> $seqres.full 2>&1 || _fail "mkfs failed"
> _scratch_mount >> $seqres.full 2>&1
> rm -rf $testdir
> mkdir $testdir
> diff --git a/tests/generic/172 b/tests/generic/172
> index ab5122fa..383824b9 100755
> --- a/tests/generic/172
> +++ b/tests/generic/172
> @@ -40,7 +40,7 @@ umount $SCRATCH_MNT
>
> file_size=$((768 * 1024 * 1024))
> fs_size=$((1024 * 1024 * 1024))
> -_scratch_mkfs_sized $fs_size >> $seqres.full 2>&1
> +_scratch_mkfs_sized $fs_size >> $seqres.full 2>&1 || _fail "mkfs failed"
> _scratch_mount >> $seqres.full 2>&1
> rm -rf $testdir
> mkdir $testdir
> diff --git a/tests/generic/173 b/tests/generic/173
> index 0eb313e2..e1493278 100755
> --- a/tests/generic/173
> +++ b/tests/generic/173
> @@ -42,7 +42,7 @@ sz_bytes=$((nr_blks * 8 * blksz))
> if [ $sz_bytes -lt $((32 * 1048576)) ]; then
> sz_bytes=$((32 * 1048576))
> fi
> -_scratch_mkfs_sized $sz_bytes >> $seqres.full 2>&1
> +_scratch_mkfs_sized $sz_bytes >> $seqres.full 2>&1 || _fail "mkfs failed"
> _scratch_mount >> $seqres.full 2>&1
> rm -rf $testdir
> mkdir $testdir
> diff --git a/tests/generic/174 b/tests/generic/174
> index 1505453e..c7a177b8 100755
> --- a/tests/generic/174
> +++ b/tests/generic/174
> @@ -43,7 +43,7 @@ sz_bytes=$((nr_blks * 8 * blksz))
> if [ $sz_bytes -lt $((32 * 1048576)) ]; then
> sz_bytes=$((32 * 1048576))
> fi
> -_scratch_mkfs_sized $sz_bytes >> $seqres.full 2>&1
> +_scratch_mkfs_sized $sz_bytes >> $seqres.full 2>&1 || _fail "mkfs failed"
> _scratch_mount >> $seqres.full 2>&1
> rm -rf $testdir
> mkdir $testdir
> diff --git a/tests/generic/204 b/tests/generic/204
> index a3dabb71..b5deb443 100755
> --- a/tests/generic/204
> +++ b/tests/generic/204
> @@ -35,7 +35,8 @@ _scratch_mkfs 2> /dev/null | _filter_mkfs 2> $tmp.mkfs > /dev/null
> [ $FSTYP = "xfs" ] && MKFS_OPTIONS="$MKFS_OPTIONS -l size=16m -i maxpct=50"
>
> SIZE=`expr 115 \* 1024 \* 1024`
> -_scratch_mkfs_sized $SIZE $dbsize 2> /dev/null > $tmp.mkfs.raw
> +_scratch_mkfs_sized $SIZE $dbsize 2> /dev/null > $tmp.mkfs.raw \
> + || _fail "mkfs failed"
> cat $tmp.mkfs.raw | _filter_mkfs 2> $tmp.mkfs > /dev/null
> _scratch_mount
>
> --
> 2.34.1
>
On Feb 08, 2022 / 16:35, Darrick J. Wong wrote:
> On Mon, Feb 07, 2022 at 03:55:36PM +0900, Shin'ichiro Kawasaki wrote:
> > The test cases generic/{171,172,173,174,204} call _scratch_mkfs before
> > _scratch_mkfs_sized, and they do 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 of the test cases.
> >
> > To avoid the unexpected test condition, check return code of
> > _scratch_mkfs_sized in the test cases.
> >
> > Suggested-by: Naohiro Aota <[email protected]>
> > Signed-off-by: Shin'ichiro Kawasaki <[email protected]>
>
> Hm. I wonder, are there other tests that employ this _scratch_mkfs ->
> scratch_mkfs_sized sequence and need patching?
>
> $ git grep -l _scratch_mkfs_sized | while read f; do grep -q
> '_scratch_mkfs[[:space:]]' $f && echo $f; done
> common/encrypt
> common/rc
> tests/ext4/021
> tests/generic/171
> tests/generic/172
> tests/generic/173
> tests/generic/174
> tests/generic/204
> tests/generic/520
> tests/generic/525
> tests/xfs/015
>
> generic/520 is a false positive, and you patched the rest. OK, good.
>
> I wonder if the maintainer will ask for the _scratch_mkfs_sized in the
> failure output, but as far as I'm concerned:
>
> Reviewed-by: Darrick J. Wong <[email protected]>
Thank you for reviewing. As for g/204, I will remove _scratch_mkfs call as you
suggested in other e-mail. So, I think this error check addition is no longer
required for g/204, and will drop the g/204 hunk from this patch. I wonder if
I can add your Reviewed-by tag with this change, but to be strict, I plan not
to add the tag for v2 post.
--
Best Regards,
Shin'ichiro Kawasaki