diff --git a/scripts/verify.py b/scripts/verify.py index 3172f15d..7c49f955 100644 --- a/scripts/verify.py +++ b/scripts/verify.py @@ -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 diff --git a/tests/test_system_selection.py b/tests/test_system_selection.py index 1f68c935..654b72ae 100644 --- a/tests/test_system_selection.py +++ b/tests/test_system_selection.py @@ -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()