# Test Case: LZMA Large File Decompression

**Test ID**: TC108-lzma-large-file  

**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  
**Regression**: None

## Objective
Verify LZMA decompression works correctly for large files (100MB+).

## Preconditions
- `images/lzma-large.erofs`, generated with LZMA level 6
- `/large.bin` and `sources/lzma-large/large.bin`, exactly 104857601 bytes
- FreeBSD 13.0+ with liblzma

## Test Steps
1. Create image with large LZMA-compressed file
2. Attach and mount: `unit=$(mdconfig -a -t vnode -f test.img); mount -t erofs -o ro /dev/${unit} /mnt`
3. Compare complete source and guest SHA256, then run
   `timeout 1800 cmp SOURCE /mnt/large.bin`.
4. Compare 4096 bytes at offsets 0, 52428800, and 103809024 with the source.
5. Record `vmstat -m` while mounted and after cleanup; active EROFS
   allocations must return to zero.

## Expected Results
- Large file reads successfully
- Checksum matches original
- Random access works at any offset
- Memory usage < 256MB during decompression

## Verification Method
- SHA256 checksum verification
- Random read correctness at offsets: 0, 50MB, 99MB
- Memory usage monitored via top
- No kernel panics or OOM

## Cleanup
```sh
umount /mnt
mdconfig -d -u "${unit#md}"
rm -f /tmp/out
```

## Notes
Tests feature 60: LZMA decompression with large files.
