fix: scope --target the same way in every tool

slots and cross_reference go through model.targets.target_scope, so a
mistyped target ends with ERROR and exit 1 as in verify, where they
exited 2. The platforms --all skips are noted on stderr, which kept
slots --json from printing them ahead of its document. slots reads the
mode through platform_mode and builds the ZIP index and data-directory
registry once per run instead of twice per platform.
This commit is contained in:
Abdessamad Derraz committed 2026-11-21 06:04:31 +01:00
1 parent 3467b80b38
commit ee66aa4e66
4 files changed
+50 -34

No files matched your search

+23
View File
@@ -292,6 +292,29 @@ class AMistypedTargetAcrossAllPlatforms(unittest.TestCase):
self.assertEqual(out.getvalue(), "")
class AMistypedTargetEndsEveryToolAlike(unittest.TestCase):
"""--target swtich: verify exited 1, slots and cross_reference 2."""
def test_one_exit_status(self):
for script in ("verify.py", "slots.py", "cross_reference.py"):
with self.subTest(script=script):
proc = subprocess.run(
[sys.executable, f"scripts/{script}", "--platform", "retroarch",
"--target", "swtich"],
cwd=REPO_ROOT, capture_output=True, text=True, check=False, timeout=300,
)
self.assertEqual(proc.returncode, 1, proc.stderr)
self.assertIn("ERROR:", proc.stderr)
def test_skipped_platforms_are_noted_on_stderr(self):
platforms = list_registered_platforms(str(REPO_ROOT / "platforms"))
out, err = io.StringIO(), io.StringIO()
with contextlib.redirect_stdout(out), contextlib.redirect_stderr(err):
build_target_cores_cache(platforms, "switch", str(REPO_ROOT / "platforms"), is_all=True)
self.assertEqual(out.getvalue(), "")
self.assertIn("INFO: Skipping", err.getvalue())
class AMistypedDataKeyGetsTheClosestName(unittest.TestCase):
"""`--key dolphin-sis` printed all 27 keys on one line."""