# tests whether $FSTYP is one of the supported filesystems for a test
#
-_supported_fs()
+_check_supported_fs()
{
- local f
+ local res=1
+ local f
- for f
- do
- if [ "$f" = "$FSTYP" -o "$f" = "generic" ]
- then
- return
- fi
- done
+ 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
+}
- _notrun "not suitable for this filesystem type: $FSTYP"
+_supported_fs()
+{
+ _check_supported_fs $* || \
+ _notrun "not suitable for this filesystem type: $FSTYP"
}
_check_if_dev_already_mounted()
. ./common/dmthin
# real QA test starts here
-_supported_fs generic
_require_scratch_nocheck
_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.
-test $FSTYP == "btrfs" && _notrun "btrfs doesn't work that way lol"
+_supported_fs ^btrfs
# Require underlying device support discard
_scratch_mkfs >>$seqres.full 2>&1
. ./common/attr
# real QA test starts here
-_supported_fs generic
_require_scratch
_require_attrs trusted
-test "$FSTYP" = "overlay" && _notrun "Test does not apply to overlayfs."
+_supported_fs ^overlay
_require_extra_fs overlay
_scratch_mkfs >> $seqres.full
# real QA test starts here
-_supported_fs generic
_require_scratch
_require_xfs_io_command "falloc"
_require_xfs_io_command "fiemap"
#
# https://lore.kernel.org/linux-btrfs/20220315164011.GF8241@magnolia/
#
-[ $FSTYP == "xfs" ] && _notrun "test not valid for xfs"
+_supported_fs ^xfs
rm -f $seqres.full