Files
erofs-freebsd-out-tree/tests/TC102-deflate-level1.md
T
2026-08-18 09:20:44 +02:00

55 lines
1.7 KiB
Markdown

# Test Case: DEFLATE Level 1 Read Correctness
**Test ID**: TC102-deflate-level1
**G5 fixture contract**: Use [G5-MANUAL-SETUP.md](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 full and offset reads from an erofs-utils 1.8.6 DEFLATE level 1 image.
## Fixture and Helper
```sh
work=$(mktemp -d /tmp/repo22-tc102.XXXXXX)
tests/prepare_error_fixtures.sh "$work/fixtures"
cc -O2 -Wall -Wextra -std=c17 tests/read_probe.c -o "$work/read_probe"
dump.erofs -s "$work/fixtures/valid-deflate-level1.erofs"
dump.erofs --path=/compressed.bin -e \
"$work/fixtures/valid-deflate-level1.erofs"
```
The superblock and extent output must identify DEFLATE-compressed data. The
image is generated with `-zdeflate,level=1 -C65536`.
## FreeBSD Procedure
```sh
mkdir "$work/mnt"
unit=$(mdconfig -a -t vnode \
-f "$work/fixtures/valid-deflate-level1.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"
"$work/read_probe" pread "$work/mnt/compressed.bin" 32768 4096 \
"$work/guest-range.bin"
"$work/read_probe" pread "$work/fixtures/source/compressed.bin" 32768 4096 \
"$work/source-range.bin"
cmp "$work/source-range.bin" "$work/guest-range.bin"
umount "$work/mnt"
mdconfig -d -u "${unit#md}"
```
## Expected Results
The complete mounted-file hash equals the source hash, and the fixed 4 KiB
range compares byte-for-byte. The invalid former command
`sha256 output vs original` is not used.