fstests: Improve tmpfs handling
cover fstests: Improve tmpfs handling
Hello,
when testing tmpfs with fstests, I've noticed a couple of fstests failures which are bugs in tests (usually expecting functionality tmpfs does not provide). The following two patches fix them.
Honza
PATCH 1/2 common: Fix recovery tests for tmpfs
Tmpfs doesn't support metadata journalling. Recognize it as such.
--- common/rc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
common/rc +1 -1
@@ -3441,7 +3441,7 @@ _has_metadata_journaling() fi case "$FSTYP" in - ext2|vfat|msdos|udf|exfat) + ext2|vfat|msdos|udf|exfat|tmpfs) echo "$FSTYP does not support metadata journaling" return 1 ;;
Signature · 1 line
2.26.2
PATCH 2/2 Don't run tests that require block devices for virtual filesystems
In reply to Jan KaraSome tests require block device based filesystems (e.g. because they setup dm device in a particular way). These tests then fail for tmpfs in unusual ways (usually trying to call mkfs.tmpfs). Annotate these tests as requiring block device based filesystem so that we gracefully exit with _notrun. Also there's no point in simulating successful _mkfs_dev for such filesystems since the test is unlikely to test anything sensible. So delete that workaround from _mkfs_dev.
--- common/rc | 28 +++++++++++++--------------- tests/generic/081 | 2 +- tests/generic/347 | 2 +- tests/generic/459 | 2 +- tests/generic/470 | 2 +- tests/generic/500 | 2 +- tests/generic/563 | 2 +- tests/generic/620 | 2 +- 8 files changed, 20 insertions(+), 22 deletions(-)
common/rc +13 -15
@@ -677,21 +677,6 @@ _mkfs_dev() { local tmp=`mktemp -u` case $FSTYP in - nfs*) - # do nothing for nfs - ;; - 9p) - # do nothing for 9p - ;; - virtiofs) - # do nothing for virtiofs - ;; - overlay) - # do nothing for overlay - ;; - pvfs2) - # do nothing for pvfs2 - ;; udf) $MKFS_UDF_PROG $MKFS_OPTIONS $* 2>$tmp.mkfserr 1>$tmp.mkfsstd ;;
@@ -1469,6 +1454,19 @@ _supported_fs() then return fi + if [ "$f" = "blkdev" ] + then + case $FSTYP in + nfs*) + 9p) + virtiofs) + overlay) + pvfs2) + tmpfs) + break + ;; + esac + fi done _notrun "not suitable for this filesystem type: $FSTYP"
tests/generic/081 +1 -1
@@ -49,7 +49,7 @@ _cleanup() . ./common/filter # real QA test starts here -_supported_fs generic +_supported_fs blkdev _require_test _require_scratch_nocheck _require_dm_target snapshot
tests/generic/347 +1 -1
@@ -56,7 +56,7 @@ _workout() . ./common/rc . ./common/dmthin -_supported_fs generic +_supported_fs blkdev _require_scratch_nocheck _require_dm_target thin-pool
tests/generic/459 +1 -1
@@ -43,7 +43,7 @@ _cleanup() # This tests for filesystem lockup not consistency, so don't check for fs # consistency after test -_supported_fs generic +_supported_fs blkdev _require_scratch_nocheck _require_dm_target thin-pool _require_dm_target snapshot
tests/generic/470 +1 -1
@@ -34,7 +34,7 @@ _cleanup() rm -f $seqres.full # real QA test starts here -_supported_fs generic +_supported_fs blkdev _require_scratch_nocheck _require_log_writes_dax_mountopt "dax" _require_dm_target thin-pool
tests/generic/500 +1 -1
@@ -44,7 +44,7 @@ _cleanup() rm -f $seqres.full # real QA test starts here -_supported_fs generic +_supported_fs blkdev _require_scratch_nocheck _require_dm_target thin-pool
tests/generic/563 +1 -1
@@ -41,7 +41,7 @@ rm -f $seqres.full # real QA test starts here # Modify as appropriate. -_supported_fs generic +_supported_fs blkdev _require_scratch_nocheck _require_cgroup2 io _require_loop
tests/generic/620 +1 -1
@@ -40,7 +40,7 @@ _cleanup() rm -f $seqres.full # Modify as appropriate. -_supported_fs generic +_supported_fs blkdev _require_scratch_size_nocheck $((4 * 1024 * 1024)) #kB _require_scratch_16T_support _require_dmhugedisk
Signature · 1 line
2.26.2
Re: [PATCH 2/2] Don't run tests that require block devices for virtual filesystems
Quoted 3 lines · Jan Kara
Some tests require block device based filesystems (e.g. because they setup dm device in a particular way). These tests then fail for tmpfs in
I don't understand. _require_dm_target has:
# require SCRATCH_DEV to be a valid block device with sane BLKFLSBUF
# behaviour
_require_block_device $SCRATCH_DEV
_require_sane_bdev_flush $SCRATCH_DEVand generic/563 has explicit _require_block_device
Why does tmpfs pass these checks?
Quoted 158 lines
unusual ways (usually trying to call mkfs.tmpfs). Annotate these tests as requiring block device based filesystem so that we gracefully exit with
_notrun. Also there's no point in simulating successful_mkfs_devfor such filesystems since the test is unlikely to test anything sensible. So delete that workaround from_mkfs_dev.Signed-off-by Jan Kara <[email protected]>--- common/rc | 28 +++++++++++++--------------- tests/generic/081 | 2 +- tests/generic/347 | 2 +- tests/generic/459 | 2 +- tests/generic/470 | 2 +- tests/generic/500 | 2 +- tests/generic/563 | 2 +- tests/generic/620 | 2 +- 8 files changed, 20 insertions(+), 22 deletions(-)common/rc +13
-15@@ -677,21 +677,6 @@ _mkfs_dev() { local tmp=`mktemp -u` case $FSTYP in - nfs*) - # do nothing for nfs - ;; - 9p) - # do nothing for 9p - ;; - virtiofs) - # do nothing for virtiofs - ;; - overlay) - # do nothing for overlay - ;; - pvfs2) - # do nothing for pvfs2 - ;; udf) $MKFS_UDF_PROG $MKFS_OPTIONS $* 2>$tmp.mkfserr 1>$tmp.mkfsstd ;;@@ -1469,6 +1454,19 @@ _supported_fs() then return fi + if [ "$f" = "blkdev" ] + then + case $FSTYP in + nfs*) + 9p) + virtiofs) + overlay) + pvfs2) + tmpfs) + break + ;; + esac + fi done _notrun "not suitable for this filesystem type: $FSTYP"tests/generic/081 +1
-1@@ -49,7 +49,7 @@ _cleanup() . ./common/filter # real QA test starts here -_supported_fs generic +_supported_fs blkdev _require_test _require_scratch_nocheck _require_dm_target snapshottests/generic/347 +1
-1@@ -56,7 +56,7 @@ _workout() . ./common/rc . ./common/dmthin -_supported_fs generic +_supported_fs blkdev _require_scratch_nocheck _require_dm_target thin-pooltests/generic/459 +1
-1@@ -43,7 +43,7 @@ _cleanup() # This tests for filesystem lockup not consistency, so don't check for fs # consistency after test -_supported_fs generic +_supported_fs blkdev _require_scratch_nocheck _require_dm_target thin-pool _require_dm_target snapshottests/generic/470 +1
-1@@ -34,7 +34,7 @@ _cleanup() rm -f $seqres.full # real QA test starts here -_supported_fs generic +_supported_fs blkdev _require_scratch_nocheck _require_log_writes_dax_mountopt "dax" _require_dm_target thin-pooltests/generic/500 +1
-1@@ -44,7 +44,7 @@ _cleanup() rm -f $seqres.full # real QA test starts here -_supported_fs generic +_supported_fs blkdev _require_scratch_nocheck _require_dm_target thin-pooltests/generic/563 +1
-1@@ -41,7 +41,7 @@ rm -f $seqres.full # real QA test starts here # Modify as appropriate. -_supported_fs generic +_supported_fs blkdev _require_scratch_nocheck _require_cgroup2 io _require_looptests/generic/620 +1
-2@@ -40,7 +40,7 @@ _cleanup() rm -f $seqres.full # Modify as appropriate. -_supported_fs generic +_supported_fs blkdev _require_scratch_size_nocheck $((4 * 1024 * 1024)) #kB _require_scratch_16T_support _require_dmhugedisk --2.26.2
Re: [PATCH 2/2] Don't run tests that require block devices for virtual filesystems
Quoted 7 lines · Amir Goldstein
Quoted 3 lines · Jan Kara
Some tests require block device based filesystems (e.g. because they setup dm device in a particular way). These tests then fail for tmpfs in
I don't understand.
_require_dm_targethas:
Quoted 8 lines
# require SCRATCH_DEV to be a valid block device with sane BLKFLSBUF # behaviour _require_block_device $SCRATCH_DEV _require_sane_bdev_flush $SCRATCH_DEVand generic/563 has explicit
_require_block_deviceWhy does tmpfs pass these checks?
Good question. I had accidentally defined valid SCRATCH_DEV from the previous test. tmpfs didn't use it but it was enough to make tests like these pass.
Honza
Quoted 159 lines
Quoted 159 lines
unusual ways (usually trying to call mkfs.tmpfs). Annotate these tests as requiring block device based filesystem so that we gracefully exit with
_notrun. Also there's no point in simulating successful_mkfs_devfor such filesystems since the test is unlikely to test anything sensible. So delete that workaround from_mkfs_dev.Signed-off-by Jan Kara <[email protected]>--- common/rc | 28 +++++++++++++--------------- tests/generic/081 | 2 +- tests/generic/347 | 2 +- tests/generic/459 | 2 +- tests/generic/470 | 2 +- tests/generic/500 | 2 +- tests/generic/563 | 2 +- tests/generic/620 | 2 +- 8 files changed, 20 insertions(+), 22 deletions(-)common/rc +13
-15@@ -677,21 +677,6 @@ _mkfs_dev() { local tmp=`mktemp -u` case $FSTYP in - nfs*) - # do nothing for nfs - ;; - 9p) - # do nothing for 9p - ;; - virtiofs) - # do nothing for virtiofs - ;; - overlay) - # do nothing for overlay - ;; - pvfs2) - # do nothing for pvfs2 - ;; udf) $MKFS_UDF_PROG $MKFS_OPTIONS $* 2>$tmp.mkfserr 1>$tmp.mkfsstd ;;@@ -1469,6 +1454,19 @@ _supported_fs() then return fi + if [ "$f" = "blkdev" ] + then + case $FSTYP in + nfs*) + 9p) + virtiofs) + overlay) + pvfs2) + tmpfs) + break + ;; + esac + fi done _notrun "not suitable for this filesystem type: $FSTYP"tests/generic/081 +1
-1@@ -49,7 +49,7 @@ _cleanup() . ./common/filter # real QA test starts here -_supported_fs generic +_supported_fs blkdev _require_test _require_scratch_nocheck _require_dm_target snapshottests/generic/347 +1
-1@@ -56,7 +56,7 @@ _workout() . ./common/rc . ./common/dmthin -_supported_fs generic +_supported_fs blkdev _require_scratch_nocheck _require_dm_target thin-pooltests/generic/459 +1
-1@@ -43,7 +43,7 @@ _cleanup() # This tests for filesystem lockup not consistency, so don't check for fs # consistency after test -_supported_fs generic +_supported_fs blkdev _require_scratch_nocheck _require_dm_target thin-pool _require_dm_target snapshottests/generic/470 +1
-1@@ -34,7 +34,7 @@ _cleanup() rm -f $seqres.full # real QA test starts here -_supported_fs generic +_supported_fs blkdev _require_scratch_nocheck _require_log_writes_dax_mountopt "dax" _require_dm_target thin-pooltests/generic/500 +1
-1@@ -44,7 +44,7 @@ _cleanup() rm -f $seqres.full # real QA test starts here -_supported_fs generic +_supported_fs blkdev _require_scratch_nocheck _require_dm_target thin-pooltests/generic/563 +1
-1@@ -41,7 +41,7 @@ rm -f $seqres.full # real QA test starts here # Modify as appropriate. -_supported_fs generic +_supported_fs blkdev _require_scratch_nocheck _require_cgroup2 io _require_looptests/generic/620 +1
-2@@ -40,7 +40,7 @@ _cleanup() rm -f $seqres.full # Modify as appropriate. -_supported_fs generic +_supported_fs blkdev _require_scratch_size_nocheck $((4 * 1024 * 1024)) #kB _require_scratch_16T_support _require_dmhugedisk --2.26.2
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR