You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: AI/TESTING.md
+22Lines changed: 22 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -49,6 +49,7 @@ Every subsystem change should aim to leave behind one of these:
49
49
- The harness should support at least framebuffer capture and serial / link-port capture when the ROM exposes machine-readable output there.
50
50
- Prefer serial / link-port capture for suites such as Blargg `cpu_instrs` when that path is available, because it avoids treating a scrolling framebuffer as the primary machine-readable result channel.
51
51
- Each ROM case should define a timeout, an explicit pass/fail rule, and retained failure artifacts such as serial output, framebuffer output, trace excerpts, and optional snapshots.
52
+
- During early Phase `0`, `gb-test-runner` may still be a contract-only crate, but it should already own typed ROM-case and suite metadata including console model, startup mode, execution mode, emulation-progress timeout, explicit pass/fail rule, requested captures, and retained failure-artifact policy.
52
53
- The minimum DMG closure baseline should include automated CPU / interrupt coverage through `retrio/gb-test-roms` or equivalent Blargg automation, `dmg-acid2` for basic DMG PPU validation, and `mealybug-tearoom-tests` for fine PPU rendering / timing validation.
53
54
- Keep explicit roadmap space for broader closure suites such as Mooneye / Gekkio coverage, SameSuite, GB Accuracy Tests, 144p Test Suite, and MBC3 RTC-focused ROMs.
54
55
@@ -83,9 +84,30 @@ Every subsystem change should aim to leave behind one of these:
83
84
- New production code should normally introduce automated unit tests or integration tests in the same change.
84
85
- Prefer unit tests for local logic and integration tests when the behavior only becomes meaningful across subsystem boundaries.
85
86
- Treat "code first, tests later" as an exception that must be justified explicitly, not as the default workflow.
87
+
- Before opening or updating a pull request, run at least `make check` locally so formatting, clippy, tests, typos, and `cargo deny` failures do not first surface in CI.
88
+
- When a change touches CI, coverage, dependency policy, repo tooling, or other workflow-critical infrastructure, run `make ci` locally as well before the PR is updated.
89
+
- For the current infrastructure-heavy stage, keep `gb-core` and `gb-test-runner` at or above `90%` line, region, and function coverage as a guardrail, but do not satisfy that threshold with hollow tests that only exercise trivial getters or app placeholders.
86
90
- When immediate automated coverage is temporarily impractical, record the missing test coverage, the reason it is deferred, and the remaining risk in the change report; add a roadmap TODO as well if the gap is concrete and non-trivial.
87
91
- ROM-based validation and oracle comparison complement automated tests; they do not replace the expectation that new code should usually leave behind unit or integration coverage.
88
92
93
+
## Phase 0 baseline test layout
94
+
95
+
- Until dedicated tooling such as `gb-test-runner` exists, keep the initial automated-validation baseline inside `crates/gb-core`.
96
+
- Keep subsystem-local invariant tests close to the production code under `crates/gb-core/src/**`.
97
+
- Keep public-API and cross-module smoke coverage under `crates/gb-core/tests/*.rs`.
98
+
- Keep shared integration-test helpers under `crates/gb-core/tests/common/`.
99
+
- Reserve `crates/gb-core/tests/fixtures/roms/` for ROM fixtures and synthetic cartridge images used by automated harnesses.
100
+
- Reserve `crates/gb-core/tests/fixtures/traces/` for golden trace artifacts and other debugger-facing snapshots.
101
+
- During early Phase `0`, prefer stable UTF-8 text trace fixtures with explicit `seq=`, `subsystem=`, `level=`, and quoted `message=` fields so ordering regressions can be locked down before richer scheduler-visible traces exist.
102
+
- During early Phase `0`, cover `ConsoleModel`, `StartupMode`, `ExecutionMode`, and `CompatibilityPolicy` defaults explicitly so DMG-first behavior and future CGB extension seams remain stable before scheduler and loader work land.
103
+
- During early Phase `0`, cover `SchedulerPhase` order, the global T-cycle counter, and `CycleContext` reset semantics explicitly so later subsystem work cannot smuggle timing assumptions in through accidental call order.
104
+
- During early Phase `0`, cover the single top-level `step_t_cycle()` machine entry point explicitly so the core keeps one deterministic timing boundary instead of growing multiple unsynchronized stepping APIs.
105
+
- During early Phase `0`, cover subsystem-boundary wiring explicitly so `Machine` ownership of CPU, bus, PPU, DMA, timer, boot, and cartridge remains stable before Phase `1` introduces hardware-visible behavior.
106
+
- During early Phase `0`, lock one deterministic trace order for stubbed CPU, bus, PPU, DMA, timer, boot, and cartridge hooks relative to scheduler phases so later subsystem implementation can grow observability without silently redefining trace chronology.
107
+
- During early Phase `0`, expose typed breakpoint and watchpoint contracts for `PC`, memory, MMIO, and cartridge-visible state even before CPU and bus evaluation hooks are fully wired, so debugger tooling can grow without redefining its public targets later.
108
+
- During early Phase `0`, treat debugger snapshots as typed inspection artifacts only; lock their contents with tests, but keep them explicitly separate from the whole-machine save-state work reserved for Phase `8`.
109
+
- Keep the Phase `0` baseline fast, deterministic, and frontend-independent; `gb-core` validation must not require `gb-cli`, desktop, web, or host-specific I/O.
Copy file name to clipboardExpand all lines: README.md
+6-1Lines changed: 6 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,6 +24,7 @@ The current workspace already uses the `crates/`-based layout, leaving other com
24
24
```text
25
25
crates/
26
26
gb-core/ Pure emulation logic
27
+
gb-test-runner/ Typed ROM-harness contracts and validation helpers
27
28
gb-cli/ Current CLI frontend
28
29
AI/ Architecture, roadmap, and technical documentation
29
30
Makefile Local verification pipeline and utilities
@@ -33,7 +34,7 @@ Mid-term planned extensions, not yet materialized as separate crates:
33
34
34
35
-`gb-desktop`
35
36
-`gb-web`
36
-
- additional tooling such as a test runner, debugger, and utilities
37
+
- additional tooling such as richer debugger and utilities
37
38
- host persistence/save adapters outside the core, with any cartridge-facing persistence contract kept narrow and typed inside `gb-core`
38
39
- broader integration tests and ROM suites
39
40
@@ -68,6 +69,7 @@ make setup
68
69
69
70
```bash
70
71
cargo cov
72
+
cargo cov-check
71
73
cargo cov-html
72
74
cargo cov-lcov
73
75
```
@@ -79,6 +81,9 @@ make check
79
81
make ci
80
82
```
81
83
84
+
Before opening or updating a PR, run at least `make check` locally.
85
+
When changing CI, coverage, dependency policy, or repository tooling, run `make ci` locally as well so failures such as `cargo deny` do not first appear in GitHub Actions.
0 commit comments