mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-05 09:33:52 -06:00
feat: add the real-condition campaign runner
campaign.py takes buildbot nightlies (or a build of the pinned commit), the test content of tests/campaign/content.yml through romfetch, and runs core_probe for the files, boot, path, alias, variants and bench checks. A fixed rule table settles hle_fallback, required, path and aliases with the record ids as evidence, the rest goes to measurements/findings.jsonl. Resumable state, load, disk and budget guards, retries, content reference counting with an LRU cap, and an autorun job after the nightly.
This commit is contained in:
1 parent
faa79c5920
commit
ee7319d838
16 files changed
+2990
-11
No files matched your search
@@ -81,6 +81,47 @@ def records_path(emulator: str) -> str:
|
||||
return f"{RECORDS_DIR}/{emulator}.jsonl"
|
||||
|
||||
|
||||
# The campaign's own files beside the records: append-only like them, one
|
||||
# line per finding or per pass, each line hashed to its id. No profile takes
|
||||
# these names (tests/test_campaign.py checks it).
|
||||
FINDINGS = "findings"
|
||||
CAMPAIGN_RUNS = "campaign-runs"
|
||||
CAMPAIGN_FILES = {
|
||||
FINDINGS: ("found_at", "campaign-finding.schema.json"),
|
||||
CAMPAIGN_RUNS: ("started_at", "campaign-run.schema.json"),
|
||||
}
|
||||
|
||||
|
||||
def line_id(line: dict, date_key: str) -> str:
|
||||
body = {key: value for key, value in line.items() if key != "id"}
|
||||
return f"{line[date_key][:10]}-{sha256_hex(canonical(body))[:12]}"
|
||||
|
||||
|
||||
def seal_line(line: dict, date_key: str) -> dict:
|
||||
return {**line, "id": line_id(line, date_key)}
|
||||
|
||||
|
||||
def read_campaign(root: Path, name: str) -> list[dict]:
|
||||
"""The lines of one campaign file, each checked against its id."""
|
||||
path = root / records_path(name)
|
||||
if not path.is_file():
|
||||
return []
|
||||
date_key = CAMPAIGN_FILES[name][0]
|
||||
lines = parse_lines(path.read_text(encoding="utf-8"), records_path(name))
|
||||
problems = []
|
||||
seen: set[str] = set()
|
||||
for number, line in enumerate(lines, 1):
|
||||
rid = str(line.get("id", ""))
|
||||
if not ID_PATTERN.match(rid) or date_key not in line or line_id(line, date_key) != rid:
|
||||
problems.append(f"{records_path(name)}:{number}: id {rid!r} does not hash the line")
|
||||
if rid in seen:
|
||||
problems.append(f"{records_path(name)}:{number}: id {rid} appears twice")
|
||||
seen.add(rid)
|
||||
if problems:
|
||||
raise MeasurementsError("\n ".join(problems))
|
||||
return lines
|
||||
|
||||
|
||||
IDENTITY = ("id", "emulator", "subject", "supersedes", "migrated_from_version")
|
||||
|
||||
|
||||
@@ -177,6 +218,8 @@ def read_records(root: Path) -> list[Stored]:
|
||||
if not path.endswith(".jsonl") or "/" in emulator:
|
||||
problems.append(f"{path}: {RECORDS_DIR}/ holds <emulator>.jsonl files only")
|
||||
continue
|
||||
if emulator in CAMPAIGN_FILES:
|
||||
continue
|
||||
seen: set[str] = set()
|
||||
try:
|
||||
records = parse_lines(files[path].read_text(encoding="utf-8"), path)
|
||||
|
||||
Reference in new issue
Block a user