Files
erofs-freebsd-out-tree/tests/TC123-long-filename.md
T
2026-08-13 10:44:59 +02:00

1.8 KiB

Test Case: 255-byte Filename

Test ID: TC123-long-filename
Category: Boundary & Stress
Priority: Medium
Regression: None

Objective

Verify exact NAME_MAX lookup, readdir name bytes, stat, and file content.

Preconditions

  • Complete G7-MANUAL-SETUP.md.
  • Use the fixture's ASCII LONG-NAME; its byte count must be 255.

Manual Steps

G7=/root/repo22-g7
FIX=$G7/fixtures
SRCROOT=$FIX/sources/boundaries
IMAGE=$FIX/images/boundaries.erofs
MNT=/mnt/repo22-g7-tc123
E=$G7/evidence/TC123
mkdir -p "$MNT" "$E"
long_name=$(cat "$FIX/LONG-NAME")
name_bytes=$(printf '%s' "$long_name" | wc -c | tr -d ' ')
printf 'name_bytes=%s\nname=%s\n' "$name_bytes" "$long_name" \
  | tee "$E/name.txt"
test "$name_bytes" -eq 255
unit=$(mdconfig -a -t vnode -f "$IMAGE")
mount -t erofs -o ro "/dev/$unit" "$MNT"
(cd "$SRCROOT" && find longname -type f -print | sort) > "$E/source.names"
(cd "$MNT" && find longname -type f -print | sort) > "$E/target.names"
cmp "$E/source.names" "$E/target.names"
test "$(wc -l < "$E/target.names" | tr -d ' ')" -eq 1
stat -f 'size=%z name=%N' "$MNT/longname/$long_name" | tee "$E/stat.txt"
cmp "$SRCROOT/longname/$long_name" "$MNT/longname/$long_name"
source_hash=$(sha256 -q "$SRCROOT/longname/$long_name")
target_hash=$(sha256 -q "$MNT/longname/$long_name")
printf 'source=%s\ntarget=%s\n' "$source_hash" "$target_hash" \
  | tee "$E/hashes.txt"
test "$source_hash" = "$target_hash"
umount "$MNT"
mdconfig -d -u "${unit#md}"
test -z "$(mount -p | awk -v m="$MNT" '$2 == m { print }')"
test -z "$(mdconfig -l | tr ' ' '\n' | grep -x "$unit")"

PASS Gate

  • The filename is exactly 255 bytes and readdir returns that one exact name.
  • Stat succeeds; source/mount cmp and SHA256 values match.
  • No truncation, extra entry, panic, hang, or cleanup leak occurs.