test code v1
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
# Test Case: Empty File Read
|
||||
|
||||
**Test ID**: TC120-empty-file
|
||||
**Category**: Boundary & Stress
|
||||
**Priority**: Medium
|
||||
**Regression**: None
|
||||
|
||||
## Objective
|
||||
|
||||
Verify exact zero-length inode, EOF, seek, hash, and close behavior.
|
||||
|
||||
## Preconditions
|
||||
|
||||
- Complete `G7-MANUAL-SETUP.md`.
|
||||
- Load the exact G7 KLD by full path.
|
||||
- Verify the guest copy of `SOURCE-SHA256SUMS` before mounting.
|
||||
|
||||
## Manual Steps
|
||||
|
||||
```sh
|
||||
G7=/root/repo22-g7
|
||||
FIX=$G7/fixtures
|
||||
SRC=$FIX/sources/boundaries/empty.bin
|
||||
IMAGE=$FIX/images/boundaries.erofs
|
||||
MNT=/mnt/repo22-g7-tc120
|
||||
E=$G7/evidence/TC120
|
||||
mkdir -p "$MNT" "$E"
|
||||
unit=$(mdconfig -a -t vnode -f "$IMAGE")
|
||||
printf 'md=%s\n' "$unit" | tee "$E/provider.txt"
|
||||
mount -t erofs -o ro "/dev/$unit" "$MNT"
|
||||
stat -f 'size=%z mode=%Sp name=%N' "$SRC" "$MNT/empty.bin" \
|
||||
| tee "$E/stat.txt"
|
||||
source_hash=$(sha256 -q "$SRC")
|
||||
target_hash=$(sha256 -q "$MNT/empty.bin")
|
||||
printf 'source=%s\ntarget=%s\n' "$source_hash" "$target_hash" \
|
||||
| tee "$E/hashes.txt"
|
||||
test "$source_hash" = "$target_hash"
|
||||
cmp "$SRC" "$MNT/empty.bin"
|
||||
"$G7/g7_probe" empty "$MNT/empty.bin" | tee "$E/probe.txt"
|
||||
umount "$MNT"
|
||||
mdconfig -d -u "${unit#md}"
|
||||
test -z "$(mount -p | awk -v m="$MNT" '$2 == m { print }')"
|
||||
test -z "$(mdconfig -l | tr ' ' '\n' | grep -x "$unit")"
|
||||
```
|
||||
|
||||
## PASS Gate
|
||||
|
||||
- Both sizes are exactly 0 and both SHA256 values are the empty-file hash.
|
||||
- `cmp` exits 0.
|
||||
- The probe reports `read_bytes=0`, both seek offsets 0, and exit 0.
|
||||
- The exact mount and md provider are absent after cleanup.
|
||||
|
||||
Any kernel panic, trap, hang, or unexpected EROFS dmesg error is KFAIL and
|
||||
requires an issue report without changing `src`.
|
||||
Reference in New Issue
Block a user