# G1 Manual Test Setup

This setup supports only the G1 test set. It prepares fixtures and probes; it
does not execute tests, assign results, or append PASS output.

## Host Preparation

Run from the repo22 root with an absent output directory:

```sh
git rev-parse HEAD
tests/prepare_g1_fixtures.sh /work/build/repo22-g1
(cd /work/build/repo22-g1/images && sha256sum -c IMAGE-SHA256SUMS)
(cd /work/build/repo22-g1 && sha256sum -c SOURCE-SHA256SUMS)
(cd /work/build/repo22-g1 && sha256sum -c SOURCE-METADATA.sha256)
```

Record `fixture-evidence.txt`, all three checksum manifests, the erofs-utils
version, and the KLD SHA256. Production erofs-utils 1.8.6 does not recognize
the 48-bit incompat bit, so `root8-48bit.erofs`,
`fallback-48bit-root2.erofs`, and `compact-dot-omitted.erofs` are qualified by
the structured transformer's field/CRC assertions plus the required FreeBSD
mount, not by a false `fsck.erofs` PASS.

Transfer `images/`, `source/`, `expected/`, the checksum/evidence files, the
exact KLD, and the C probes used by a TC to an empty guest directory. Compile
the probes natively on FreeBSD 15:

```sh
cc -O2 -Wall -Wextra -Werror -o statfs_probe statfs_probe.c
cc -O2 -Wall -Wextra -Werror -o stat_special stat_special.c
cc -O2 -Wall -Wextra -Werror -o read_probe read_probe.c
cc -O2 -Wall -Wextra -Werror -o mmap_fault mmap_fault.c
cc -O2 -Wall -Wextra -Werror -o nfs_fh_tool nfs_fh_tool.c
```

## Per-Test Lifecycle

Use a fresh dynamic md unit and a TC-specific mount point. Do not assume
`md0`, and detach the unit returned by `mdconfig`:

```sh
image=/tmp/repo22-g1/images/IMAGE.erofs
mnt=/mnt/repo22-g1-TC
md=$(mdconfig -a -t vnode -f "$image")
mkdir -p "$mnt"
mount -t erofs -o ro "/dev/$md" "$mnt"
mount -p | awk -v p="$mnt" '$2 == p'
```

Cleanup after every TC, including a failing assertion:

```sh
umount "$mnt" 2>/dev/null || true
mdconfig -d -u "${md#md}" 2>/dev/null || true
rmdir "$mnt" 2>/dev/null || true
```

At the start and end of the complete G1 run, record `uname -a`,
`freebsd-version -ku`, `kldstat`, `mount`, `mdconfig -l`, the KLD SHA256, and
dmesg line count. The final state must contain no EROFS mount, EROFS KLD, or G1
md provider.

## Result Rules

The only accepted results are `PASS`, `KERNEL-FAIL`, `SHELVED/ISSUE`, and
`ENVIRONMENT-UNAVAILABLE`. Host inspection alone cannot produce PASS. A
kernel behavior failure must retain the observed errno/output and be recorded
in `issues/`; it must not be relabeled PASS.
