mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-22 17:47:48 -06:00
fix: run only programs of proven launchers
This commit is contained in:
1 parent
b070d1a41a
commit
0530c007a8
3 files changed
+18
-5
No files matched your search
@@ -953,11 +953,11 @@ class ExecutedFile:
|
||||
source_ref: str
|
||||
|
||||
|
||||
def executed_files(config: dict) -> list[ExecutedFile]:
|
||||
"""Every file a platform's launchers execute, from records passing it to exec."""
|
||||
def executed_files(config: dict, profiles: Mapping[str, dict]) -> list[ExecutedFile]:
|
||||
"""Every file a platform's launchers execute, from bound records passing it to exec."""
|
||||
base = str(config.get("base_destination") or "bios")
|
||||
found: list[ExecutedFile] = []
|
||||
for record in config.get("launchers") or []:
|
||||
for record in bound_launchers(config, profiles):
|
||||
if record.get("kind") not in ("fixed_name", "names_searched"):
|
||||
continue
|
||||
if str(record.get("passes_to") or "").strip() != "exec":
|
||||
|
||||
@@ -143,7 +143,7 @@ def standalone_set(config: dict, profiles: Mapping[str, dict]) -> set[str]:
|
||||
}
|
||||
names |= {
|
||||
EXECUTED_PREFIX + json.dumps([run.emulator, run.name, run.place, run.source_ref])
|
||||
for run in executed_files(config)
|
||||
for run in executed_files(config, profiles)
|
||||
}
|
||||
return names | content_folder_tags(config)
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ 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.layout import EXECUTED_PREFIX, HANDED_PREFIX
|
||||
from resolve.standalone import standalone_set
|
||||
from resolve.launchers import (
|
||||
bound_launchers,
|
||||
@@ -217,6 +217,19 @@ class Gate(unittest.TestCase):
|
||||
self.assertFalse([t for t in standalone_set(config, {"duck": profile(config_reads=[])})
|
||||
if t.startswith(HANDED_PREFIX)])
|
||||
|
||||
def test_an_unproven_record_executes_nothing(self) -> None:
|
||||
code = {"emulator": "duck", "kind": "fixed_name", "names": ["run.sh"], "passes_to": "exec",
|
||||
"search_dir": "/storage/roms/bios", "source_ref": "start.sh:3"}
|
||||
cited = {**code, "source_ref": "duck/config/settings.ini:4, start.sh:3"}
|
||||
|
||||
def executed(launcher: dict) -> list[str]:
|
||||
config = {**self.config(launcher), "standalone_cores": ["duck"]}
|
||||
return [t for t in standalone_set(config, {"duck": profile()})
|
||||
if t.startswith(EXECUTED_PREFIX)]
|
||||
|
||||
self.assertEqual(len(executed(code)), 1)
|
||||
self.assertEqual(executed(cited), [])
|
||||
|
||||
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"],
|
||||
|
||||
Reference in new issue
Block a user