mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-22 17:47:48 -06:00
fix: categories ignore unproven launcher records
This commit is contained in:
1 parent
0f3fe1932f
commit
b070d1a41a
2 files changed
+27
-3
No files matched your search
@@ -22,7 +22,7 @@ from core.hashing import declared_hashes, parse_hash_list
|
||||
from resolve.reconcile import (
|
||||
HASH_FIELDS, NativeSystem, comparable, contradicts, entry_names,
|
||||
)
|
||||
from resolve.launchers import record_names as launcher_names
|
||||
from resolve.launchers import bound_launchers, record_names as launcher_names
|
||||
|
||||
|
||||
def _tails(path: str) -> list[str]:
|
||||
@@ -252,7 +252,8 @@ def removal_candidates(
|
||||
evidence = ReadEvidence()
|
||||
for key in sorted(examined):
|
||||
evidence.add_profile(profiles[key], data_registry or {})
|
||||
evidence.add_launchers(scraped.get("launchers") or [])
|
||||
# A record a config file does not prove opens nothing (launcher_unproven).
|
||||
evidence.add_launchers(bound_launchers(scraped, profiles))
|
||||
|
||||
system_of = {
|
||||
id(file_entry): sys_key
|
||||
@@ -351,7 +352,7 @@ class EntryCategories:
|
||||
)
|
||||
self._readers.append((kind, key, evidence))
|
||||
self._launchers = ReadEvidence()
|
||||
self._launchers.add_launchers(config.get("launchers") or [])
|
||||
self._launchers.add_launchers(bound_launchers(config, profiles))
|
||||
self._proofs = ProofIndex([evidence for _kind, _key, evidence in self._readers]
|
||||
+ [self._launchers])
|
||||
self._by_system: dict[str, list[str]] = {}
|
||||
|
||||
@@ -17,6 +17,9 @@ import yaml
|
||||
|
||||
from model.platforms import load_platform_config
|
||||
from model.profiles import load_emulator_profiles
|
||||
from resolve.categories import EntryCategories
|
||||
from resolve.layout import HANDED_PREFIX
|
||||
from resolve.standalone import standalone_set
|
||||
from resolve.launchers import (
|
||||
bound_launchers,
|
||||
config_evidence,
|
||||
@@ -205,6 +208,26 @@ class Gate(unittest.TestCase):
|
||||
self.assertEqual(row["config"], ["duck/config/settings.ini:4"])
|
||||
self.assertEqual(len(bound_launchers(config, {"duck": profile(config_reads=[])})), 1)
|
||||
|
||||
def test_the_layout_is_proven_against_the_profiles_given(self) -> None:
|
||||
"""The pack's tag set and cross_reference judge with the same profiles:
|
||||
an --emulators-dir whose profile lacks config_reads hands nothing."""
|
||||
config = {**self.config(record()), "standalone_cores": ["duck"]}
|
||||
handed = [t for t in standalone_set(config, {"duck": profile()}) if t.startswith(HANDED_PREFIX)]
|
||||
self.assertEqual(len(handed), 1)
|
||||
self.assertFalse([t for t in standalone_set(config, {"duck": profile(config_reads=[])})
|
||||
if t.startswith(HANDED_PREFIX)])
|
||||
|
||||
def test_an_unproven_record_proves_no_read(self) -> None:
|
||||
named = record(kind="fixed_name", names=["tos.img"], passes_to="settings.ini [BIOS] PathPAL")
|
||||
config = {**self.config(named), "cores": ["duck"], "standalone_cores": ["duck"],
|
||||
"systems": {"atari-st": {"files": [{"name": "tos.img", "destination": "tos.img"}]}}}
|
||||
entry = {"name": "tos.img"}
|
||||
proven = EntryCategories(config, {"duck": profile()}).explain(entry, "tos.img", "atari-st")
|
||||
self.assertEqual([r["proof"] for r in proven["read_by"]], ["launcher"])
|
||||
unproven = EntryCategories(config, {"duck": profile(config_reads=[])}).explain(
|
||||
entry, "tos.img", "atari-st")
|
||||
self.assertNotIn("read_by", unproven)
|
||||
|
||||
|
||||
class StartScripts(unittest.TestCase):
|
||||
SCRIPT = (
|
||||
|
||||
Reference in new issue
Block a user