[PATCH v3] common/casefold: Support for tmpfs casefold test

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]



Test casefold support for tmpfs.

Signed-off-by: André Almeida <andrealmeid@xxxxxxxxxx>
---
 common/casefold   | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 common/rc         |  3 +++
 tests/generic/556 | 12 ++++++++----
 3 files changed, 57 insertions(+), 4 deletions(-)

diff --git a/common/casefold b/common/casefold
index d9126f4c..2aae5e5e 100644
--- a/common/casefold
+++ b/common/casefold
@@ -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.
diff --git a/common/rc b/common/rc
index 2af26f23..2ee46e51 100644
--- 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
 		;;
diff --git a/tests/generic/556 b/tests/generic/556
index 51d2d482..d3396ae3 100755
--- a/tests/generic/556
+++ b/tests/generic/556
@@ -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
 
-- 
2.47.0





[Index of Archives]     [Linux Filesystems Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux