fix: check the names a single-target platform runs

This commit is contained in:
Abdessamad Derraz committed 2026-10-17 20:43:51 +02:00
1 parent d01c1b7085
commit 8375e11680
2 files changed
+38 -3

No files matched your search

+25 -3
View File
@@ -482,9 +482,18 @@ def check_targets(
(t or {}).get("cores", []) is None for t in targets.values()
):
# Every core the platform declares runs on these targets: the list
# is the platform's own and has nothing of its own to age.
return [Finding("targets", platform, OK, local="static",
detail="every declared core")]
# is the platform's own and has nothing of its own to age. Its
# names still need a profile each: RetroBat's winuae, jzintv or
# sudachi without one are BIOS its pack never carries.
out = [Finding("targets", platform, OK, local="static",
detail="every declared core")]
declared = _declared_cores(platform)
missing = unresolved_target_cores(
{"targets": {name: {"cores": declared} for name in targets}},
index, _platform_overrides(overrides, platform),
)
out.extend(_unresolved_findings(platform, missing))
return out
if module is None:
# No scraper: a hand-written file has no upstream to diff against,
# so only its age and its core names can be reported.
@@ -532,6 +541,19 @@ def check_targets(
return findings
def _declared_cores(platform: str) -> list[str]:
"""The cores and standalone emulators a platform's own file names."""
from common import load_platform_config
try:
config = load_platform_config(platform, str(REPO_ROOT / "platforms"))
except (FileNotFoundError, OSError):
return []
cores = config.get("cores")
names = [str(c) for c in cores] if isinstance(cores, list) else []
return names + [str(c) for c in config.get("standalone_cores") or []]
def _unresolved_findings(platform: str, missing: dict[str, list[str]]) -> list[Finding]:
"""One row per platform: the names its targets list that no profile claims.
+13
View File
@@ -368,5 +368,18 @@ class PinsWithExtras(unittest.TestCase):
self.assertEqual(pins["jsonschema"], "==4.26.0")
class AStaticTargetStillNamesItsCores(unittest.TestCase):
"""RetroBat's single target is `cores: null`; the check returned OK
before reading the names, and its 50 unprofiled emulators never showed."""
def test_declared_names_are_checked(self):
names = cf._declared_cores("retrobat")
self.assertIn("winuae", names)
source = Path(cf.__file__).read_text()
static = source.index('detail="every declared core"')
self.assertLess(static, source.index("_declared_cores(platform)"))
if __name__ == "__main__":
unittest.main()