fix: fail --verify-packs when no pack was checked

This commit is contained in:
Abdessamad Derraz committed 2026-10-18 20:39:14 +02:00
1 parent c229daac3a
commit 9a417dde2a
2 files changed
+19

No files matched your search

+7
View File
@@ -2497,8 +2497,10 @@ def _run_verify_packs(args: argparse.Namespace) -> None:
set(os.listdir(args.output_dir)) if os.path.isdir(args.output_dir) else set()
)
verified = 0
for platform_name in platforms:
found = sorted(expected[platform_name] & on_disk)
verified += len(found)
if not found:
# Naming a platform is asking about its pack: FAIL, with the
# command that builds it. With --all, a platform whose pack was
@@ -2545,6 +2547,11 @@ def _run_verify_packs(args: argparse.Namespace) -> None:
print(f" {err}")
all_ok = False
if not verified:
# Every platform skipped is no check at all: a mistyped or purged
# output directory read as a passed integrity check.
print(f"ERROR: no pack to verify in {args.output_dir}")
all_ok = False
if not all_ok:
sys.exit(1)
+12
View File
@@ -5019,6 +5019,18 @@ class ANamedPackThatIsAbsentFails(unittest.TestCase):
self.assertIn("retroarch: FAIL (no pack in", result.stdout)
self.assertIn("generate_pack.py --platform retroarch", result.stdout)
def test_all_with_no_pack_is_a_failure(self):
"""--all on a mistyped or purged directory skipped every platform
and exited 0, a passed integrity check that checked nothing."""
with tempfile.TemporaryDirectory(dir=TMP_ROOT) as directory:
result = subprocess.run(
[sys.executable, "scripts/generate_pack.py", "--all",
"--verify-packs", "--output-dir", directory],
cwd=ROOT, capture_output=True, text=True, timeout=600,
)
self.assertEqual(result.returncode, 1)
self.assertIn("no pack to verify", result.stdout)
class AnAliasNamesItsProfile(unittest.TestCase):