From 7ac96f2b3958fdc66e85ca1a5003914e4bd425a9 Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Wed, 21 Oct 2026 12:06:06 +0200 Subject: [PATCH] fix: check an entry's system: against its profile The semantic check read systems: only. mame2010 filed seven BIOS root sets under systems its list lacked: cpzn1, cpzn2 (zn.c:4543, 4563), konamigv (konamigv.c:877), skns (suprnova.c:1686), alg_bios (alg.c:782), maxaflex (maxaflex.c:541) and hng64 (hng64.c:2189) are GAME_IS_BIOS_ROOT in mame2010-libretro at source_commit. --- emulators/mame2010.yml | 7 +++++++ scripts/validate_schemas.py | 8 +++++--- tests/test_mame_devices.py | 10 +++++++++- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/emulators/mame2010.yml b/emulators/mame2010.yml index 26b15b78..6bdcea20 100644 --- a/emulators/mame2010.yml +++ b/emulators/mame2010.yml @@ -58,6 +58,13 @@ systems: - imax-macs - arcade - barcrest-mpu4 + - capcom-zn1 + - capcom-zn2 + - konami-gv + - super-kaneko-nova + - alg-laserdisc + - exidy-maxaflex + - hyper-neogeo64 notes: | Frozen snapshot of MAME 0.139 (mid-2010). Sourced from mame0139s.zip. diff --git a/scripts/validate_schemas.py b/scripts/validate_schemas.py index 0346cee9..c968d30b 100644 --- a/scripts/validate_schemas.py +++ b/scripts/validate_schemas.py @@ -74,7 +74,7 @@ _CHECK_FIELDS = { def _systems_outside_profile(path: Path, document: object) -> list[str]: - """An entry's systems: naming a system its profile does not list. + """An entry's system: or systems: naming a system its profile does not list. A --system pick selects the profile by its systems: and then the entry by its own, so a name the profile lacks is one no pick ever reaches. @@ -86,11 +86,13 @@ def _systems_outside_profile(path: Path, document: object) -> list[str]: for index, entry in enumerate(document.get("files") or []): if not isinstance(entry, dict): continue - unknown = [str(s) for s in entry.get("systems") or [] if str(s) not in listed] + named = [entry["system"]] if entry.get("system") else [] + named += list(entry.get("systems") or []) + unknown = [str(s) for s in named if str(s) not in listed] if unknown: out.append( f"{path.relative_to(ROOT)}: files[{index}] ({entry.get('name')}) " - f"systems {', '.join(unknown)} not in the profile's systems" + f"system {', '.join(unknown)} not in the profile's systems" ) return out diff --git a/tests/test_mame_devices.py b/tests/test_mame_devices.py index 60898895..2e679f98 100644 --- a/tests/test_mame_devices.py +++ b/tests/test_mame_devices.py @@ -622,7 +622,15 @@ class APickReadsTheEntrySystems(unittest.TestCase): outside = {**base, "files": [{"name": "x.zip", "systems": ["a", "c"]}]} found = validate_schemas._systems_outside_profile(root / "emulators" / "x.yml", outside) self.assertEqual(len(found), 1) - self.assertIn("systems c", found[0]) + self.assertIn("system c", found[0]) + single = {**base, "files": [{"name": "x.zip", "system": "c"}]} + found = validate_schemas._systems_outside_profile(root / "emulators" / "x.yml", single) + self.assertEqual(len(found), 1) + self.assertIn("system c", found[0]) + listed = {**base, "files": [{"name": "x.zip", "system": "a"}]} + self.assertEqual( + validate_schemas._systems_outside_profile(root / "emulators" / "x.yml", listed), [] + ) class Cli(unittest.TestCase):