mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-10-10 13:33:24 -05:00
fix: check targeted packs the way --all builds
This commit is contained in:
1 parent
fc4451c59f
commit
0dc0813bcd
2 files changed
+44
-2
No files matched your search
@@ -3413,12 +3413,15 @@ def _target_cores_for(
|
||||
) -> set[str] | None:
|
||||
"""Cores a target leaves available, or None when no target was asked for.
|
||||
|
||||
None means no narrowing, which is what an unfiltered pack expects.
|
||||
None means no narrowing, which is what an unfiltered pack expects. Read
|
||||
the way --all builds: a platform without a target file was packed
|
||||
unnarrowed under the target's name, and checking that pack must not
|
||||
raise where building it did not.
|
||||
"""
|
||||
if not target_name:
|
||||
return None
|
||||
cache, _kept = build_target_cores_cache(
|
||||
[platform_name], target_name, platforms_dir
|
||||
[platform_name], target_name, platforms_dir, is_all=True
|
||||
)
|
||||
return cache.get(platform_name)
|
||||
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
"""A targeted pack is checked under the target reading it was built with.
|
||||
|
||||
`--all --target x86_64` packs a platform that has no target file unnarrowed
|
||||
under the target's name (Recalbox, Lakka, BizHawk, MiSTer, ROCKNIX). The
|
||||
conformance check read the same target without the --all tolerance, raised
|
||||
FileNotFoundError on the first of those packs and stopped the run in a
|
||||
traceback after every pack had been written.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
import tempfile
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
REPO_ROOT = Path(__file__).resolve().parent.parent
|
||||
sys.path.insert(0, str(REPO_ROOT / "scripts"))
|
||||
|
||||
from common import build_target_cores_cache
|
||||
from generate_pack import _target_cores_for
|
||||
|
||||
|
||||
class CheckReadsTheTargetLikeTheBuild(unittest.TestCase):
|
||||
def test_a_platform_without_a_target_file(self):
|
||||
with tempfile.TemporaryDirectory() as platforms:
|
||||
built, kept = build_target_cores_cache(
|
||||
["recalbox"], "x86_64", platforms, is_all=True
|
||||
)
|
||||
self.assertEqual((built, kept), ({"recalbox": None}, ["recalbox"]))
|
||||
self.assertIsNone(_target_cores_for("recalbox", "x86_64", platforms))
|
||||
|
||||
def test_a_platform_with_a_target_file_is_narrowed(self):
|
||||
cores = _target_cores_for("retroarch", "switch", str(REPO_ROOT / "platforms"))
|
||||
self.assertTrue(cores)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user