Files
erofs-freebsd-out-tree/tests/TC034-tailpacking-boundary.md
T
2026-08-18 09:20:44 +02:00

1.2 KiB

Test Case: Tailpacking Block Boundaries

Test ID: TC034-tailpacking-boundary

Objective

Verify the actual erofs-utils boundary choices at 4095, 4096, and 4097 bytes, including the one-byte inline tail case.

Fixture

Use images/inline.erofs and the three matching files under source/inline. Structured evidence requires layouts 0,0,2 respectively. A 4095-byte payload cannot fit beside a 32-byte inode in one 4096-byte metadata block, so it is not claimed as fully inline.

Procedure

for size in 4095 4096 4097; do
  stat -f '%N size=%z blocks=%b' "$mnt/file-$size.dat"
  cmp "/tmp/repo22-g1/source/inline/file-$size.dat" "$mnt/file-$size.dat"
  sha256 "/tmp/repo22-g1/source/inline/file-$size.dat" "$mnt/file-$size.dat"
done
./read_probe pread "$mnt/file-4097.dat" 4088 9 /tmp/tc034-boundary
dd if=/tmp/repo22-g1/source/inline/file-4097.dat \
  of=/tmp/tc034-source bs=1 skip=4088 count=9 2>/dev/null
cmp /tmp/tc034-source /tmp/tc034-boundary

Expected Results

  • Exact sizes and full hashes match for all three files.
  • 4095 and 4096 are FLAT_PLAIN; 4097 is FLAT_INLINE with a one-byte tail.
  • The nine-byte cross-boundary range matches; cleanup succeeds.