refactor: move the probe inputs out of tests/

content.yml, oracle.yml, pack_content.yml and observations.yml are read by core_probe, the probes and the site build: they are inputs, not fixtures. measurements/ holds append-only <emulator>.jsonl records only, so they move to campaign/ at the root.
This commit is contained in:
Abdessamad Derraz committed 2026-11-24 10:09:39 +01:00
1 parent f9826e90cc
commit 5f354c8faf
20 files changed
+30 -28

No files matched your search

+1 -1
View File
@@ -261,7 +261,7 @@ on:
- "recipes/archives.json"
- "measurements/**"
# The Proof lines of the emulator pages read what an issue's runs showed.
- "tests/campaign/observations.yml"
- "campaign/observations.yml"
# The Starlight project: config, components, styles, lockfile. Its
# generated folders are gitignored and never trigger anything.
- "website/**"
+2
View File
@@ -36,6 +36,7 @@ on:
- "retired.json"
- "recipes/**"
- "measurements/**"
- "campaign/**"
- "website/**"
# The type check's and the lint's configuration.
- "pyproject.toml"
@@ -67,6 +68,7 @@ on:
- "retired.json"
- "recipes/**"
- "measurements/**"
- "campaign/**"
- "website/**"
- "pyproject.toml"
File renamed without changes.
@@ -4,7 +4,7 @@
# records it was seen in (`records:`), or every record of a subject when the
# sentence is about all of them (`subjects:`). A run of an issue with no
# entry here and no boot verdict reaches no page.
# Read by scripts/sitemeasurements.py for the Proof lines of emulator pages.
# Read by scripts/sitegen/measurements.py for the Proof lines of emulator pages.
issue85:
- said: the Lunar opening movie plays with sound
records: [2026-10-27-f17b2280e1af]
File renamed without changes.
File renamed without changes.
+3 -3
View File
@@ -4,10 +4,10 @@
A maintainer starts each pass. For each emulator profile in scope, the
campaign takes the core (the libretro x86_64 Linux nightly, else a build of
the profile's pinned commit), the test content of each of its systems
(tests/campaign/content.yml, fetched through romfetch when it is not on
(campaign/content.yml, fetched through romfetch when it is not on
disk), and runs core_probe.py. The boot oracle of core_probe judges every
run: boots, bios_error, crash, hang or unknown, against the reference frames
and error patterns of tests/campaign/oracle.yml.
and error patterns of campaign/oracle.yml.
files every declared file the collection holds, staged: the full set,
and which files the core opens
@@ -96,7 +96,7 @@ def build_parser() -> argparse.ArgumentParser:
help=f"romfetch command (default: ${ROMFETCH_ENV}, else romfetch on PATH)")
scope.add_argument("--offline", action="store_true", help="no buildbot, no romfetch, no build")
scope.add_argument("--content-file", default=str(CONTENT_FILE),
help="the test content list (default: tests/campaign/content.yml)")
help="the test content list (default: campaign/content.yml)")
scope.add_argument("--allow-unsandboxed", action="store_true",
help="run cores and builds without bubblewrap when it is missing (refused by default)")
run_p = sub.add_parser("run", parents=[scope], help="one pass: cores, content, checks, rules")
+3 -3
View File
@@ -1148,7 +1148,7 @@ def build_parser() -> argparse.ArgumentParser:
help="seconds per repetition, after which the run is killed and judged a hang")
common.add_argument("--oracle", default=None, metavar="FILE",
help="reference frames and error patterns the verdicts are judged against "
"(default: tests/campaign/oracle.yml)")
"(default: campaign/oracle.yml)")
common.add_argument("--no-trace", action="store_true", help="do not run the worker under strace")
common.add_argument("--require-sandbox", action="store_true",
help="refuse to run the core unless bubblewrap can isolate it")
@@ -1175,7 +1175,7 @@ def build_parser() -> argparse.ArgumentParser:
rejudge.add_argument("--emulator", action="append", default=[],
help="only these emulators' records (default: every one)")
rejudge.add_argument("--oracle", default=None, metavar="FILE",
help="the oracle to judge against (default: tests/campaign/oracle.yml)")
help="the oracle to judge against (default: campaign/oracle.yml)")
rejudge.add_argument("--dry-run", action="store_true",
help="print what would be appended, write nothing")
worker = sub.add_parser("_worker", help="internal: one run in this process, started by the others")
@@ -1348,7 +1348,7 @@ def check_result(variants: list[dict], observable: str) -> dict:
BOOTS, BIOS_ERROR, CRASH, HANG, UNKNOWN = "boots", "bios_error", "crash", "hang", "unknown"
VERDICTS = (BOOTS, BIOS_ERROR, CRASH, HANG, UNKNOWN)
DEFAULT_ORACLE = ROOT / "tests" / "campaign" / "oracle.yml"
DEFAULT_ORACLE = ROOT / "campaign" / "oracle.yml"
def oracle_for(data: dict, content_sha1: str | None, library_name: str | None) -> dict:
+2 -2
View File
@@ -8,8 +8,8 @@ root, in one or both of the ways a user gets it:
installer install.py --dest on the scratch root, from that pack and the
published manifest (install/<platform>.json), with no network
Then for each system a test game covers (tests/campaign/content.yml and
tests/campaign/pack_content.yml), it resolves the libretro cores the platform
Then for each system a test game covers (campaign/content.yml and
campaign/pack_content.yml), it resolves the libretro cores the platform
runs for that system (platform config, target file, standalone and dual-mode
lists), and runs the game through core_probe.py with the system directory
taken from that layout.
+1 -1
View File
@@ -26,7 +26,7 @@ if TYPE_CHECKING:
from typing_extensions import Unpack
CONTENT_FILE = REPO_ROOT / "tests" / "campaign" / "content.yml"
CONTENT_FILE = REPO_ROOT / "campaign" / "content.yml"
+1 -1
View File
@@ -39,7 +39,7 @@ from resolve.standalone import platform_launches
from resolve.entryscope import filter_files_by_mode
PACK_CONTENT_FILE = REPO_ROOT / "tests" / "campaign" / "pack_content.yml"
PACK_CONTENT_FILE = REPO_ROOT / "campaign" / "pack_content.yml"
MAX_ROUNDS = 6
+1 -1
View File
@@ -278,7 +278,7 @@ def collect(root: Path = REPO_ROOT, stored_records: list | None = None) -> list[
from model.measurements import live, read_records
content: dict[str, list[tuple[str, Content]]] = {}
for system, items in load_content(root / "tests" / "campaign" / "content.yml").items():
for system, items in load_content(root / "campaign" / "content.yml").items():
for item in items:
content.setdefault(item.name, []).append((system, item))
profiles = load_emulator_profiles(str(root / "emulators"))
+1 -1
View File
@@ -126,7 +126,7 @@ def run_variant(args: argparse.Namespace, emu: Emulator, tree: Path, oracle: dic
def emulator_oracle(emu: Emulator, path: Path, content_sha1: str) -> dict:
"""The oracle core_probe reads (tests/campaign/oracle.yml), looked up by
"""The oracle core_probe reads (campaign/oracle.yml), looked up by
the content's sha1 and the emulator's name, with the emulator's own
error strings added as patterns. Without the file the oracle names the
module that holds every pattern."""
+1 -1
View File
@@ -3,7 +3,7 @@
the game boots without it.
For a system whose profile marks its BIOS entries with `region:`, each test
game of a region (tests/campaign/content.yml) runs through core_probe four
game of a region (campaign/content.yml) runs through core_probe four
times, each a record in measurements/<emulator>.jsonl:
full every regional BIOS the profile declares
+1 -1
View File
@@ -51,7 +51,7 @@ SQLITE_SCHEMA_VERSION = "3"
BULKY_OBSERVABLES = ("frame_hashes",)
INDEX_SCHEMA_VERSION = 1
# What a maintainer saw in an issue's runs, by record subject.
OBSERVATIONS = Path("tests") / "campaign" / "observations.yml"
OBSERVATIONS = Path("campaign") / "observations.yml"
# A Proof line lists this many record links at most, else one link to the file.
MAX_RECORD_LINKS = 8
+1 -1
View File
@@ -65,7 +65,7 @@ def build_parser() -> argparse.ArgumentParser:
common.add_argument("--samples", type=int, default=60, help="screen samples per repetition")
common.add_argument("--interval", type=float, default=1.0, help="seconds between two samples")
common.add_argument("--oracle", metavar="FILE",
help="the boot oracle (default: tests/campaign/oracle.yml, as core_probe)")
help="the boot oracle (default: campaign/oracle.yml, as core_probe)")
common.add_argument("--png-dir", help="write each distinct sampled screen of repetition 0 as PNG")
common.add_argument("--record", metavar="DIR", nargs="?", const=str(REPO_ROOT),
help="append the record to measurements/<emulator>.jsonl in the checkout DIR")
+1 -1
View File
@@ -75,7 +75,7 @@ def full_record(emulator: str, subject: str, when: str, kind: str = "check",
"repetitions": 2 if kind == "check" else 5, "presses": [],
"observables": ["frame_sha1", "video_sha1", "audio_sha1", "state_sha1", "frame_hashes"],
"frame_hash_every": 150, "joypad_ports": 2,
"oracle": {"file": "tests/campaign/oracle.yml", "sha256": SHA256,
"oracle": {"file": "campaign/oracle.yml", "sha256": SHA256,
"references": [{"sha1": values[0], "stage": "game", "shows": "title"}],
"error_patterns": ["BIOS not found"], "error_screens": []}},
"variants": variants,
+1 -1
View File
@@ -211,7 +211,7 @@ class ThePullRequestBuildsTheSite(unittest.TestCase):
}
self.assertIn("wiki/**", inputs)
# A path the deploy names inside a folder validate.yml watches
# whole (tests/campaign/observations.yml under tests/**) is watched.
# whole (campaign/observations.yml under campaign/**) is watched.
unwatched = [path for path in inputs - watched
if not any(fnmatch.fnmatch(path, pattern) for pattern in watched)]
self.assertEqual(sorted(unwatched), [])
+1 -1
View File
@@ -38,7 +38,7 @@ hosted runner should rebuild and re-upload.
(`platforms/`, `emulators/`, `provenance/`, `exports/`, `measurements/`,
`database.json`, `release.json`, `derivable.json`, `install/`), the pages and
their assets (`wiki/`, `docs_assets/`, `website/`), the installer and its two
bootstraps the site serves, `tests/campaign/observations.yml` (the Proof lines
bootstraps the site serves, `campaign/observations.yml` (the Proof lines
of the emulator pages), the workflow itself, and every script the build runs
or imports. Also manual dispatch.
+8 -8
View File
@@ -950,7 +950,7 @@ Runs a libretro core with no window, no sound and no input device, and
reports what it did. It is the test in real conditions behind a claim about
a core: which files it opens, what it shows, which BIOS it ran.
These probes run on demand only, for three cases: to settle a dispute or an issue, to back a correction sent to a platform, and to check the packs before a release. They are never run as a campaign over every emulator, and the site keeps no showcase of their runs: an emulator page shows a run only when a profile's `evidence:` names it or it answers an issue (`issue<N>-` subjects). Its **Proof** section has one line per claim, every record of that claim linked on it, and says what the runs showed: the BIOS the core ran, or the file strace saw it open. What an issue's run showed comes from `tests/campaign/observations.yml`, written by whoever watched it, and a run with nothing to state stays off the page. Every record stays in `measurements/` and on the Measurements page. Benchmarks (`bench`) stay in the records and the SQLite files and
These probes run on demand only, for three cases: to settle a dispute or an issue, to back a correction sent to a platform, and to check the packs before a release. They are never run as a campaign over every emulator, and the site keeps no showcase of their runs: an emulator page shows a run only when a profile's `evidence:` names it or it answers an issue (`issue<N>-` subjects). Its **Proof** section has one line per claim, every record of that claim linked on it, and says what the runs showed: the BIOS the core ran, or the file strace saw it open. What an issue's run showed comes from `campaign/observations.yml`, written by whoever watched it, and a run with nothing to state stays off the page. Every record stays in `measurements/` and on the Measurements page. Benchmarks (`bench`) stay in the records and the SQLite files and
only choose between variants: no page shows a time per frame.
```bash
@@ -1002,7 +1002,7 @@ strace the record says that tracing was unavailable.
**Boot oracle.** Every repetition and every variant carries a `verdict` and
the `verdict_evidence` that decided it (record version 4), judged against
`tests/campaign/oracle.yml` (`--oracle`), in this order:
`campaign/oracle.yml` (`--oracle`), in this order:
| Verdict | Evidence |
|---------|----------|
@@ -1152,7 +1152,7 @@ python scripts/campaign.py gate # the checks behind a commit
| Step | What happens |
|------|--------------|
| Core | The x86_64 Linux nightly from `buildbot.libretro.com`, for each name of the profile's `cores:` the buildbot publishes, downloaded again only when its `ETag` or `Last-Modified` changes. The record keeps the artifact URL, the `.so` sha256 and the `retro_get_system_info` version. With no nightly, the profile's `source_commit` is cloned and built once with `make` (`Makefile.libretro` first), the failure kept so it is not tried again for that commit. Host git only fetches into bare mirrors (`.cache/campaign/mirrors/`), one per repository, submodules included, that it alone touches: no working tree, never bound into a sandbox, and earlier working-tree clones are deleted. It runs with no user or system config, https as the only transport, and `-c` overrides emptying hooks, `core.fsmonitor`, `core.sshCommand`, `core.gitProxy`, credential helpers and every filter driver the mirror's config defines. The commit and each submodule at the commit its tree records are exported with `git archive` into a fresh folder, and `make` runs there in the same bubblewrap sandbox as a core, that folder the one writable path. The core copied out is the newest `*_libretro.so` that is a regular file inside that folder, opened without following links. The record's `build_command` says which isolation was used. A standalone emulator is `pending: standalone` |
| Content | Each system's games come from `tests/campaign/content.yml`, by catalog name and with the reason each was chosen. They are read from `.cache/test-content/<romfetch system>/<name>/`, each file checked against its `identity.json`. Missing content is fetched with `romfetch get <system> <name> --json` when romfetch is on `PATH`, in `RETROBIOS_ROMFETCH` or given with `--romfetch`. Otherwise the checks are `pending: content`, with romfetch's exit code and error code when it failed. Content never enters git, and a record keeps only its identity |
| Content | Each system's games come from `campaign/content.yml`, by catalog name and with the reason each was chosen. They are read from `.cache/test-content/<romfetch system>/<name>/`, each file checked against its `identity.json`. Missing content is fetched with `romfetch get <system> <name> --json` when romfetch is on `PATH`, in `RETROBIOS_ROMFETCH` or given with `--romfetch`. Otherwise the checks are `pending: content`, with romfetch's exit code and error code when it failed. Content never enters git, and a record keeps only its identity |
| Checks | `files` stages every declared file the collection holds (the full set) and reads which ones the core opens (strace). `none` runs the game with no BIOS at all. `negative` runs, for each declared file of the game's region the collection holds, the file alone, then zeros of its size, its first half and up to two other regions' dumps staged under its name. An entry neither the full set nor its own run opened is staged where the core looked for it (`path`), else flagged. The `boot_file:` entry is also staged under the names the core looked for with no BIOS (`alias`). `variants` runs each `.variants/` copy of a file the core opened. Each runs twice from a fresh process and is judged by the boot oracle. `bench` (only with `--bench`) times the game once the full set boots, warm-up excluded, 5 repetitions |
| Rules | `probes/rules.py`, a fixed table of pure functions (below). A field the table settles is written into the profile, with `evidence:` naming the record ids. Anything else is a line of `measurements/findings.jsonl` |
| Content reuse | A game stays on disk until the last emulator that needs it in the pass is done, then the campaign deletes it if it fetched it. Past `--cache-cap-gb` (default 20) the least recently used goes first. An entry marked `pinned:`, or one the campaign did not fetch, is never deleted |
@@ -1183,7 +1183,7 @@ field again, those ids leave its `evidence:`.
frame written as PNG under `tmp/campaign/references/<core>/<content>/`, and
prints the record id with the screens that stay on for 3 samples or more in
every repetition. A reviewer opens those PNGs and writes the chosen frames
into `tests/campaign/oracle.yml` with their stage and what they show.
into `campaign/oracle.yml` with their stage and what they show.
The rules run on every pass, from the kept records when no check needs to run
again, so a change of the table applies without a run. A run that agrees with
@@ -1240,7 +1240,7 @@ Schemas: `campaign-finding.schema.json` and `campaign-run.schema.json`.
### region_check.py
Proves the `region:` fields of a profile on a real run. For each test game
of a region in `tests/campaign/content.yml`, it runs `core_probe.py` four
of a region in `campaign/content.yml`, it runs `core_probe.py` four
times, each a record whose subject is `region-<core>-<game>-<variant>`.
| Variant | BIOS staged |
@@ -1306,7 +1306,7 @@ python scripts/standalone_probe.py check pcsx2 \
| Sandbox | The allowlist bubblewrap sandbox of `core_probe.py`: the unpacked emulator, the content folder and the staged BIOS folder read-only, the repetition's scratch folder the one writable path, no network. Xvfb runs inside it, on the sandbox's own `/tmp`, so the display is private to the run. `--require-sandbox` refuses to run without bubblewrap |
| Screen | Xvfb keeps its screen as a file (`-fbdir`). The probe reads it every `--interval` seconds, `--samples` times, and hashes each sample's pixels. `--png-dir` writes each distinct sample as PNG for review |
| Files | `strace -f` inside the sandbox: the files the emulator opened in the staged BIOS folder, and the ones it looked for there and did not find |
| Verdict | `core_probe.judge` on each repetition, with the oracle of `tests/campaign/oracle.yml` looked up by the content's sha1 and the emulator's name, plus the emulator's own error strings `probes/standaloneemulators.py` lists (DuckStation's "No BIOS image found for", PCSX2's "Unable to auto locate a BIOS image"). An emulator that exits before the last sample is a crash |
| Verdict | `core_probe.judge` on each repetition, with the oracle of `campaign/oracle.yml` looked up by the content's sha1 and the emulator's name, plus the emulator's own error strings `probes/standaloneemulators.py` lists (DuckStation's "No BIOS image found for", PCSX2's "Unable to auto locate a BIOS image"). An emulator that exits before the last sample is a crash |
`standalone_probe.py <mode> --help` lists the options. `--sha256` runs an
older fetched asset than the newest. The ones it shares with `core_probe.py`
@@ -1343,8 +1343,8 @@ downloads the nightlies again, and `--keep` leaves the laid-out folders in
| Step | What happens |
|------|--------------|
| Layout | `generate_pack.py --platform X --offline` builds the pack into `tmp/pack_probe/<platform>/dist` (`--pack` reuses one). `pack`: the archive extracted at the root of the BIOS folder, each file mapped to its member. `installer`: `install.py --platform X --dest <root>/system --save-dir <root>/saves --from-pack <pack> --manifest install/X.json --offline`, each file mapped to the manifest entry that names it (`files:`, `case_variants:`, `data_directories:`). Both by default, `--install` picks one |
| Games | `tests/campaign/content.yml` and `tests/campaign/pack_content.yml`, same format, read from `.cache/test-content` of the main checkout and checked against their `identity.json`. `--fetch` gets a missing one through romfetch |
| Layout | `generate_pack.py --platform X --offline` builds the pack into `tmp/pack_probe/<platform>/dist` (`--pack` reuses one). `pack`: the archive extracted at the root of the BIOS folder, each file mapped to its member. `installer`: `install.py --platform X --dest <root>/system --save-dir <root>/saves --from-pack <pack> --manifest install/<platform>.json --offline`, each file mapped to the manifest entry that names it (`files:`, `case_variants:`, `data_directories:`). Both by default, `--install` picks one |
| Games | `campaign/content.yml` and `campaign/pack_content.yml`, same format, read from `.cache/test-content` of the main checkout and checked against their `identity.json`. `--fetch` gets a missing one through romfetch |
| Cores | `resolve_platform_cores` with the target of the platform (`linux-x86_64` for RetroArch, `x86_64` for Batocera, `windows` for RetroBat), kept when the profile serves the system and its libretro build runs there: not a `standalone_cores` entry, unless `dual_mode_cores` names it. The `.so` is the buildbot's x86_64 Linux nightly, every build the target names, else the one named after the profile, else the first of its `cores:`. Kept in `.cache/pack-probe/cores` with its URL and `Last-Modified` |
| Staging | `core_probe.py` copies what it stages, and a pack holds gigabytes, so the probe stages what the core can reach: the profile's libretro entries (path or name, and aliases), the platform's list for the system, every file of the folders those sit in, and for a profile with `found_by: content` every root file of a size it declares. A file or folder the core then looks for that the layout holds is staged and the run repeated, up to 6 runs |
| Run | `core_probe.py run --require-sandbox --record`, the game's frames and frame sampling from its content entry, no core option set. The first run is recorded. When the staging grew, the closed staging runs again, recorded with `--supersedes` the first. Each run holds the probe lock. Before a recorded run, lock held, the probe waits for the 1-minute load to fall to a quarter of the CPUs, up to 30 minutes, then stops with exit 3 |