Files
erofs-freebsd-out-tree/tests/TC086-lz4-sequential-read.md
T
2026-08-18 09:20:44 +02:00

1.8 KiB

Test Case: LZ4 Sequential Read Correctness

Test ID: TC086-lz4-sequential-read

G5 fixture contract: Use G5-MANUAL-SETUP.md. Its generated paths, source comparisons, structured corruption offsets, and cleanup rules supersede placeholder examples in this file. Category: Compression Priority: High

Objective

Verify complete sequential reads of an LZ4-compressed file with two request sizes against the original source bytes. Record timings only; repo22 exposes no filesystem-specific DTrace provider and this test has no fixed throughput threshold.

Fixture

work=$(mktemp -d /tmp/repo22-tc086.XXXXXX)
tests/prepare_error_fixtures.sh "$work/fixtures"
dump.erofs -s "$work/fixtures/valid-lz4.erofs"
dump.erofs --path=/compressed.bin -e "$work/fixtures/valid-lz4.erofs"

The dump must identify /compressed.bin as compressed LZ4 data with real physical extents.

FreeBSD Procedure

mkdir "$work/mnt"
unit=$(mdconfig -a -t vnode -f "$work/fixtures/valid-lz4.erofs")
mount -t erofs -o ro "/dev/$unit" "$work/mnt"

expected=$(sha256 -q "$work/fixtures/source/compressed.bin")
actual=$(sha256 -q "$work/mnt/compressed.bin")
test "$actual" = "$expected"

/usr/bin/time -p dd if="$work/mnt/compressed.bin" \
  of="$work/read-4k.bin" bs=4096 2>"$work/time-4k.txt"
cmp "$work/fixtures/source/compressed.bin" "$work/read-4k.bin"
/usr/bin/time -p dd if="$work/mnt/compressed.bin" \
  of="$work/read-1m.bin" bs=1048576 2>"$work/time-1m.txt"
cmp "$work/fixtures/source/compressed.bin" "$work/read-1m.bin"
cat "$work/time-4k.txt" "$work/time-1m.txt"

umount "$work/mnt"
mdconfig -d -u "${unit#md}"

Expected Results

Both complete outputs compare byte-for-byte with the source and both hashes match. Timing values are recorded with guest CPU, VM, and storage context; one buffer size is not required to outperform the other.