# Test Case: Many Small Files

**Test ID**: TC124-many-small-files  
**Category**: Boundary & Stress  
**Priority**: High  
**Regression**: None

## Objective

Verify exact names, count, sizes, and hashes for 12,000 one-KiB files spread
over 12 directories.

## Preconditions

- Complete `G7-MANUAL-SETUP.md` and verify the source inventory.

## Manual Steps

```sh
G7=/root/repo22-g7
FIX=$G7/fixtures
SRCROOT=$FIX/sources/boundaries
IMAGE=$FIX/images/boundaries.erofs
MNT=/mnt/repo22-g7-tc124
E=$G7/evidence/TC124
mkdir -p "$MNT" "$E"
unit=$(mdconfig -a -t vnode -f "$IMAGE")
mount -t erofs -o ro "/dev/$unit" "$MNT"
(cd "$SRCROOT" && find many-small -type f -print | sort) > "$E/source.names"
(cd "$MNT" && find many-small -type f -print | sort) > "$E/target.names"
source_count=$(wc -l < "$E/source.names" | tr -d ' ')
target_count=$(wc -l < "$E/target.names" | tr -d ' ')
printf 'source_count=%s\ntarget_count=%s\n' "$source_count" "$target_count" \
  | tee "$E/counts.txt"
test "$source_count" -eq 12000
test "$target_count" -eq 12000
cmp "$E/source.names" "$E/target.names"
(cd "$SRCROOT" && find many-small -type f -exec sha256sum {} + | sort) \
  > "$E/source.hashes"
(cd "$MNT" && find many-small -type f -exec sha256sum {} + | sort) \
  > "$E/target.hashes"
cmp "$E/source.hashes" "$E/target.hashes"
test "$(awk '$3 ~ /^sources\/boundaries\/many-small\// && $2 != 1024 \
  { bad++ } END { print bad + 0 }' \
  "$FIX/SOURCE-INVENTORY.tsv")" -eq 0 || \
  awk '$3 ~ /^sources\/boundaries\/many-small\// && $2 != 1024' \
    "$FIX/SOURCE-INVENTORY.tsv"
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

- Source and mounted name lists are identical and contain exactly 12,000
  files.
- Every mounted SHA256 row equals the corresponding source row.
- Every many-small source file is exactly 1024 bytes.
- No missing inode, panic, hang, or cleanup leak occurs.
