mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-10-23 12:19:13 -05:00
fix: drop names DraStic never opens
DraStic opens nds_bios_arm9.bin, nds_bios_arm7.bin and nds_firmware.bin and checks their size. Its nine aliases are in none of its binaries, and neither platform launcher passes them: ROCKNIX links the two BIOS names from its bios folder, and RetroPie runs DraStic from $md_conf_root/nds/drastic (drastic.sh:48), now a passes_path record. The collection answers DraStic's names with its DS dumps in generate_db, where repository names belong.
This commit is contained in:
1 parent
20829d09ce
commit
8036d36fe8
7 files changed
+143
-11
No files matched your search
@@ -153,5 +153,43 @@ class AnUnreadableSourceStopsTheRun(unittest.TestCase):
|
||||
self.assertIn("broken.yml", str(caught.exception))
|
||||
|
||||
|
||||
class DrasticNamesTheDSDumps(unittest.TestCase):
|
||||
"""DraStic opens nds_bios_arm9.bin, nds_bios_arm7.bin and nds_firmware.bin
|
||||
and checks their size only. Its profile listed nine other names none of
|
||||
its binaries contains, which were the only way the collection answered
|
||||
its own three names."""
|
||||
|
||||
def _aliases(self, files: dict) -> dict:
|
||||
with tempfile.TemporaryDirectory(dir=REPO_ROOT / "tmp") as tmp:
|
||||
previous = os.getcwd()
|
||||
os.chdir(tmp)
|
||||
try:
|
||||
Path("emulators").mkdir()
|
||||
return generate_db._collect_all_aliases(files)
|
||||
finally:
|
||||
os.chdir(previous)
|
||||
|
||||
def test_the_collection_answers_drastic_names(self):
|
||||
files = {
|
||||
"a9": {"name": "NDS_Bios9.bin", "path": "bios/Nintendo/DS/NDS_Bios9.bin", "md5": "m9"},
|
||||
"a7": {"name": "NDS_Bios7.bin", "path": "bios/Nintendo/DS/NDS_Bios7.bin", "md5": "m7"},
|
||||
"fw": {"name": "NDS_Lite_Firmware.bin",
|
||||
"path": "bios/Nintendo/DS/NDS_Lite_Firmware.bin", "md5": "mf"},
|
||||
}
|
||||
aliases = self._aliases(files)
|
||||
named = {sha: {a["name"] for a in entries} for sha, entries in aliases.items()}
|
||||
self.assertIn("nds_bios_arm9.bin", named["a9"])
|
||||
self.assertIn("nds_bios_arm7.bin", named["a7"])
|
||||
self.assertIn("nds_firmware.bin", named["fw"])
|
||||
|
||||
def test_the_profile_carries_no_name_drastic_never_opens(self):
|
||||
import yaml
|
||||
|
||||
profile = yaml.safe_load((REPO_ROOT / "emulators" / "drastic.yml").read_text())
|
||||
self.assertEqual(
|
||||
[e["name"] for e in profile["files"] if e.get("aliases")], [],
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -269,6 +269,47 @@ class CommandLines(unittest.TestCase):
|
||||
rl.extract_launchers(files)
|
||||
|
||||
|
||||
DRASTIC = module("drastic", """
|
||||
function configure_drastic() {
|
||||
mkRomDir "nds"
|
||||
|
||||
addEmulator 1 "$md_id" "nds" "$md_inst/drastic.sh %ROM%"
|
||||
addSystem "nds"
|
||||
|
||||
[[ "$md_mode" == "remove" ]] && return
|
||||
|
||||
isPlatform "kms" && ! isPlatform "x11" && setBackend "$md_id" "x11"
|
||||
|
||||
cat > "$md_inst/drastic.sh" << _EOF_
|
||||
#!/bin/bash
|
||||
pushd "$md_conf_root/nds/drastic"
|
||||
$md_inst/drastic "\\$1"
|
||||
popd
|
||||
_EOF_
|
||||
chmod +x "$md_inst/drastic.sh"
|
||||
}
|
||||
""", 36)
|
||||
|
||||
|
||||
class WorkingDirectory(unittest.TestCase):
|
||||
def test_drastic_reads_below_the_folder_its_script_enters(self):
|
||||
found = records({f"{EMULATORS}/drastic.sh": DRASTIC}, "drastic")
|
||||
entered = [r for r in found if r["kind"] == "passes_path"]
|
||||
self.assertEqual(
|
||||
[(r["search_dir"], r["passes_to"], r["source_ref"]) for r in entered],
|
||||
[(
|
||||
"$md_conf_root/nds/drastic",
|
||||
"working directory of $md_inst/drastic.sh",
|
||||
f"{EMULATORS}/drastic.sh:48",
|
||||
)],
|
||||
)
|
||||
|
||||
def test_a_launch_script_that_no_longer_enters_a_folder_raises(self):
|
||||
files = {f"{EMULATORS}/drastic.sh": DRASTIC.replace('pushd "', 'echo "')}
|
||||
with self.assertRaises(rl.LauncherPatternMissing):
|
||||
rl.extract_launchers(files)
|
||||
|
||||
|
||||
class LaunchScripts(unittest.TestCase):
|
||||
def test_fs_uae_refuses_to_start_without_kick13(self):
|
||||
files = {f"{EMULATORS}/fs-uae.sh": FS_UAE, f"{EMULATORS}/fs-uae/fs-uae.sh": FS_UAE_LAUNCHER}
|
||||
|
||||
Reference in new issue
Block a user