test code v1
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
# Test Case: Superblock CRC Field Mismatch
|
||||
|
||||
**Test ID**: TC016-superblock-crc-invalid
|
||||
**Category**: Error Handling
|
||||
**Priority**: High
|
||||
|
||||
## Objective
|
||||
|
||||
Verify that changing only the stored superblock checksum field causes
|
||||
`EINTEGRITY`, with all protected bytes and provider length unchanged.
|
||||
|
||||
## Fixture Qualification
|
||||
|
||||
```sh
|
||||
work=$(mktemp -d /tmp/repo22-tc016.XXXXXX)
|
||||
tests/prepare_error_fixtures.sh "$work/fixtures"
|
||||
grep '^bad-checksum-field ' "$work/fixtures/fixture-evidence.txt"
|
||||
python3 tests/erofs_fixture.py inspect \
|
||||
"$work/fixtures/bad-checksum-field.erofs"
|
||||
wc -c "$work/fixtures/valid-plain.erofs" \
|
||||
"$work/fixtures/bad-checksum-field.erofs"
|
||||
sha256 -q "$work/fixtures/bad-checksum-field.erofs"
|
||||
```
|
||||
|
||||
The mutator flips bit 0 of the little-endian checksum at absolute byte 1028,
|
||||
does not recompute it, asserts checksum invalidity, and changes no other byte.
|
||||
|
||||
## FreeBSD Procedure
|
||||
|
||||
```sh
|
||||
mkdir "$work/mnt"
|
||||
unit=$(mdconfig -a -t vnode -f "$work/fixtures/bad-checksum-field.erofs")
|
||||
set +e
|
||||
mount -t erofs -o ro "/dev/$unit" "$work/mnt" \
|
||||
>"$work/mount.out" 2>"$work/mount.err"
|
||||
status=$?
|
||||
set -e
|
||||
test "$status" -ne 0
|
||||
set +e
|
||||
truss -o "$work/mount.truss" mount -t erofs -o ro "/dev/$unit" \
|
||||
"$work/mnt" >/dev/null 2>&1
|
||||
set -e
|
||||
grep -E 'nmount.*ERR#97' "$work/mount.truss"
|
||||
! mount -p | awk -v path="$work/mnt" '$2 == path { found=1 }
|
||||
END { exit found ? 0 : 1 }'
|
||||
mdconfig -d -u "${unit#md}"
|
||||
```
|
||||
|
||||
## Expected Results
|
||||
|
||||
Mount returns errno 97 (`EINTEGRITY`) with a checksum diagnostic. No mount or
|
||||
md consumer remains.
|
||||
Reference in New Issue
Block a user