diff --git a/scripts/common.py b/scripts/common.py index f2e98204..ad7f944c 100644 --- a/scripts/common.py +++ b/scripts/common.py @@ -411,10 +411,14 @@ def list_registered_platforms( Only registered platforms generate packs and appear in CI. Unregistered YAMLs (e.g., emulatorjs.yml) are base configs for inheritance. + + A missing registry, or a registered platform whose file is gone, raises: + left out quietly, verify --all --strict and every --all build passed + having checked none of it, and install.py kept serving its last manifest. """ registry_path = os.path.join(platforms_dir, "_registry.yml") if not os.path.exists(registry_path): - return [] + raise FileNotFoundError(f"no platform registry at {registry_path}") with open(registry_path) as f: registry = yaml_load(f) or {} platforms = [] @@ -423,8 +427,11 @@ def list_registered_platforms( if status == "archived" and not include_archived: continue config_path = os.path.join(platforms_dir, meta.get("config", f"{name}.yml")) - if os.path.exists(config_path): - platforms.append(name) + if not os.path.exists(config_path): + raise FileNotFoundError( + f"{name} is registered in {registry_path} but {config_path} does not exist" + ) + platforms.append(name) return platforms diff --git a/tests/test_audit_regressions.py b/tests/test_audit_regressions.py index 9974e252..4418c94e 100644 --- a/tests/test_audit_regressions.py +++ b/tests/test_audit_regressions.py @@ -5355,5 +5355,24 @@ class ThePackCheckAppliesTheFrontendRule(unittest.TestCase): self.assertIsNotNone(_check_member_hash(zf, "bios/x.bin", entry, "md5")) +class ABrokenRegistryIsNotAnEmptyOne(unittest.TestCase): + """A registered platform whose YAML was renamed was skipped without a + word, and a missing registry read as no platforms: verify --all --strict + and every --all build passed having checked nothing.""" + + def test_both_raise(self): + from scripts.common import list_registered_platforms + + with tempfile.TemporaryDirectory(dir=TMP_ROOT) as tmp: + with self.assertRaises(FileNotFoundError): + list_registered_platforms(tmp) + Path(tmp, "_registry.yml").write_text( + "platforms:\n rocknix:\n config: rocknix.yml\n", encoding="utf-8" + ) + with self.assertRaises(FileNotFoundError) as caught: + list_registered_platforms(tmp) + self.assertIn("rocknix", str(caught.exception)) + + if __name__ == "__main__": unittest.main()