fix: read all RetroPie helps, propose only its own

Eight scriptmodules write "bios" in lower case (xm7, np2pi, quasi88,
minivmac, px68k...) and none was examined. A module reported "left as
is" for a name no profile documents was written all the same: the skip
had no continue. The cap of six names came from that case-sensitive
reading, where xm7 writes thirteen: a sentence now grows no longer than
the longest RetroPie writes. lr- was stripped whatever the build, so the
standalone minivmac package matched the libretro profile, which reads
another file. A file of a system RetroPie lacks is proposed to no
package: lr-geargrafx adds pcengine only (lr-geargrafx.sh:41-42) and
was given the LaserActive's pac-n1.bin and pac-n10.bin.
This commit is contained in:
Abdessamad Derraz committed 2026-10-20 18:12:56 +02:00
1 parent 95476afb28
commit cbe769e74c
3 files changed
+131 -19

No files matched your search

+91 -1
View File
@@ -18,7 +18,7 @@ from pathlib import Path
REPO_ROOT = Path(__file__).resolve().parents[1]
sys.path.insert(0, str(REPO_ROOT / "scripts"))
from exporter.baseline import NativeFile, NativeSystem, build_native_model # noqa: E402
from exporter.baseline import NativeFile, NativeSystem, Report, build_native_model # noqa: E402
from exporter.bizhawk_exporter import Exporter as BizHawk # noqa: E402
from exporter.misterfpga_exporter import Exporter as Mister # noqa: E402
from exporter.romm_exporter import Exporter as Romm # noqa: E402
@@ -610,6 +610,96 @@ class RetroPieProposals(unittest.TestCase):
self.assertFalse(RetroPie._required_for(installed, "gngeopi"))
self.assertTrue(RetroPie._required_for(brought, "gngeopi"))
@staticmethod
def _module(module_id: str, help_text: str) -> dict[str, str]:
script = f'rp_module_id="{module_id}"\nrp_module_help="{help_text}"\n'
return {f"scriptmodules/emulators/{module_id}.sh": script}
@staticmethod
def _wanting(core: str, *names: str) -> dict:
files = [NativeFile(n, n, "sys", truth={
"required": True, "_required_by": [core], "_cores": [core],
"_brought_by": [f"{core}:standalone"]}) for n in names]
return {"sys": NativeSystem("sys", files=files)}
def test_a_lowercase_bios_sentence_is_read(self):
"""Eight scriptmodules write "bios" in lower case (xm7, np2pi,
quasi88, minivmac, px68k...) and none of them was examined."""
module = self._module("xm7", "Copy bios files a.rom and b.rom to $biosdir/xm7")
self.assertEqual(len(RetroPie().modules(module)), 1)
def test_a_module_left_as_is_is_not_written(self):
"""minivmac was reported "left as is" for a name no profile documents
and written all the same: the skip had no continue after it."""
from unittest import mock
exporter = RetroPie()
module = self._module("vmac", "Copy the required BIOS file vMac.ROM to $biosdir")
with mock.patch.object(RetroPie, "_core_index",
return_value={"standalone": {"vmac": "vmac"}, "libretro": {}}):
produced = exporter.render(self._wanting("vmac", "MacII.ROM"), Report(), module)
self.assertEqual(produced, {})
def test_a_standalone_package_does_not_borrow_a_libretro_profile(self):
"""lr- was stripped whatever the build: RetroPie's standalone
minivmac package matched the libretro profile, which reads
MacII.ROM where Mini vMac 37 reads vMac.ROM."""
from unittest import mock
module = self._module("minivmac", "Copy the required BIOS file vMac.ROM to $biosdir")
index = {"libretro": {"minivmac": "minivmac"}, "standalone": {}}
with mock.patch.object(RetroPie, "_core_index", return_value=index):
exporter = RetroPie()
produced = exporter.render(self._wanting("minivmac", "MacII.ROM"), Report(), module)
self.assertEqual(produced, {})
self.assertIn("minivmac", sum(exporter._skipped.values(), []))
def test_a_list_is_capped_by_retropies_longest_not_a_constant(self):
"""The cap of six came from the longest list read, case-sensitively:
xm7 writes thirteen names."""
from unittest import mock
names = [f"n{i}.rom" for i in range(8)]
modules = {
**self._module("long", "Copy bios files " + ", ".join(names[:7]) + " and "
+ names[7] + " to $biosdir"),
**self._module("short", "Copy the required BIOS files a.rom and b.rom to $biosdir"),
}
index = {"standalone": {"short": "short"}, "libretro": {}}
with mock.patch.object(RetroPie, "_core_index", return_value=index):
exporter = RetroPie()
produced = exporter.render(
self._wanting("short", "a.rom", "b.rom", "c.rom", "d.rom", "e.rom",
"f.rom", "g.rom"), Report(), modules)
self.assertEqual(len(produced), 1)
self.assertEqual(exporter.validate({}, produced), [])
def test_a_file_of_a_system_retropie_lacks_is_not_proposed(self):
"""lr-geargrafx adds pcengine only (addSystem, lr-geargrafx.sh:42),
and its sentence was extended with the LaserActive's pac-n1.bin and
pac-n10.bin, a system RetroPie does not have."""
from unittest import mock
files = [NativeFile(n, n, sys_id, truth={
"required": True, "_required_by": ["geargrafx"], "_cores": ["geargrafx"],
"_brought_by": ["geargrafx:libretro"]}, foreign_system=foreign)
for n, sys_id, foreign in (("gexpress.pce", "pce", False),
("pac-n1.bin", "laseractive", True))]
listed = NativeFile("syscard3.pce", "syscard3.pce", "pce", platform={"name": "syscard3.pce"})
systems = {"pce": NativeSystem("pce", files=[listed, files[0]]),
"laseractive": NativeSystem("laseractive", files=[files[1]])}
module = {
**self._module("lr-geargrafx", "Copy the required BIOS file syscard3.pce to $biosdir"),
**self._module("xm7", "Copy bios files a.rom, b.rom and c.rom to $biosdir"),
}
with mock.patch.object(RetroPie, "_core_index",
return_value={"libretro": {"geargrafx": "geargrafx"},
"standalone": {}}):
produced = RetroPie().render(systems, Report(), module)
(text,) = produced.values()
self.assertIn("gexpress.pce", text)
self.assertNotIn("pac-n1.bin", text)
def test_a_list_of_alternatives_is_not_extended(self):
alternatives = "Copy the required BIOS file a.rom or b.rom to $biosdir"
enumeration = "Copy the required BIOS files a.rom and b.rom to $biosdir"