test code v1
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
# Test Case: Reserved Inode Format Rejection
|
||||
|
||||
**Test ID**: TC113-corrupted-inode
|
||||
**Category**: Error Handling
|
||||
**Priority**: Critical
|
||||
|
||||
## Objective
|
||||
|
||||
Verify a checksum-valid image mounts, but lookup/open of the resolved
|
||||
`/inode-target.txt` inode with reserved `i_format` bit `0x8000` fails with
|
||||
`EOPNOTSUPP`; an unaffected file must remain readable.
|
||||
|
||||
## Fixture Qualification
|
||||
|
||||
```sh
|
||||
work=$(mktemp -d /tmp/repo22-tc113.XXXXXX)
|
||||
tests/prepare_error_fixtures.sh "$work/fixtures"
|
||||
cc -O2 -Wall -Wextra -std=c17 tests/read_probe.c -o "$work/read_probe"
|
||||
python3 tests/erofs_fixture.py inspect \
|
||||
"$work/fixtures/bad-inode-format.erofs" --path /inode-target.txt
|
||||
grep '^bad-inode-format ' "$work/fixtures/fixture-evidence.txt"
|
||||
sha256 -q "$work/fixtures/bad-inode-format.erofs"
|
||||
```
|
||||
|
||||
The mutator resolves the root dirent, calculates the inode byte offset from the
|
||||
metadata block and NID, asserts the old format, sets only reserved bit
|
||||
`0x8000`, recomputes CRC32C, and preserves provider length.
|
||||
|
||||
## FreeBSD Procedure
|
||||
|
||||
```sh
|
||||
mkdir "$work/mnt"
|
||||
unit=$(mdconfig -a -t vnode -f "$work/fixtures/bad-inode-format.erofs")
|
||||
mount -t erofs -o ro "/dev/$unit" "$work/mnt"
|
||||
cmp "$work/fixtures/source/control.txt" "$work/mnt/control.txt"
|
||||
truss -o "$work/read.truss" "$work/read_probe" expect-error \
|
||||
"$work/mnt/inode-target.txt" 45 | tee "$work/error.out"
|
||||
grep -q 'expected_errno=45' "$work/error.out"
|
||||
grep -E '(openat|read).*ERR#45' "$work/read.truss"
|
||||
cmp "$work/fixtures/source/control.txt" "$work/mnt/control.txt"
|
||||
umount "$work/mnt"
|
||||
mdconfig -d -u "${unit#md}"
|
||||
```
|
||||
|
||||
## Expected Results
|
||||
|
||||
Only the target returns errno 45 (`EOPNOTSUPP`). The mount remains usable and
|
||||
cleans up fully.
|
||||
Reference in New Issue
Block a user