mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-10-10 13:33:24 -05:00
fix: list a target's cores after its overrides
This commit is contained in:
1 parent
de795262d7
commit
26ea5336a7
2 files changed
+28
-8
No files matched your search
+7
-8
@@ -363,21 +363,20 @@ def list_available_targets(
|
|||||||
with open(target_file) as f:
|
with open(target_file) as f:
|
||||||
data = yaml_load(f) or {}
|
data = yaml_load(f) or {}
|
||||||
|
|
||||||
overrides_file = os.path.join(targets_dir, "_overrides.yml")
|
# The count --target filters on: overrides applied, as load_target_config
|
||||||
overrides = {}
|
# applies them. The scraped list counted Batocera's machine variants and
|
||||||
if os.path.exists(overrides_file):
|
# launchers, 198 cores shown for 187 used.
|
||||||
with open(overrides_file) as f:
|
overrides = _target_overrides(platform_name, targets_dir)
|
||||||
all_overrides = yaml_load(f) or {}
|
|
||||||
overrides = all_overrides.get(platform_name, {}).get("targets", {})
|
|
||||||
|
|
||||||
result = []
|
result = []
|
||||||
for tname, tdata in sorted(data.get("targets", {}).items()):
|
for tname, tdata in sorted(data.get("targets", {}).items()):
|
||||||
aliases = overrides.get(tname, {}).get("aliases", [])
|
aliases = (overrides.get(tname) or {}).get("aliases", [])
|
||||||
|
cores = {str(c) for c in tdata.get("cores", [])}
|
||||||
result.append(
|
result.append(
|
||||||
{
|
{
|
||||||
"name": tname,
|
"name": tname,
|
||||||
"architecture": tdata.get("architecture", ""),
|
"architecture": tdata.get("architecture", ""),
|
||||||
"core_count": len(tdata.get("cores", [])),
|
"core_count": len(apply_target_overrides(cores, overrides, tname)),
|
||||||
"aliases": aliases,
|
"aliases": aliases,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -54,5 +54,26 @@ class TheBuilderNamesByTheCanonicalTarget(unittest.TestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class TheListingCountsWhatTheFilterUses(unittest.TestCase):
|
||||||
|
"""--list-targets showed Batocera x86_64 with 198 cores; --target x86_64
|
||||||
|
filters on 187 once _overrides.yml removes machine variants and launchers."""
|
||||||
|
|
||||||
|
def test_every_listed_count_is_the_filtered_set(self):
|
||||||
|
from common import list_available_targets, load_target_config # noqa: PLC0415
|
||||||
|
|
||||||
|
platforms = str(REPO_ROOT / "platforms")
|
||||||
|
checked = 0
|
||||||
|
for target_file in sorted((REPO_ROOT / "platforms" / "targets").glob("[!_]*.yml")):
|
||||||
|
platform = target_file.stem
|
||||||
|
for row in list_available_targets(platform, platforms):
|
||||||
|
with self.subTest(platform=platform, target=row["name"]):
|
||||||
|
self.assertEqual(
|
||||||
|
row["core_count"],
|
||||||
|
len(load_target_config(platform, row["name"], platforms)),
|
||||||
|
)
|
||||||
|
checked += 1
|
||||||
|
self.assertGreater(checked, 0)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
unittest.main()
|
unittest.main()
|
||||||
Reference in new issue
Block a user