summaryrefslogtreecommitdiff
path: root/tests/xfs/597
blob: 35363729107234e086bc6812c13d3bc3f6dde248 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#! /bin/bash
# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2023 Oracle.  All Rights Reserved.
#
# FS QA Test No. 597
#
# Make sure that the kernel and userspace agree on which byte sequences are
# ASCII uppercase letters, and how to convert them.
#
. ./common/preamble
_begin_fstest auto ci dir

# Import common functions.
. ./common/filter

_fixed_by_kernel_commit a9248538facc \
	"xfs: stabilize the dirent name transformation function used for ascii-ci dir hash computation"
_fixed_by_kernel_commit 9dceccc5822f \
	"xfs: use the directory name hash function for dir scrubbing"

_supported_fs xfs
_require_scratch
_require_xfs_mkfs_ciname

_scratch_mkfs -n version=ci > $seqres.full
_scratch_mount

# Create a two-block directory to force leaf format
mkdir "$SCRATCH_MNT/lol"
touch "$SCRATCH_MNT/lol/autoexec.bat"
i=0
dblksz=$(_xfs_get_dir_blocksize "$SCRATCH_MNT")
nr_dirents=$((dblksz * 2 / 256))

for ((i = 0; i < nr_dirents; i++)); do
	name="$(printf "y%0254d" $i)"
	ln "$SCRATCH_MNT/lol/autoexec.bat" "$SCRATCH_MNT/lol/$name"
done

dirsz=$(stat -c '%s' $SCRATCH_MNT/lol)
test $dirsz -gt $dblksz || echo "dir size $dirsz, expected at least $dblksz?"
stat $SCRATCH_MNT/lol >> $seqres.full

# Create names with extended ascii characters in them to exploit the fact
# that the Linux kernel will transform extended ASCII uppercase characters
# but libc won't.  Need to force LANG=C here so that awk doesn't spit out utf8
# sequences.
test "$LANG" = "C" || _notrun "LANG=C required"
awk 'END { for (i = 192; i < 247; i++) printf("%c\n", i); }' < /dev/null | while read name; do
	ln "$SCRATCH_MNT/lol/autoexec.bat" "$SCRATCH_MNT/lol/$name" 2>&1 | _filter_scratch
done

# Now just let repair run

status=0
exit