Files
erofs-freebsd-out-tree/tests/TC098-fragments-support.md
T
2026-08-18 09:20:44 +02:00

1.6 KiB

Test Case: Packed-Inode Fragments

Test ID: TC098-fragments-support
Category: Compression Priority: High

Objective

Verify a deterministic whole-file fragment stored in the EROFS packed inode, including full and offset reads. This is an in-image packed inode, not an external fragment device.

Fixture qualification

Use fresh fragment.erofs. The generator runs:

mkfs.erofs -T0 --all-time --all-root --workers=1 \
  -U67360098-0000-0000-0000-000000000098 \
  -zlz4 -C65536 -E all-fragments fragment.erofs sources/fragment

The manifest and verifier must report a nonzero packed NID, fragment feature, and compressed layout for /fragment.dat. Host fsck extracts and compares the entire source before guest testing.

Manual procedure

I=/root/repo22-g6/images
S=/root/repo22-g6/sources/fragment
mkdir -p /mnt/g6
kldload /root/repo22-g6/erofs.ko
mdconfig -a -t vnode -f "$I/fragment.erofs" -u 90
mount -t erofs -o ro /dev/md90 /mnt/g6
stat -f '%z' /mnt/g6/fragment.dat
sha256 "$S/fragment.dat" /mnt/g6/fragment.dat
cmp "$S/fragment.dat" /mnt/g6/fragment.dat
dd if="$S/fragment.dat" of=/tmp/tc098.src bs=1 skip=65536 count=8192 2>/dev/null
dd if=/mnt/g6/fragment.dat of=/tmp/tc098.mnt bs=1 skip=65536 count=8192 2>/dev/null
cmp /tmp/tc098.src /tmp/tc098.mnt

The size must be 100000 bytes, and all comparisons must pass.

Cleanup and zero-state check

umount /mnt/g6
mdconfig -d -u 90
kldunload erofs
rm -f /tmp/tc098.src /tmp/tc098.mnt
mount -p | awk '$3 == "erofs" { print }'
mdconfig -l
kldstat -n erofs 2>/dev/null || true
sysctl -n kern.geom.conftxt | grep -E 'md90|erofs' || true

All four final outputs must be empty.