]> www.infradead.org Git - users/hch/xfstests-dev.git/commitdiff
common/casefold: Support for tmpfs casefold test
authorAndré Almeida <andrealmeid@igalia.com>
Sat, 9 Nov 2024 23:46:18 +0000 (20:46 -0300)
committerZorro Lang <zlang@kernel.org>
Fri, 15 Nov 2024 06:50:56 +0000 (14:50 +0800)
Test casefold support for tmpfs.

Signed-off-by: André Almeida <andrealmeid@igalia.com>
Reviewed-by: Gabriel Krisman Bertazi <gabriel@krisman.be>
Signed-off-by: Zorro Lang <zlang@kernel.org>
common/casefold
common/rc
tests/generic/556

index d9126f4c59e6f8482cb8d3d7271d4752ee94223a..2aae5e5e6c8925d2dcb1f8b367f116be083f832b 100644 (file)
@@ -12,6 +12,9 @@ _has_casefold_kernel_support()
        f2fs)
                test -f '/sys/fs/f2fs/features/casefold'
                ;;
+       tmpfs)
+               test -f '/sys/fs/tmpfs/features/casefold'
+               ;;
        *)
                # defaults to unsupported
                false
@@ -52,6 +55,9 @@ _scratch_mkfs_casefold()
        f2fs)
                _scratch_mkfs -C utf8 $*
                ;;
+       tmpfs)
+               # there's no mkfs for tmpfs, just return
+               ;;
        *)
                _notrun "Don't know how to mkfs with casefold support on $FSTYP"
                ;;
@@ -67,12 +73,52 @@ _scratch_mkfs_casefold_strict()
        f2fs)
                _scratch_mkfs -C utf8:strict
                ;;
+       tmpfs)
+               # there's no mkfs for tmpfs, just return
+               ;;
        *)
                _notrun "Don't know how to mkfs with casefold-strict support on $FSTYP"
                ;;
        esac
 }
 
+_scratch_mount_casefold()
+{
+       case $FSTYP in
+       ext4)
+               _scratch_mount
+               ;;
+       f2fs)
+               _scratch_mount
+               ;;
+       tmpfs)
+               mount -t tmpfs -o casefold tmpfs $SCRATCH_MNT
+               ;;
+       *)
+               _notrun "Don't know how to mount with casefold support on $FSTYP"
+               ;;
+       esac
+}
+
+_scratch_mount_casefold_strict()
+{
+       case $FSTYP in
+       ext4)
+               _scratch_mount
+               ;;
+       f2fs)
+               _scratch_mount
+               ;;
+       tmpfs)
+               mount -t tmpfs -o casefold,strict_encoding tmpfs $SCRATCH_MNT
+               ;;
+       *)
+               _notrun "Don't know how to mount with casefold support on $FSTYP"
+               ;;
+       esac
+}
+
+
 # To get the exact disk name, we need some method that does a
 # getdents() on the parent directory, such that we don't get
 # normalized/casefolded results.  'Find' works ok.
index 2af26f23f9b60bb7fe61677e8df9da9a712d35d7..2ee46e5101e1688362b8c15f008f1758fa93a4f3 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -374,6 +374,9 @@ _scratch_unmount()
        btrfs)
                $UMOUNT_PROG $SCRATCH_MNT
                ;;
+       tmpfs)
+               $UMOUNT_PROG $SCRATCH_MNT
+               ;;
        *)
                $UMOUNT_PROG $SCRATCH_DEV
                ;;
index 51d2d4820b18bff9ee54164d64db7848c984ff31..d3396ae3bf146536890af0fd4c772c05fca205f7 100755 (executable)
@@ -18,7 +18,11 @@ _require_symlinks
 _require_check_dmesg
 _require_attrs
 
-sdev=$(_short_dev ${SCRATCH_DEV})
+if [ "$FSTYP" == "tmpfs" ]; then
+       sdev="tmpfs"
+else
+       sdev="\($(_short_dev ${SCRATCH_DEV})\)"
+fi
 
 filename1="file.txt"
 filename2="FILE.TXT"
@@ -485,10 +489,10 @@ test_strict_mode_invalid_filename()
 
 _scratch_mkfs_casefold >>$seqres.full 2>&1
 
-_scratch_mount
+_scratch_mount_casefold
 
 _check_dmesg_for \
-       "\(${sdev}\): Using encoding defined by superblock: utf8" || \
+       "(${sdev}): Using encoding" || \
        _fail "Could not mount with encoding: utf8"
 
 test_casefold_flag_basic
@@ -517,7 +521,7 @@ _check_scratch_fs
 
 # Test Strict Mode
 _scratch_mkfs_casefold_strict >>$seqres.full 2>&1
-_scratch_mount
+_scratch_mount_casefold_strict
 
 test_strict_mode_invalid_filename