* [PATCH v3] common/casefold: Support for tmpfs casefold test
@ 2024-11-09 23:46 André Almeida
2024-11-11 18:46 ` Gabriel Krisman Bertazi
0 siblings, 1 reply; 2+ messages in thread
From: André Almeida @ 2024-11-09 23:46 UTC (permalink / raw)
To: fstests
Cc: Zorro Lang, kernel-dev, Miklos Szeredi, Eryu Guan, krisman,
Darrick J . Wong, André Almeida
Test casefold support for tmpfs.
Signed-off-by: André Almeida <andrealmeid@igalia.com>
---
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
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH v3] common/casefold: Support for tmpfs casefold test
2024-11-09 23:46 [PATCH v3] common/casefold: Support for tmpfs casefold test André Almeida
@ 2024-11-11 18:46 ` Gabriel Krisman Bertazi
0 siblings, 0 replies; 2+ messages in thread
From: Gabriel Krisman Bertazi @ 2024-11-11 18:46 UTC (permalink / raw)
To: André Almeida
Cc: fstests, Zorro Lang, kernel-dev, Miklos Szeredi, Eryu Guan,
Darrick J . Wong
André Almeida <andrealmeid@igalia.com> writes:
> Test casefold support for tmpfs.
>
> Signed-off-by: André Almeida <andrealmeid@igalia.com>
> ---
> 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
> +}
> +
Now, I noticed there is some infrastructure to provide mount options
through _scratch_mount_options that would be a better fit for this
instead of the custom handlers I previously suggested.
Either way, the test looks good to me:
Reviewed-by: Gabriel Krisman Bertazi <gabriel@krisman.be>
--
Gabriel Krisman Bertazi
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-11-11 18:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-09 23:46 [PATCH v3] common/casefold: Support for tmpfs casefold test André Almeida
2024-11-11 18:46 ` Gabriel Krisman Bertazi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox