| 8ac19619 Andy McCall ↶ |
1 |
# Conformance suite |
| 2 |
|
| 4c0b050e Andy McCall ↶ |
3 |
pytest tests (15 of them) that assert an emulator correctly implements the |
| 4 |
control contract (`../SPEC.md`, 0.3.x). Point them at any emulator — the |
| 5 |
reference x16emu, FAB, the Neo6502, the PC-FX (Mednafen) fork — and they check |
| 6 |
the same surface. Tests gated above the emulator's advertised contract skip |
| 7 |
automatically, so a 0.1-only backend still passes. Platform-agnostic: |
| 8 |
framebuffer dimensions come from the PPM header, addresses use `$0000`, and |
| 9 |
`bank` is exercised without requiring the platform to have banking. |
| 8ac19619 Andy McCall ↶ |
10 |
|
| 11 |
## Run |
| 12 |
|
| 13 |
Attach to an already-running emulator: |
| 14 |
|
| 15 |
``` |
| 16 |
RRDC_PORT=8080 pytest -v |
| 17 |
``` |
| 18 |
|
| 19 |
Or let the suite launch one (`{port}` is substituted into the command): |
| 20 |
|
| 21 |
``` |
| 22 |
RRDC_EMU_CMD="SDL_VIDEODRIVER=dummy SDL_AUDIODRIVER=dummy \ |
| 23 |
/path/to/x16emu -rom rom.bin -warp -controlport {port}" \ |
| 24 |
RRDC_PORT=8391 pytest -v |
| 25 |
``` |
| 26 |
|
| 27 |
If nothing is listening and no `RRDC_EMU_CMD` is set, the tests **skip** (a bare |
| 28 |
`pytest` in CI without an emulator is a skip, not a failure). |
| 29 |
|
| 30 |
## What it checks |
| 31 |
|
| 32 |
- `/status` — required keys present, contract MAJOR matches, sane types. |
| 33 |
- `/regs` — a non-empty JSON object of integer registers. |
| 34 |
- `/mem` — returns exactly `len` bytes; honours `bank`. |
| 35 |
- `/screenshot` — a well-formed PPM whose body size matches its dimensions. |
| 36 |
- `/step` — deterministic: equal steps advance the frame counter by equal, |
| 37 |
positive amounts, and `/step` returns the halted counter. |
| 38 |
- `/pause` + `/resume` — toggle the paused state. |
| 4c0b050e Andy McCall ↶ |
39 |
- `/key` *(0.2)* — accepts `text=`/`code=` with optional `down=`, rejects a |
| 40 |
request with neither; is POST-only. |
| 41 |
- `/reset` *(0.2)* — resets and returns `{"reset":true}`. |
| 42 |
- `POST /mem` *(0.3)* — write→read round-trips; is POST-only. |
| 43 |
- `/audio` *(0.3)* — returns a well-formed PCM WAV. |
| 44 |
- Errors — unknown path → 404; `GET /step` / `GET /key` → 405. |
| 8ac19619 Andy McCall ↶ |
45 |
|
| 46 |
## Environment |
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
| `RRDC_PORT` | `8080` | control port to attach to / launch on | |
| 51 |
| `RRDC_EMU_CMD` | — | shell command to launch an emulator (`{port}` substituted) | |
| 52 |
| `RRDC_BOOT_TIMEOUT` | `20` | seconds to wait for `/status` | |
| 53 |
|
| 54 |
Requires `pytest`. Nothing else — the client is stdlib-only (Pillow is optional |
| 55 |
and unused here). |