2.2 KiB
2.2 KiB
Test Case: MicroLZMA Consumption and Corruption
Test ID: TC144-microlzma-consumption-and-corruption
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: Critical Regression: MicroLZMA full/partial completion semantics
Objective
Verify MicroLZMA input-consumption rules for complete streams, early-success rules for partial references, and deterministic rejection of damaged streams.
Preconditions
- FreeBSD 15 guest and repo22 module.
- A full-index LZMA image with:
/a.dat: 1048576-byte complete MicroLZMA stream;/b.dat: 700000-byte partial reference to/a.dat's pcluster;- the
/b.datHEAD record markedZ_EROFS_LI_PARTIAL_REF. - the reused pblk and
D0_CBLKCNTboth equal/a.dat's values.
- A corrupted copy with a byte changed inside the proven compressed byte range.
- Source files and their SHA256 values available on the guest.
Test Steps
- Prove the pcluster and partial-reference record with
dump.erofsand a byte-level parser. - Mount the valid image and hash
/a.datcompletely. - Hash
/b.datcompletely; this requests only a prefix of the reused stream. - Compare reads at offsets 65500 and 524287 against source bytes.
- Mount the corrupted image and read
/a.datwith an errno-reporting helper. - Confirm the implementation's complete-stream condition includes both
XZ_STREAM_ENDandbuffer.in_pos == srclen. - Compare
vmstat -mactive EROFS allocations and pre/postdmesg.
Expected Results
/a.datsucceeds only after exact output,XZ_STREAM_END, and complete compressed-input consumption./b.datacceptsXZ_OKafter the requested partial output is filled.- Both complete SHA256 values and random ranges match.
- The corrupted full stream returns errno 5 (
EIO). control.binin the same corrupted image still matches its source.- Decoder state is freed on success and error; active EROFS allocations return to zero after unmount/unload.
Cleanup
umount /mnt/repo22 2>/dev/null || true
mdconfig -d -u "${unit#md}" 2>/dev/null || true
kldunload -i "${module_id}"