feat: say when a boot ran the built-in BIOS

region_check and the site name a boot on the core's built-in BIOS as such: the other regions' files were refused. A boot is called another region's BIOS only when the core's log names that file, and a boot whose log names no BIOS says so.
This commit is contained in:
Abdessamad Derraz committed 2026-10-28 05:23:37 +01:00
1 parent ad7dc0ea17
commit 24ec295d86
4 files changed
+124 -18

No files matched your search

+23
View File
@@ -252,6 +252,29 @@ class ReadAndIndex(Workspace):
self.assertEqual([(g["variant"], g["result"], g["group"]) for g in groups],
[("v0", "works", 0), ("v1", "hang", 1)])
def test_a_boot_on_the_built_in_bios_is_named_so(self) -> None:
import core_probe # noqa: PLC0415
record = full_record("alpha", "region-x-game-others", "2026-10-28T10:00:00+00:00",
kind="run", observable="frame_hashes")
oracle = {"references": [{"sha1": "1" * 40, "stage": "game", "shows": "the title"}],
"error_patterns": [], "error_screens": [], "bios_patterns": [],
"fallback_patterns": [r"^Firmware is missing: "], "load_patterns": []}
for variant in record["variants"]:
for rep in variant["repetitions"]:
rep["logs"] = [{"frame": 0, "level": "info", "text": "Firmware is missing: scph5501.bin"}]
core_probe.judge_repetition(rep, oracle)
core_probe.judge_variant(variant)
self.assertEqual(record["variants"][0]["bios_used"], "builtin")
status, statement = sm.result_of(record)
self.assertEqual(status, sm.BOOTS_BUILTIN)
self.assertIn("built-in BIOS", statement)
item = {**SitePages.ITEM, "host_short": "h", "kind": "run", "status": status, "statement": statement,
"groups": sm.variant_groups(record), "verdicts": sm.verdicts_of(record)}
text = "\n".join(sm.tested_section("alpha", [item]))
self.assertIn("works on its built-in BIOS", text)
self.assertNotIn("other region", text)
def test_links_name_the_last_commit_that_touched_the_records(self) -> None:
first = self.repository()
(self.tree / "other.txt").write_text("x")
+30 -3
View File
@@ -27,9 +27,10 @@ PROFILE = {
def record(rid: str, staged: list[str], opened: list[str], hashes: list, verdict: str = "unknown",
loaded: bool = True) -> dict:
loaded: bool = True, bios_used: str = "unknown") -> dict:
return {"id": rid, "variants": [{
"label": "default", "verdict": verdict, "system_files": {name: "0" * 40 for name in staged},
"label": "default", "verdict": verdict, "bios_used": bios_used,
"system_files": {name: "0" * 40 for name in staged},
"repetitions": [{"loaded": loaded, "files_opened": [{"path": p} for p in opened],
"observables": {"frame_hashes": hashes}}]}]}
@@ -145,8 +146,34 @@ class Outcome(unittest.TestCase):
"own": record("o", ["scph5502.bin"], [], [[0, "a"]], "boots"),
"others": record("x", ["scph5501.bin"], ["scph5501.bin"], [[0, "a"]], "boots")}
result = rc.outcome(records, self.ENTRIES, "europe")
# The log names no BIOS: the boot is not said to be the other region's.
self.assertEqual(rc.sentence("europe", result),
"The European BIOS boots the European game, and so do the other regions' BIOS.")
"The European BIOS boots the European game. With only the other regions' files "
"staged it boots too, on a BIOS its log does not name.")
records["others"] = record("x", ["scph5501.bin"], ["scph5501.bin"], [[0, "a"]], "boots",
bios_used="staged:scph5501.bin")
self.assertEqual(rc.sentence("europe", rc.outcome(records, self.ENTRIES, "europe")),
"The European BIOS boots the European game, and so does scph5501.bin, "
"another region's BIOS.")
def test_a_boot_on_the_built_in_bios_is_never_another_regions(self) -> None:
"""Beetle PSX logs "Firmware is missing" and maps OpenBIOS: the other
regions' files were opened, hashed and refused."""
records = {"full": record("f", self.ALL, self.ALL, [[0, "a"]], "boots",
bios_used="staged:scph5501.bin"),
"own": record("o", ["scph5501.bin"], ["scph5501.bin"], [[0, "a"]], "boots",
bios_used="staged:scph5501.bin"),
"others": record("x", ["scph5500.bin", "scph5502.bin"], ["scph5500.bin", "scph5502.bin"],
[[0, "a"]], "boots", bios_used="builtin")}
result = rc.outcome(records, self.ENTRIES, "north-america")
text = rc.sentence("north-america", result)
self.assertEqual(text, "The US BIOS boots the US game. With only the other regions' files it "
"boots on its built-in BIOS, the other regions' files were refused.")
self.assertNotIn("so do the other regions", text)
import sitemeasurements as sm
line = sm.core_region_line([result])
self.assertIn("built-in BIOS", line)
self.assertNotIn("on the other regions' BIOS", line)
def test_no_own_run(self) -> None:
self.assertEqual(rc.sentence("japan", rc.outcome({}, self.ENTRIES, "japan")),