mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-10-10 13:33:24 -05:00
fix: pair a bare truth name by name, not suffix
This commit is contained in:
1 parent
556d4a45aa
commit
c2bdef4db4
2 files changed
+22
-1
No files matched your search
@@ -325,8 +325,13 @@ def build_native_model(
|
||||
def by_destination(candidate: NativeFile, t_dest: str = t_dest) -> bool:
|
||||
# Dolphin writes dolphin-emu/Sys/GC/USA/IPL.bin for the truth's
|
||||
# GC/USA/IPL.bin: a destination ending in the path is the file.
|
||||
# A bare name is no path: dc/boot.bin ends in /boot.bin, and
|
||||
# fbneo's 480-byte boot.bin is not that 2 MB Dreamcast BIOS.
|
||||
# Names go through by_name and its size guard.
|
||||
theirs = _match_key(candidate.platform or {})[0]
|
||||
return bool(t_dest) and (theirs == t_dest or theirs.endswith("/" + t_dest))
|
||||
if not t_dest:
|
||||
return False
|
||||
return theirs == t_dest or ("/" in t_dest and theirs.endswith("/" + t_dest))
|
||||
|
||||
def by_name(
|
||||
candidate: NativeFile,
|
||||
|
||||
@@ -120,6 +120,22 @@ def model(truth: dict = TRUTH, scraped: dict | None = SCRAPED):
|
||||
class Reconciliation(unittest.TestCase):
|
||||
"""The platform's file corrected, not replaced by ours."""
|
||||
|
||||
def test_a_bare_truth_name_is_not_a_path_suffix(self):
|
||||
"""fbneo's boot.bin has no path; libretro's dc/boot.bin ends in
|
||||
/boot.bin. The suffix paired them past the size guard and wrote the
|
||||
480-byte file's size and hashes over the 2 MB Dreamcast BIOS."""
|
||||
truth = {"systems": {"sega-dreamcast": {"files": [
|
||||
{"name": "boot.bin", "size": 480, "crc32": "f0774fc2"}]}}}
|
||||
scraped = {"systems": {"sega-dreamcast": {"native_id": "dc", "files": [
|
||||
{"name": "boot.bin", "destination": "dc/boot.bin", "native_system": "dc",
|
||||
"size": 2097152, "crc32": "89f2b1a1"}]}}}
|
||||
systems, report = build_native_model(truth, scraped)
|
||||
platform_entry = next(
|
||||
fe for fe in systems["dc"].files if fe.destination == "dc/boot.bin"
|
||||
)
|
||||
self.assertIsNone(platform_entry.truth)
|
||||
self.assertEqual(report.hashes_corrected, [])
|
||||
|
||||
def test_a_file_the_truth_says_nothing_about_is_kept(self):
|
||||
systems, _ = model()
|
||||
names = {fe.name for fe in systems["psx"].files}
|
||||
|
||||
Reference in new issue
Block a user