Files
reims-vgpu/scripts/wire-oracle/README.md
T
Anees IqbalandClaude 3e5ecfd273 ✅ The only tests that can find a layout error reported ok while returning on their first line
Component: crates/reims-vgpu-wire and crates/reims-vgpu, test harness only. No
product behaviour changes; the two build scripts emit cfgs and nothing else.

Apple's captured records are gitignored and absent on every non-Apple checkout,
which is where this work happens. Both fixture suites handled that by returning
early inside each test body, so 36 tests across two crates printed `ok` in
0.00 s — 34 of them the only tests in the project that can find a wire *layout*
error, since every other test synthesizes its buffers from the same constants
the views read and therefore proves self-consistency and nothing else. A run
that measured nothing was indistinguishable from a run that measured everything.

Presence is now decided at build time. `oracle/fixture_presence.rs` is included
by both build scripts — one copy, because the directory override, the two file
names and the meaning of REIMS_WIRE_FIXTURES_REQUIRED must not fork between the
two suites — and emits `wire_fixtures` / `wire_inventory` for whichever oracle
outputs exist. Every test that reads one carries
`#[cfg_attr(not(...), ignore = "...")]`, so libtest prints one `ignored` line
per test with the command that regenerates them. `ignored` is the vocabulary a
reader already trusts, and unlike an env-var waiver it survives being copied
into a canonical command line.

The two outputs gate separately: `inventory.json` and `fixtures.json` come from
different runs of the capture, so having one without the other stands down only
the tests that read the missing half rather than all 34.

REQUIRED moved with it. A runtime assertion for "these must have run" cannot
fire once the tests are ignored, so absence under REQUIRED now fails the build
instead. Both loaders lost their Option and panic naming the file, which can
only mean the capture was deleted between building and running.

Proven able to fail, all three ways, before landing:

- no fixtures, REQUIRED unset -> 2 + 34 ignored with their reasons (this host);
- no fixtures, REQUIRED=1 -> build fails in the build script naming the path
  and the regenerate command;
- a hand-made fixtures.json with an empty `cases` array -> the cfg flips on, the
  tests run, and both refuse a verdict ("no fixture reached a decoder", "no
  record had an unwritten bit to poison") rather than passing on no input.

Docs corrected in the same commit: the wire crate README, the wire-oracle script
README and its own closing message all described a skip. AGENTS.md gains the
durable half — a green suite on a fixture-less checkout is not evidence about a
wire layout, and the ignored count is the one to read.

Verified: `cargo fmt --all --check`; clippy `-D warnings` on all three
reims-vgpu arms and on reims-vgpu-wire --all-targets — zero from each; full
serial suite on backend-vulkan,host-window (1381 lib, 82 integration passed,
0 failed, 3 ignored) and on reims-vgpu-wire (143 lib passed, 1 passed / 34
ignored in oracle_fixtures); `scripts/feature-matrix/feature-matrix.sh` PASS
both arms, warnings=0, lib=1381 unchanged.

Not verified: no boot was run — nothing here compiles into the staticlib QEMU
links. The fixture-present path was exercised only with a synthetic empty
capture; the real capture needs an Apple host, and neither `--all` regeneration
nor the REQUIRED=1 green run has been done from this checkout.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-05 14:36:11 +03:00

46 lines
1.8 KiB
Markdown

# wire-oracle
Regenerates ground-truth fixtures for `crates/reims-vgpu-wire` by driving
Apple's own paravirtualized GPU serializer on the host.
```sh
scripts/wire-oracle/wire-oracle.sh --fixtures # wire bytes + expectations
scripts/wire-oracle/wire-oracle.sh --inventory # every selector Apple ships
scripts/wire-oracle/wire-oracle.sh --all
```
Output lands in `crates/reims-vgpu-wire/fixtures/`, which is gitignored — the
bytes are Apple's serializer output and are regenerated rather than committed.
Override with `REIMS_WIRE_FIXTURES_DIR`.
## Requirements
- **An Apple host.** The serializer only exists on macOS. The script refuses
elsewhere rather than producing an empty result.
- **Rosetta.** `AppleParavirtGPUMetal.bundle` ships x86_64 and arm64e slices
with no plain-arm64 one, and third-party arm64e needs a preview-ABI boot-arg,
so the harness builds `-arch x86_64` and runs under `arch -x86_64`. Install
with `softwareupdate --install-rosetta`.
No paravirtualized GPU is needed. `PGSerializer` takes an `id<MTLDevice>` and an
object-ref allocator, neither of which touches IOKit, so it runs on bare metal.
`AppleParavirtDevice`, which does need an `AppleParavirtGPU` IOService, is never
instantiated.
## Consuming the output
```sh
REIMS_WIRE_FIXTURES_REQUIRED=1 cargo test -p reims-vgpu-wire -- --test-threads=1
```
Without that variable a missing fixture set makes the oracle tests report
`ignored`, one line each, naming the command that regenerates them. With it, a
missing set fails the build — set it on any Apple host, where there is no excuse
for not having them.
`inventory.json` gates separately from `fixtures.json`, so a run that has one
and not the other stands down only the tests that read the missing half.
The procedure for turning a new capture into a checked view is in
`crates/reims-vgpu-wire/AGENTS.md`.