fix: build slot overrides from the loaded profiles

This commit is contained in:
Abdessamad Derraz committed 2026-10-17 17:55:00 +02:00
1 parent d46f05699c
commit 490fefac97
2 files changed
+36 -10

No files matched your search

+13 -10
View File
@@ -900,21 +900,24 @@ def verify_platform(
)
zip_contents = build_zip_contents_index(db) if has_zipped else {}
base_dest = config.get("base_destination", "")
slot_overrides = {
(key[len(base_dest) + 1:] if base_dest and key.startswith(f"{base_dest}/") else key): path
for key, path in slots.pack_overrides(
config, emu_profiles or {}, db, zip_contents, data_dir_registry,
target_cores=target_cores,
).items()
}
# Build HLE + validation indexes from emulator profiles
# Loaded before the slot overrides: a caller passing no profiles (the
# README's coverage) got no override and reported a discrepancy at a slot
# the pack settles.
profiles = (
emu_profiles
if emu_profiles is not None
else load_emulator_profiles(emulators_dir)
)
base_dest = config.get("base_destination", "")
slot_overrides = {
(key[len(base_dest) + 1:] if base_dest and key.startswith(f"{base_dest}/") else key): path
for key, path in slots.pack_overrides(
config, profiles, db, zip_contents, data_dir_registry,
target_cores=target_cores,
).items()
}
# Build HLE + validation indexes from emulator profiles
# Ground truth comes from the emulators the platform runs. A standalone
# profile that loads a same-named file of its own (ZEsarUX's 48K
# cpc6128.rom against cap32's 32K one) has nothing to say about a
+23
View File
@@ -197,5 +197,28 @@ class EmulatorVerifyReadsNoArchiveItDoesNotNeed(unittest.TestCase):
result = verify.verify_emulator(["handy"], str(REPO_ROOT / "emulators"), db)
self.assertTrue(result)
class CoverageWithoutProfilesMatchesTheCli(unittest.TestCase):
"""verify_platform built the slot overrides from the profiles the caller
passed, before loading them: the README's coverage passes none and listed
a neocdz.zip discrepancy the pack and the CLI do not have."""
def test_omitting_profiles_gives_the_same_report(self):
import verify # noqa: PLC0415
if not (REPO_ROOT / "database.json").exists():
self.skipTest("database.json is not generated")
db = common.load_database(str(REPO_ROOT / "database.json"))
config = common.load_platform_config("retroarch", str(REPO_ROOT / "platforms"))
emulators = str(REPO_ROOT / "emulators")
bare = verify.verify_platform(config, db, emulators)
full = verify.verify_platform(config, db, emulators,
common.load_emulator_profiles(emulators))
def discrepancies(result):
return sorted(d["name"] for d in result["details"] if d.get("discrepancy"))
self.assertEqual(discrepancies(bare), discrepancies(full))
if __name__ == "__main__":
unittest.main()