Files
erofs-freebsd-out-tree/tests/TC006-multidev-chunk-read.md
T
2026-08-18 09:20:44 +02:00

62 lines
2.0 KiB
Markdown

# Test Case: Real Multi-Device Chunk Read
**Test ID**: TC006-multidev-chunk-read
**Category**: Multi-Device / Chunk-Based
**Priority**: Critical
## Objective
Prove that 8-byte chunk indexes read file data from a live external GEOM
provider, including a range crossing a chunk boundary.
## Fixture
Generate and verify the fresh G6 set as described in `G6-MANUAL-SETUP.md`.
Use `mkfs-blob-primary.erofs` and `mkfs-blob-slot1.blob`. The manifest must
show primary blocks `1`, slot-1 blocks `224`, and every `/tc006.bin` index as
device ID `1`. The 4096-byte primary cannot contain the 98304-byte source.
## Manual procedure
```sh
I=/root/repo22-g6/images
S=/root/repo22-g6/sources/chunk
mkdir -p /mnt/g6
kldload /root/repo22-g6/erofs.ko
mdconfig -a -t vnode -f "$I/mkfs-blob-primary.erofs" -u 90
mdconfig -a -t vnode -f "$I/mkfs-blob-slot1.blob" -u 91
mount -t erofs -o ro -o device.1=/dev/md91 /dev/md90 /mnt/g6
sha256 "$S/tc006.bin" /mnt/g6/tc006.bin
cmp "$S/tc006.bin" /mnt/g6/tc006.bin
dd if="$S/tc006.bin" of=/tmp/tc006.expected bs=1 skip=28672 count=8192 2>/dev/null
dd if=/mnt/g6/tc006.bin of=/tmp/tc006.actual bs=1 skip=28672 count=8192 2>/dev/null
cmp /tmp/tc006.expected /tmp/tc006.actual
truss -f -o /tmp/tc006-ebusy.truss mdconfig -d -u 91
tail -20 /tmp/tc006-ebusy.truss
sysctl -n kern.geom.conftxt | grep -A8 -B2 'Geom name: md91'
```
The detach must fail with `EBUSY`, proving a live external consumer.
## Expected results
- Mount, full-file `cmp`, SHA256, and the 8192-byte cross-boundary range pass.
- The external detach returns exactly `EBUSY` while mounted.
- No panic, trap, hang, or unexpected EROFS dmesg message occurs.
## Cleanup and zero-state check
```sh
umount /mnt/g6
mdconfig -d -u 91
mdconfig -d -u 90
kldunload erofs
rm -f /tmp/tc006.expected /tmp/tc006.actual
mount -p | awk '$3 == "erofs" { print }'
mdconfig -l
kldstat -n erofs 2>/dev/null || true
sysctl -n kern.geom.conftxt | grep -E 'md9[01]|erofs' || true
```
All four final outputs must be empty.