# Test Case: Deep Directory Tree

**Test ID**: TC122-deep-directory-tree  
**Category**: Boundary & Stress  
**Priority**: Medium  
**Regression**: None

## Objective

Verify exact traversal, lookup, `getcwd`, and payload integrity through 128
directory levels.

## Preconditions

- Complete `G7-MANUAL-SETUP.md`.
- `DEEP-PATH` came from the verified fixture, not a hand-written `a/b/...`
  placeholder.

## Manual Steps

```sh
G7=/root/repo22-g7
FIX=$G7/fixtures
SRCROOT=$FIX/sources/boundaries
IMAGE=$FIX/images/boundaries.erofs
MNT=/mnt/repo22-g7-tc122
E=$G7/evidence/TC122
mkdir -p "$MNT" "$E"
deep_path=$(cat "$FIX/DEEP-PATH")
levels=$(printf '%s\n' "$deep_path" | awk -F/ '{ print NF - 2 }')
printf 'levels=%s\npath=%s\n' "$levels" "$deep_path" \
  | tee "$E/path.txt"
test "$levels" -eq 128
unit=$(mdconfig -a -t vnode -f "$IMAGE")
mount -t erofs -o ro "/dev/$unit" "$MNT"
cmp "$SRCROOT/$deep_path" "$MNT/$deep_path"
source_hash=$(sha256 -q "$SRCROOT/$deep_path")
target_hash=$(sha256 -q "$MNT/$deep_path")
printf 'source=%s\ntarget=%s\n' "$source_hash" "$target_hash" \
  | tee "$E/hashes.txt"
test "$source_hash" = "$target_hash"
deep_dir=$(dirname "$deep_path")
(cd "$MNT/$deep_dir" && pwd -P) | tee "$E/getcwd.txt"
test "$(cat "$E/getcwd.txt")" = "$MNT/$deep_dir"
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

- The metadata count is exactly 128 directory levels.
- Deepest source/mount `cmp` and SHA256 values match.
- `pwd -P` returns the exact mounted deepest directory.
- No stack warning, panic, hang, or leaked mount/provider occurs.
