diff --git a/scripts/verify.py b/scripts/verify.py index 74151d22..58083eaf 100644 --- a/scripts/verify.py +++ b/scripts/verify.py @@ -957,6 +957,7 @@ def verify_platform( file_severity: dict[str, str] = {} region_drops: set[str] = set() + region_fallbacks: list[str] = [] region_extra_dests: dict[tuple[str, str, str], str] = {} if regions: import region as region_mod @@ -978,11 +979,15 @@ def verify_platform( target_cores=target_cores, held_out=held, ) + region_index = region_mod.platform_region_index(config, profiles, target_cores) region_drops = region_mod.resolve_region_drops( - region_groups, - region_mod.platform_region_index(config, profiles, target_cores), - regions, - held, + region_groups, region_index, regions, held, + ) + # The pack README names these: no file answers the request, so every + # candidate stays. Reported here too, or verify reads all OK for a + # system that has no BIOS for the region asked. + region_fallbacks = region_mod.fallback_groups( + region_groups, region_index, regions ) # A destination two systems declare with two hashes ships one file, the @@ -1170,6 +1175,7 @@ def verify_platform( "status_counts": status_counts, "undeclared_files": undeclared, "exclusion_notes": exclusions, + "region_fallbacks": sorted(region_fallbacks), "details": details, "ground_truth_coverage": { "with_validation": with_validation, @@ -1393,6 +1399,12 @@ def print_platform_result( if missing: parts.append(f"{missing} missing") print(f"{label}: {', '.join(parts)} [{mode}]") + fallbacks = result.get("region_fallbacks") or [] + if fallbacks: + from packreadme import _group_label + + print(f" No BIOS for the requested regions, all kept ({len(fallbacks)}): " + + ", ".join(_group_label(g) for g in fallbacks)) seen_details: set[str] = set() _print_detail_entries(result["details"], seen_details, verbose) diff --git a/tests/test_region.py b/tests/test_region.py index c2c06a91..ac275da7 100644 --- a/tests/test_region.py +++ b/tests/test_region.py @@ -2,6 +2,8 @@ from __future__ import annotations +import contextlib +import io import os import sys import unittest @@ -707,6 +709,30 @@ class TestReportAndBuilderNarrowTogether(unittest.TestCase): common._emulator_profiles_cache.clear() tmp.cleanup() + def test_the_report_names_the_fallback_groups(self): + """The pack README lists the systems kept whole because nothing + answers the request; verify said all OK and named none.""" + sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "scripts")) + import common + import verify as reporter + + tmp, root, db, config = self._fixture() + try: + common._emulator_profiles_cache.clear() + profiles = common.load_emulator_profiles(str(root / "emulators")) + result = reporter.verify_platform( + config, db, str(root / "emulators"), profiles, + supplemental_names=set(), regions=["brazil"], + ) + self.assertEqual(result["region_fallbacks"], ["demo-system"]) + out = io.StringIO() + with contextlib.redirect_stdout(out): + reporter.print_platform_result(result, ["Demo"]) + self.assertIn("all kept (1): demo-system", out.getvalue()) + finally: + common._emulator_profiles_cache.clear() + tmp.cleanup() + def test_one_grouping_pass_serves_both_sides(self): """A second hand-rolled grouping is how the two drifted apart.