test code v1
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
# Test Case: Uncompressed Data Corruption Boundary
|
||||
|
||||
**Test ID**: TC119-data-crc-mismatch
|
||||
**Category**: Data Integrity Semantics
|
||||
**Priority**: High
|
||||
|
||||
## Objective
|
||||
|
||||
Verify the actual EROFS integrity boundary. FLAT_PLAIN payload has no per-file
|
||||
CRC, so one targeted raw-data bit flip is returned to the caller and detected
|
||||
only by external byte/hash comparison. A fictional kernel data-CRC error is not
|
||||
expected.
|
||||
|
||||
## Fixture Qualification
|
||||
|
||||
```sh
|
||||
work=$(mktemp -d /tmp/repo22-tc119.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/raw-data-corrupt.erofs" --path /plain.bin
|
||||
grep '^raw-data-corrupt ' "$work/fixtures/fixture-evidence.txt"
|
||||
wc -c "$work/fixtures/valid-plain.erofs" \
|
||||
"$work/fixtures/raw-data-corrupt.erofs"
|
||||
sha256 -q "$work/fixtures/raw-data-corrupt.erofs"
|
||||
```
|
||||
|
||||
The mutator resolves `/plain.bin`, proves nonempty FLAT_PLAIN layout, flips bit
|
||||
`0x80` at file offset 257, records the absolute provider byte, preserves media
|
||||
size, and verifies that the unchanged superblock checksum remains valid.
|
||||
|
||||
## FreeBSD Procedure
|
||||
|
||||
```sh
|
||||
mkdir "$work/mnt"
|
||||
unit=$(mdconfig -a -t vnode -f "$work/fixtures/raw-data-corrupt.erofs")
|
||||
mount -t erofs -o ro "/dev/$unit" "$work/mnt"
|
||||
source_hash=$(sha256 -q "$work/fixtures/source/plain.bin")
|
||||
mounted_hash=$(sha256 -q "$work/mnt/plain.bin")
|
||||
test "$source_hash" != "$mounted_hash"
|
||||
"$work/read_probe" pread "$work/fixtures/source/plain.bin" 257 1 \
|
||||
"$work/source-byte.bin"
|
||||
"$work/read_probe" pread "$work/mnt/plain.bin" 257 1 \
|
||||
"$work/mounted-byte.bin"
|
||||
! cmp -s "$work/source-byte.bin" "$work/mounted-byte.bin"
|
||||
cmp "$work/fixtures/source/control.txt" "$work/mnt/control.txt"
|
||||
umount "$work/mnt"
|
||||
mdconfig -d -u "${unit#md}"
|
||||
```
|
||||
|
||||
## Expected Results
|
||||
|
||||
Mount and all reads succeed. The exact target byte and complete file hash differ
|
||||
from source, while control data matches. No `EIO` or data-CRC diagnostic is
|
||||
expected. Record source, image, mounted-file hashes, target bytes, dmesg delta,
|
||||
and cleanup.
|
||||
Reference in New Issue
Block a user