mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-10-10 21:43:23 -05:00
fix: slot emulator entries where the pack puts them
This commit is contained in:
1 parent
9ca14bb77e
commit
0f293b6c14
2 files changed
+52
-3
No files matched your search
+7
-3
@@ -1279,6 +1279,8 @@ def verify_emulator(
|
||||
A region priority list narrows the report the same way a pack built with the
|
||||
same list would be narrowed, through the emulator pack's own drop set.
|
||||
"""
|
||||
from packpaths import _resolve_destination
|
||||
|
||||
load_emulator_profiles(emulators_dir)
|
||||
zip_contents = build_zip_contents_index(db)
|
||||
|
||||
@@ -1312,8 +1314,6 @@ def verify_emulator(
|
||||
standalone,
|
||||
)
|
||||
if region_drops:
|
||||
from packpaths import _resolve_destination
|
||||
|
||||
structure = profile.get("pack_structure")
|
||||
files = [
|
||||
fe
|
||||
@@ -1501,7 +1501,11 @@ def verify_emulator(
|
||||
result["system"] = file_entry.get("system", "")
|
||||
result["hle_fallback"] = hle
|
||||
result["ground_truth"] = build_ground_truth(name, validation_index)
|
||||
dest = file_entry.get("path", "") or name
|
||||
# The slot the emulator pack places this entry in: standalone_path
|
||||
# under --standalone, the pack_structure prefix, the sanitised path.
|
||||
dest = _resolve_destination(
|
||||
file_entry, profile.get("pack_structure"), standalone
|
||||
) or name
|
||||
emu_results.setdefault(dest, []).append((result, required, hle))
|
||||
|
||||
for dest, alternatives in emu_results.items():
|
||||
|
||||
@@ -363,5 +363,50 @@ class RepositoryWideEvidence(unittest.TestCase):
|
||||
print(f"\n entries resolving to hash_mismatch: {len(offenders)}")
|
||||
|
||||
|
||||
|
||||
class StandaloneSlotsFollowThePack(unittest.TestCase):
|
||||
"""verify_emulator keyed its slots by `path` while the emulator pack places
|
||||
and dedups by standalone_path under --standalone: two entries the pack
|
||||
ships to two folders were one alternative in the report."""
|
||||
|
||||
def setUp(self):
|
||||
self._tmp = tempfile.TemporaryDirectory()
|
||||
self.root = Path(self._tmp.name)
|
||||
self.emulators = self.root / "emulators"
|
||||
self.emulators.mkdir()
|
||||
rom = self.root / "a.rom"
|
||||
rom.write_bytes(b"one rom read from two folders")
|
||||
self.db = _db(rom, "a.rom")
|
||||
(self.emulators / "dual.yml").write_text(
|
||||
"emulator: dual\n"
|
||||
"type: standalone + libretro\n"
|
||||
"systems: [demo-system]\n"
|
||||
"files:\n"
|
||||
" - name: a.rom\n"
|
||||
" path: bios/a.rom\n"
|
||||
" standalone_path: A/a.rom\n"
|
||||
" - name: a.rom\n"
|
||||
" path: bios/a.rom\n"
|
||||
" standalone_path: B/a.rom\n"
|
||||
)
|
||||
from common import _emulator_profiles_cache
|
||||
|
||||
_emulator_profiles_cache.clear()
|
||||
|
||||
def tearDown(self):
|
||||
from common import _emulator_profiles_cache
|
||||
|
||||
_emulator_profiles_cache.clear()
|
||||
self._tmp.cleanup()
|
||||
|
||||
def test_each_standalone_folder_is_a_slot(self):
|
||||
standalone = verify.verify_emulator(
|
||||
["dual"], str(self.emulators), self.db, standalone=True
|
||||
)
|
||||
core = verify.verify_emulator(["dual"], str(self.emulators), self.db)
|
||||
self.assertEqual(standalone["total_files"], 2)
|
||||
self.assertEqual(core["total_files"], 1)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user