diff mbox series

[4/4] replace _supported_fs with _exclude_fs

Message ID 20241210065900.1235379-5-hch@lst.de (mailing list archive)
State New
Headers show
Series [1/4] generic/363: remove _supported_fs xfs | expand

Commit Message

Christoph Hellwig Dec. 10, 2024, 6:58 a.m. UTC
Tests don't require a list of supported file systems, as that is deducted
from the test directory name.  Instead we exclude specific file systems
from a few common tests, and pick the extN variants supported for the
ext4 directory.

Replace _supported_fs with a new _exclude_fs that takes only a single
file systems as the argument, making it easier to explain why the file
system is not supported.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 common/rc            | 30 ++++++++----------------------
 tests/ext-common/002 |  2 +-
 tests/ext-common/036 |  3 ++-
 tests/ext-common/037 |  2 +-
 tests/ext-common/038 |  3 +--
 tests/ext-common/039 |  3 ++-
 tests/ext-common/043 |  2 +-
 tests/generic/187    |  8 +++++---
 tests/generic/294    |  2 +-
 tests/generic/357    |  2 +-
 tests/generic/362    |  3 ++-
 tests/generic/465    |  2 +-
 tests/generic/500    |  2 +-
 tests/generic/631    |  4 +++-
 tests/generic/679    |  2 +-
 tests/generic/699    |  3 ++-
 tests/generic/732    |  4 +++-
 tests/generic/740    |  7 ++++++-
 18 files changed, 42 insertions(+), 42 deletions(-)
diff mbox series

Patch

diff --git a/common/rc b/common/rc
index 796d98e5cada..5ef5038a6d23 100644
--- a/common/rc
+++ b/common/rc
@@ -1766,30 +1766,16 @@  _fail()
     exit 1
 }
 
-# tests whether $FSTYP is one of the supported filesystems for a test
 #
-_check_supported_fs()
-{
-	local res=1
-	local f
-
-	for f; do
-		# ^FS means black listed fs
-		if [ "$f" = "^$FSTYP" ]; then
-			return 1
-		elif [ "$f" = "generic" ] || [[ "$f" == "^"* ]]; then
-			# ^FS implies "generic ^FS"
-			res=0
-		elif [ "$f" = "$FSTYP" ]; then
-			return 0
-		fi
-	done
-	return $res
-}
-
-_supported_fs()
+# Tests whether $FSTYP should be exclude from this test.
+#
+# In general this should be avoided in favor of feature tests, and when this
+# helper has to be used, it should include a comment on why a specific file
+# system is excluded.
+#
+_exclude_fs()
 {
-	_check_supported_fs $* || \
+	[ "$1" = "$FSTYP" ] && \
 		_notrun "not suitable for this filesystem type: $FSTYP"
 }
 
diff --git a/tests/ext-common/002 b/tests/ext-common/002
index 7b3d5918bde9..6c1e1d926973 100755
--- a/tests/ext-common/002
+++ b/tests/ext-common/002
@@ -29,7 +29,7 @@  _cleanup()
 # Import common functions.
 . ./common/filter
 
-_supported_fs ^ext2
+_exclude_fs ext2
 
 _require_scratch_nocheck
 _require_scratch_shutdown
diff --git a/tests/ext-common/036 b/tests/ext-common/036
index 729d842df6e7..4a1471fd4cb5 100755
--- a/tests/ext-common/036
+++ b/tests/ext-common/036
@@ -15,7 +15,8 @@  _begin_fstest auto quick
 # Import common functions.
 . ./common/filter
 
-_supported_fs ^ext2
+_exclude_fs ext2
+
 _require_scratch
 
 echo "Silence is golden"
diff --git a/tests/ext-common/037 b/tests/ext-common/037
index 3f2232f0de60..dea02a79927a 100755
--- a/tests/ext-common/037
+++ b/tests/ext-common/037
@@ -15,7 +15,7 @@  _begin_fstest auto quick
 # Import common functions.
 . ./common/filter
 
-_supported_fs ^ext2
+_exclude_fs ext2
 
 # nofsck as we modify sb via debugfs
 _require_scratch_nocheck
diff --git a/tests/ext-common/038 b/tests/ext-common/038
index 09d3b10bdcf2..07b090b11f13 100755
--- a/tests/ext-common/038
+++ b/tests/ext-common/038
@@ -10,9 +10,8 @@ 
 . ./common/preamble
 _begin_fstest auto quick
 
-# Import common functions.
+_exclude_fs ext2
 
-_supported_fs ^ext2
 _require_scratch
 _require_command "$DEBUGFS_PROG" debugfs
 
diff --git a/tests/ext-common/039 b/tests/ext-common/039
index be766668df60..2e99c8ff9ffd 100755
--- a/tests/ext-common/039
+++ b/tests/ext-common/039
@@ -56,7 +56,8 @@  chattr_opt: $chattr_opt" >>$seqres.full
 	done
 }
 
-_supported_fs ^ext2
+_exclude_fs ext2
+
 _require_scratch
 _exclude_scratch_mount_option dax
 
diff --git a/tests/ext-common/043 b/tests/ext-common/043
index cf0bef4e7407..8d124ba36f72 100755
--- a/tests/ext-common/043
+++ b/tests/ext-common/043
@@ -12,7 +12,7 @@  _begin_fstest auto quick
 # Import common functions.
 . ./common/filter
 
-_supported_fs ^ext2
+_exclude_fs ext2
 
 _require_scratch
 _require_test_program "t_get_file_time"
diff --git a/tests/generic/187 b/tests/generic/187
index 2a06aff35e58..536ce9fa9ab8 100755
--- a/tests/generic/187
+++ b/tests/generic/187
@@ -28,10 +28,12 @@  _cleanup()
 . ./common/filter
 . ./common/reflink
 
+# btrfs can't fragment free space.
+_exclude_fs btrfs
+
+# This test is unreliable on NFS, as it depends on the exported filesystem.
+_exclude_fs nfs
 
-# btrfs can't fragment free space. This test is unreliable on NFS, as it
-# depends on the exported filesystem.
-_supported_fs ^btrfs ^nfs
 _require_scratch_reflink
 _require_cp_reflink
 _require_xfs_io_command "falloc"
diff --git a/tests/generic/294 b/tests/generic/294
index 54b89a26294f..b07459116371 100755
--- a/tests/generic/294
+++ b/tests/generic/294
@@ -16,7 +16,7 @@  _begin_fstest auto quick
 
 # NFS will optimize away the on-the-wire lookup before attempting to
 # create a new file (since that means an extra round trip).
-_supported_fs ^nfs
+_exclude_fs nfs
 
 _require_scratch
 _require_symlinks
diff --git a/tests/generic/357 b/tests/generic/357
index 8db31f8b0432..51c6d5efd2d7 100755
--- a/tests/generic/357
+++ b/tests/generic/357
@@ -26,7 +26,7 @@  _cleanup()
 
 # For NFS, a reflink is just a CLONE operation, and after that
 # point it's dealt with by the server.
-_supported_fs ^nfs
+_exclude_fs nfs
 
 _require_scratch_swapfile
 _require_scratch_reflink
diff --git a/tests/generic/362 b/tests/generic/362
index 2396ec7d3a57..3a1993e81d4b 100755
--- a/tests/generic/362
+++ b/tests/generic/362
@@ -11,7 +11,8 @@ 
 _begin_fstest auto quick
 
 # NFS forbade open with O_APPEND|O_DIRECT
-_supported_fs ^nfs
+_exclude_fs nfs
+
 _require_test
 _require_odirect
 _require_test_program dio-append-buf-fault
diff --git a/tests/generic/465 b/tests/generic/465
index f8c4ea9671a2..5b49040e3ad0 100755
--- a/tests/generic/465
+++ b/tests/generic/465
@@ -20,7 +20,7 @@  _cleanup()
 # Import common functions.
 . ./common/filter
 
-_supported_fs ^nfs
+_exclude_fs nfs
 
 _require_aiodio aio-dio-append-write-read-race
 _require_test_program "feature"
diff --git a/tests/generic/500 b/tests/generic/500
index ba6e902ec96b..c5492a09246c 100755
--- a/tests/generic/500
+++ b/tests/generic/500
@@ -41,7 +41,7 @@  _require_dm_target thin-pool
 # and since we've filled the thinp device it'll return EIO, which will make
 # btrfs flip read only, making it fail this test when it just won't work right
 # for us in the first place.
-_supported_fs ^btrfs
+_exclude_fs btrfs
 
 # Require underlying device support discard
 _scratch_mkfs >>$seqres.full 2>&1
diff --git a/tests/generic/631 b/tests/generic/631
index 642d47863987..8e2cf9c63b77 100755
--- a/tests/generic/631
+++ b/tests/generic/631
@@ -37,8 +37,10 @@  _cleanup()
 
 _require_scratch
 _require_attrs trusted
-_supported_fs ^overlay
+
+_exclude_fs overlay
 _require_extra_fs overlay
+
 _fixed_by_kernel_commit 6da1b4b1ab36 \
 	"xfs: fix an ABBA deadlock in xfs_rename"
 
diff --git a/tests/generic/679 b/tests/generic/679
index 4c74101c5834..741ddf21502f 100755
--- a/tests/generic/679
+++ b/tests/generic/679
@@ -23,7 +23,7 @@  _require_xfs_io_command "fiemap"
 #
 #   https://lore.kernel.org/linux-btrfs/20220315164011.GF8241@magnolia/
 #
-_supported_fs ^xfs
+_exclude_fs xfs
 
 rm -f $seqres.full
 
diff --git a/tests/generic/699 b/tests/generic/699
index 3079a861df74..620a40aa3921 100755
--- a/tests/generic/699
+++ b/tests/generic/699
@@ -21,8 +21,9 @@  _cleanup()
 	rm -r -f $tmp.*
 }
 
-_supported_fs ^overlay
+_exclude_fs overlay
 _require_extra_fs overlay
+
 _require_scratch
 _require_chown
 _require_idmapped_mounts
diff --git a/tests/generic/732 b/tests/generic/732
index e907a009fe16..83caa0bc915c 100755
--- a/tests/generic/732
+++ b/tests/generic/732
@@ -24,7 +24,9 @@  _cleanup()
 # This case give a assumption that the same mount options for
 # different mount point will share the same superblock, which won't
 # sucess for the follow fs.
-_supported_fs ^nfs ^overlay ^tmpfs
+_exclude_fs nfs
+_exclude_fs overlay
+_exclude_fs tmpfs
 
 _require_test
 _require_scratch
diff --git a/tests/generic/740 b/tests/generic/740
index 903e891db0fd..10817521cc93 100755
--- a/tests/generic/740
+++ b/tests/generic/740
@@ -14,7 +14,12 @@  _begin_fstest mkfs auto quick
 
 # a bunch of file systems don't support foreign fs detection
 # ext* do support it, but disable the feature when called non-interactively
-_supported_fs ^ext2 ^ext3 ^ext4 ^jfs ^ocfs2 ^udf
+_exclude_fs ext2
+_exclude_fs ext3
+_exclude_fs ext4
+_exclude_fs jfs
+_exclude_fs ocfs2
+_exclude_fs udf
 
 _require_block_device "${SCRATCH_DEV}"
 # not all the FS support zoned block device