]> www.infradead.org Git - users/hch/xfstests-dev.git/commitdiff
xfs: don't run tests that require v4 file systems when not supported
authorChristoph Hellwig <hch@lst.de>
Thu, 18 Apr 2024 07:40:46 +0000 (09:40 +0200)
committerZorro Lang <zlang@kernel.org>
Sat, 20 Apr 2024 14:40:48 +0000 (22:40 +0800)
Add a _require_xfs_nocrc helper that checks that we can mkfs and mount
a crc=0 file systems before running tests that rely on it to avoid failures
on kernels with CONFIG_XFS_SUPPORT_V4 disabled.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
12 files changed:
common/xfs
tests/xfs/002
tests/xfs/095
tests/xfs/096
tests/xfs/132
tests/xfs/148
tests/xfs/194
tests/xfs/199
tests/xfs/300
tests/xfs/526
tests/xfs/612
tests/xfs/613

index 49ca5a2d527d6299cac23fdb09ca44bae4cf1ef2..733c3a5be4f14ecd16166ebc9e1ee41752c37851 100644 (file)
@@ -1852,3 +1852,13 @@ _xfs_discard_max_offset_kb()
        $XFS_IO_PROG -c 'statfs' "$1" | \
                awk '{g[$1] = $3} END {print (g["geom.bsize"] * g["geom.datablocks"] / 1024)}'
 }
+
+# check if mkfs and the kernel support nocrc (v4) file systems
+_require_xfs_nocrc()
+{
+       _scratch_mkfs_xfs -m crc=0 > /dev/null 2>&1 || \
+               _notrun "v4 file systems not supported"
+       _try_scratch_mount > /dev/null 2>&1 || \
+               _notrun "v4 file systems not supported"
+       _scratch_unmount
+}
index 8dfd2693b1d08bdf2b27fb370346d12ddbd28ffa..26d0cd6e48eab614dd13283e24a83f410295f540 100755 (executable)
@@ -23,6 +23,7 @@ _begin_fstest auto quick growfs
 _supported_fs xfs
 _require_scratch_nocheck
 _require_no_large_scratch_dev
+_require_xfs_nocrc
 
 _scratch_mkfs_xfs -m crc=0 -d size=128m >> $seqres.full 2>&1 || _fail "mkfs failed"
 
index a3891c85e4c2b4078083c9ff49882dbb0afe0cfa..e7dc3e9f409fd533b8f273e15a96020662e3e21a 100755 (executable)
@@ -19,6 +19,7 @@ _begin_fstest log v2log auto
 _supported_fs xfs
 _require_scratch
 _require_v2log
+_require_xfs_nocrc
 
 if [ "$(blockdev --getss $SCRATCH_DEV)" != "512" ]; then
        _notrun "need 512b sector size"
index 7eff6cb1d7d742cc1ac5a7cbf011e91743e6cbae..0a1bfb3fa87100a09e39cc5bcc448d7a82ceae6d 100755 (executable)
@@ -20,6 +20,7 @@ _supported_fs xfs
 
 _require_scratch
 _require_xfs_quota
+_require_xfs_nocrc
 
 function option_string()
 {
index ee1c8c1ec0b982c3bedab989628f8f32f13327c0..b46d3d28c84f3c00502b73dbb18f007adeea1f6c 100755 (executable)
@@ -19,6 +19,7 @@ _supported_fs xfs
 
 # we intentionally corrupt the filesystem, so don't check it after the test
 _require_scratch_nocheck
+_require_xfs_nocrc
 
 # on success, we'll get a shutdown filesystem with a really noisy log message
 # due to transaction cancellation.  Hence we don't want to check dmesg here.
index c9f634cfd02638b4099786664f888ddbfb69c7a3..fde3bf476efbc8a81162666c0256030f6b899535 100755 (executable)
@@ -27,6 +27,8 @@ _cleanup()
 _supported_fs xfs
 _require_test
 _require_attrs
+_require_xfs_nocrc
+
 _disable_dmesg_check
 
 imgfile=$TEST_DIR/img-$seq
@@ -40,6 +42,10 @@ test_names=("something" "$nullstr" "$slashstr" "another")
 rm -f $imgfile $imgfile.old
 
 # Format image file w/o crcs so we can sed the image file
+#
+# TODO: It might be possible to rewrite this using proper xfs_db
+# fs manipulation commands that would work with CRCs.
+#
 # We need to use 512 byte inodes to ensure the attr forks remain in short form
 # even when security xattrs are present so we are always doing name matches on
 # lookup and not name hash compares as leaf/node forms will do.
index 5a1dff5d24fd7b3a09eee431301a5e79b3dc061d..2fcc55b3e272bde37eeee3d749e4230b9bbbf37b 100755 (executable)
@@ -30,6 +30,16 @@ _supported_fs xfs
 # real QA test starts here
 
 _require_scratch
+
+#
+# This currently forces nocrc because only that can support 512 byte block size
+# and thus block size = 1/8 page size on 4k page size systems.
+# In theory we could run it on systems with larger page size with CRCs, or hope
+# that large folios would trigger the same issue.
+# But for now that is left as an exercise for the reader.
+#
+_require_xfs_nocrc
+
 _scratch_mkfs_xfs >/dev/null 2>&1
 
 # For this test we use block size = 1/8 page size
index 4669f2c3e6d89e652305b956af616e6ccc372464..f99b04db3dbd9a197db3ff420c23998d6fc3b4c3 100755 (executable)
@@ -26,6 +26,7 @@ _cleanup()
 _supported_fs xfs
 
 _require_scratch
+_require_xfs_nocrc
 
 # clear any mkfs options so that we can directly specify the options we need to
 # be able to test the features bitmask behaviour correctly.
index 2ee5eee7152ba99f52fafe9808fc65d874da8f4d..bc1f0efc6a36874e324f56c568ad28b32a93e5e0 100755 (executable)
@@ -13,6 +13,7 @@ _begin_fstest auto fsr
 . ./common/filter
 
 _require_scratch
+_require_xfs_nocrc
 
 # real QA test starts here
 
index 4261e84973537f3bfae7271b6a37133f35470f2a..c5c5f9b1acbb90368d2a7bdfad85765e616767ee 100755 (executable)
@@ -27,6 +27,9 @@ _require_test
 _require_scratch_nocheck
 _require_xfs_mkfs_cfgfile
 
+# Currently the only conflicting options are v4 specific
+_require_xfs_nocrc
+
 cfgfile=$TEST_DIR/a
 rm -rf $cfgfile
 
index 4ae4d397786d5b975e78269be9bd94b316b24be3..0f6df7deb0372d0bdf05e5ef2e1828657d4b400b 100755 (executable)
@@ -17,6 +17,7 @@ _supported_fs xfs
 _require_scratch_xfs_inobtcount
 _require_command "$XFS_ADMIN_PROG" "xfs_admin"
 _require_xfs_repair_upgrade inobtcount
+_require_xfs_nocrc
 
 # Make sure we can't upgrade to inobt on a V4 filesystem
 _scratch_mkfs -m crc=0,inobtcount=0,finobt=0 >> $seqres.full
index 522358cb3b1601b6e5bdf37ef09a38c0d6eda48a..8bff21711cfc201837f55375f202c237a1a117db 100755 (executable)
@@ -34,6 +34,7 @@ _supported_fs xfs
 _fixed_by_kernel_commit 237d7887ae72 \
        "xfs: show the proper user quota options"
 
+_require_xfs_nocrc
 _require_test
 _require_loop
 _require_xfs_io_command "falloc"