common/rc: make _mkfs_dev return mkfs_status
PATCH 1/1 common/rc: make _mkfs_dev return mkfs_status
If _mkfs_dev fialed,the test should notrun. _mkfs_dev may need to return mkfs_status as _scratch_mkfs_ext4 and _scratch_mkfs_xfs do.
---
I run generic/test/042 on f2fs, it failed, because the device size is too small:
F2FS-tools: mkfs.f2fs Ver: 1.9.0 (2017-09-21)
Info: Disable heap-based policy
Info: Debug level = 0
Info: Label =
Info: Trim is enabled
Info: Segments per section = 1
Info: Sections per zone = 1
Info: sector size = 512
Info: total sectors = 51200 (25 MB)
Info: zone aligned segment0 blkaddr: 512
Error: Device size is not sufficient for F2FS volume
Error: Failed to prepare a super block!!!
Error: Could not format the device!!!
Change the device size to 40M, it can pass. But I am not sure if it will change the test's intention.
[root@localhost xfstests]# ./check tests/generic/042
FSTYP -- f2fs PLATFORM -- Linux/x86_64 localhost 5.12.0-rc5-next-20210330 #2 SMP Thu Apr 15 00:58:54 EDT 2021 MKFS_OPTIONS -- /dev/sdb
MOUNT_OPTIONS -- -o acl,user_xattr /dev/sdb /mnt/scratch
generic/042 3s ... 4s
Ran: generic/042
Passed all 1 tests
Other tests also use _mkfs_dev(), if making _mkfs_dev return mkfs_status is ok, I will modify them in V2.
[root@localhost xfstests]# ./check tests/generic/042
FSTYP -- f2fs
PLATFORM -- Linux/x86_64 localhost 5.12.0-rc5-next-20210330 #3 SMP
Wed Apr 21 22:29:25 EDT 2021MKFS_OPTIONS -- /dev/sdbMOUNT_OPTIONS -- -o acl,user_xattr /dev/sdb /mnt/scratch
generic/042 2s ... [not run] mkfs failed!
Ran: generic/042
Not run: generic/042
Passed all 1 tests
common/rc | 14 ++++++++------ tests/generic/042 | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-)
common/rc +8 -6
@@ -642,6 +642,8 @@ _test_mkfs() _mkfs_dev() { local tmp=`mktemp -u` + local mkfs_status + case $FSTYP in nfs*) # do nothing for nfs
@@ -677,15 +679,15 @@ _mkfs_dev() 2>$tmp.mkfserr 1>$tmp.mkfsstd ;; esac + mkfs_status=$? - if [ $? -ne 0 ]; then - # output stored mkfs output - cat $tmp.mkfserr >&2 - cat $tmp.mkfsstd - status=1 - exit 1 + if [ $mkfs_status -ne 0 ]; then + # output stored mkfs output + cat $tmp.mkfserr >&2 + cat $tmp.mkfsstd fi rm -f $tmp.mkfserr $tmp.mkfsstd + return $mkfs_status } # remove all files in $SCRATCH_MNT, useful when testing on NFS/CIFS
tests/generic/042 +1 -1
@@ -46,7 +46,7 @@ _crashtest() # the image to detect stale data exposure. $XFS_IO_PROG -f -c "truncate 0" -c "pwrite -S 0xCD 0 25M" $img \ >> $seqres.full 2>&1 - _mkfs_dev $img >> $seqres.full 2>&1 + _mkfs_dev $img >> $seqres.full 2>&1 || _notrun "mkfs failed!" mkdir -p $mnt _mount $img $mnt
Signature · 1 line
2.13.6
Quoted 77 lines · Sun Ke
If
_mkfs_devfialed,the test should notrun._mkfs_devmay need to returnmkfs_statusas_scratch_mkfs_ext4and_scratch_mkfs_xfsdo.Signed-off-by Sun Ke <[email protected]>---
I run generic/test/042 on f2fs, it failed, because the device size is too small:F2FS-tools: mkfs.f2fs Ver: 1.9.0 (2017-09-21)
Info: Disable heap-based policy
Info: Debug level = 0
Info: Label =
Info: Trim is enabled
Info: Segments per section = 1
Info: Sections per zone = 1
Info: sector size = 512
Info: total sectors = 51200 (25 MB)
Info: zone aligned segment0 blkaddr: 512
Error: Device size is not sufficient for F2FS volume
Error: Failed to prepare a super block!!!
Error: Could not format the device!!!Change the device size to 40M, it can pass. But I am not sure if it will change the test's intention.
[root@localhost xfstests]# ./check tests/generic/042
FSTYP -- f2fs PLATFORM -- Linux/x86_64 localhost 5.12.0-rc5-next-20210330 #2 SMP Thu Apr 15 00:58:54 EDT 2021 MKFS_OPTIONS -- /dev/sdb
MOUNT_OPTIONS-- -o acl,user_xattr/dev/sdb/mnt/scratchgeneric/042 3s ... 4s
Ran: generic/042
Passed all 1 testsOther tests also use
_mkfs_dev(), if making_mkfs_devreturnmkfs_statusis ok, I will modify them in V2.[root@localhost xfstests]# ./check tests/generic/042
FSTYP -- f2fs
PLATFORM -- Linux/x86_64 localhost 5.12.0-rc5-next-20210330 #3 SMP
Wed Apr 21 22:29:25 EDT 2021MKFS_OPTIONS--/dev/sdbMOUNT_OPTIONS-- -o acl,user_xattr/dev/sdb/mnt/scratchgeneric/042 2s ... [not run] mkfs failed!
Ran: generic/042
Not run: generic/042
Passed all 1 testscommon/rc | 14 ++++++++------ tests/generic/042 | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-)common/rc +3
-3@@ -642,6 +642,8 @@ _test_mkfs() _mkfs_dev() { local tmp=`mktemp -u` + local mkfs_status + case $FSTYP in nfs*) # do nothing for nfs@@ -677,15 +679,15 @@ _mkfs_dev() 2>$tmp.mkfserr 1>$tmp.mkfsstd ;; esac + mkfs_status=$? - if [ $? -ne 0 ]; then - # output stored mkfs output - cat $tmp.mkfserr >&2
common/rc _mkfs_dev() · line 690
Quoted 10 lines
common/rc +5
-3- cat $tmp.mkfsstd - status=1 - exit 1 + if [ $mkfs_status -ne 0 ]; then + # output stored mkfs output + cat $tmp.mkfserr >&2 + cat $tmp.mkfsstd fi rm -f $tmp.mkfserr $tmp.mkfsstd + return $mkfs_status
Hmm, this changes _mkfs_dev behavior such that it no longer exits the test, which implies that the callers could be broken. How about renaming the above to _try_mkfs_dev and then add a _mkfs_dev to:
_mkfs_dev() {
_try_mkfs_dev "$@"
if [ $? -ne 0 ]; then
status=1
exit 1
fi
}I think then the only difference is that _mkfs_dev now cleans up the $tmp.mkfs* files.
--D
Quoted 19 lines
common/rc +0
-0} # remove all files in $SCRATCH_MNT, useful when testing on NFS/CIFStests/generic/042 +1
-1@@ -46,7 +46,7 @@ _crashtest() # the image to detect stale data exposure. $XFS_IO_PROG -f -c "truncate 0" -c "pwrite -S 0xCD 0 25M" $img \ >> $seqres.full 2>&1 - _mkfs_dev $img >> $seqres.full 2>&1 + _mkfs_dev $img >> $seqres.full 2>&1 || _notrun "mkfs failed!" mkdir -p $mnt _mount $img $mntSignature · 1 line
2.13.6
Quoted 6 lines · Sun Ke
If
_mkfs_devfialed,the test should notrun._mkfs_devmay need to returnmkfs_statusas_scratch_mkfs_ext4and_scratch_mkfs_xfsdo.Signed-off-by Sun Ke <[email protected]>---
I run generic/test/042 on f2fs, it failed, because the device size is too small:
I think we should require a minimal device size in generic/042 for f2fs, or write a larger fs image file if possible so that f2fs could run.
Thanks,
Eryu
Quoted 99 lines
F2FS-tools: mkfs.f2fs Ver: 1.9.0 (2017-09-21)
Info: Disable heap-based policy
Info: Debug level = 0
Info: Label =
Info: Trim is enabled
Info: Segments per section = 1
Info: Sections per zone = 1
Info: sector size = 512
Info: total sectors = 51200 (25 MB)
Info: zone aligned segment0 blkaddr: 512
Error: Device size is not sufficient for F2FS volume
Error: Failed to prepare a super block!!!
Error: Could not format the device!!!Change the device size to 40M, it can pass. But I am not sure if it will change the test's intention.
[root@localhost xfstests]# ./check tests/generic/042
FSTYP -- f2fs PLATFORM -- Linux/x86_64 localhost 5.12.0-rc5-next-20210330 #2 SMP Thu Apr 15 00:58:54 EDT 2021 MKFS_OPTIONS -- /dev/sdb
MOUNT_OPTIONS-- -o acl,user_xattr/dev/sdb/mnt/scratchgeneric/042 3s ... 4s
Ran: generic/042
Passed all 1 testsOther tests also use
_mkfs_dev(), if making_mkfs_devreturnmkfs_statusis ok, I will modify them in V2.[root@localhost xfstests]# ./check tests/generic/042
FSTYP -- f2fs
PLATFORM -- Linux/x86_64 localhost 5.12.0-rc5-next-20210330 #3 SMP
Wed Apr 21 22:29:25 EDT 2021MKFS_OPTIONS--/dev/sdbMOUNT_OPTIONS-- -o acl,user_xattr/dev/sdb/mnt/scratchgeneric/042 2s ... [not run] mkfs failed!
Ran: generic/042
Not run: generic/042
Passed all 1 testscommon/rc | 14 ++++++++------ tests/generic/042 | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-)common/rc +8
-6@@ -642,6 +642,8 @@ _test_mkfs() _mkfs_dev() { local tmp=`mktemp -u` + local mkfs_status + case $FSTYP in nfs*) # do nothing for nfs@@ -677,15 +679,15 @@ _mkfs_dev() 2>$tmp.mkfserr 1>$tmp.mkfsstd ;; esac + mkfs_status=$? - if [ $? -ne 0 ]; then - # output stored mkfs output - cat $tmp.mkfserr >&2 - cat $tmp.mkfsstd - status=1 - exit 1 + if [ $mkfs_status -ne 0 ]; then + # output stored mkfs output + cat $tmp.mkfserr >&2 + cat $tmp.mkfsstd fi rm -f $tmp.mkfserr $tmp.mkfsstd + return $mkfs_status } # remove all files in $SCRATCH_MNT, useful when testing on NFS/CIFStests/generic/042 +1
-1@@ -46,7 +46,7 @@ _crashtest() # the image to detect stale data exposure. $XFS_IO_PROG -f -c "truncate 0" -c "pwrite -S 0xCD 0 25M" $img \ >> $seqres.full 2>&1 - _mkfs_dev $img >> $seqres.full 2>&1 + _mkfs_dev $img >> $seqres.full 2>&1 || _notrun "mkfs failed!" mkdir -p $mnt _mount $img $mntSignature · 1 line
2.13.6