mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-10-18 17:33:30 -05:00
fix: read core files in verify as the builder does
This commit is contained in:
1 parent
3766588ec1
commit
fad4fa6d7e
8 files changed
+51
-31
No files matched your search
@@ -79,7 +79,7 @@ class ACoreFileFillsAFreeDeclaration(unittest.TestCase):
|
||||
|
||||
def test_verify_counts_what_the_pack_counts(self):
|
||||
result = verify_platform(
|
||||
self.config, self.db, str(self.emulators), supplemental_names=set(),
|
||||
self.config, self.db, str(self.emulators),
|
||||
)
|
||||
out = self.root / "out"
|
||||
with redirect_stdout(io.StringIO()):
|
||||
@@ -131,7 +131,7 @@ class AFileDeclaredUnderAnotherName(unittest.TestCase):
|
||||
"files": [{"name": "ROM", "path": "gs/ROM", "md5": md5, "required": True}],
|
||||
}))
|
||||
config = load_platform_config("fakeplat", str(root / "platforms"))
|
||||
result = verify_platform(config, db, str(root / "emulators"), supplemental_names=set())
|
||||
result = verify_platform(config, db, str(root / "emulators"))
|
||||
with redirect_stdout(io.StringIO()):
|
||||
zip_path = generate_pack(
|
||||
"fakeplat", str(root / "platforms"), db, str(root / "bios"),
|
||||
@@ -223,5 +223,41 @@ class AFileNobodyHoldsIsAnOmission(unittest.TestCase):
|
||||
self.assertEqual(omitted["diabdat.mpq"]["reason"], "not_found")
|
||||
|
||||
|
||||
|
||||
class AMemberNameIsNotALooseFile(unittest.TestCase):
|
||||
"""verify counted a core file "in pack" when its name existed only as a
|
||||
member of some ZIP (naomi2.zip's 315-6146.bin); the builder, which reads
|
||||
no archive member names, shipped nothing."""
|
||||
|
||||
def test_verify_reads_undeclared_files_as_the_builder_does(self):
|
||||
import cross_reference
|
||||
|
||||
_emulator_profiles_cache.clear()
|
||||
root = Path(tempfile.mkdtemp(dir=REPO_ROOT / "tmp"))
|
||||
self.addCleanup(shutil.rmtree, root, True)
|
||||
(root / "platforms").mkdir()
|
||||
(root / "emulators").mkdir()
|
||||
(root / "platforms" / "fakeplat.yml").write_text(yaml.safe_dump({
|
||||
"platform": "FakePlat", "verification_mode": "existence",
|
||||
"base_destination": "system", "cores": ["naomi2core"],
|
||||
"systems": {"sega-naomi2": {"files": []}},
|
||||
}))
|
||||
(root / "emulators" / "naomi2core.yml").write_text(yaml.safe_dump({
|
||||
"emulator": "N2", "type": "libretro", "cores": ["naomi2core"],
|
||||
"systems": ["sega-naomi2"],
|
||||
"files": [{"name": "315-6146.bin", "required": True}],
|
||||
}))
|
||||
db = {"files": {}, "indexes": {"by_md5": {}, "by_name": {}, "by_crc32": {},
|
||||
"by_path_suffix": {}}}
|
||||
config = load_platform_config("fakeplat", str(root / "platforms"))
|
||||
with mock.patch.object(cross_reference, "_build_supplemental_index",
|
||||
lambda *a, **k: {"315-6146.bin"}):
|
||||
result = verify_platform(config, db, str(root / "emulators"))
|
||||
self.assertEqual(
|
||||
[(u["name"], u["in_repo"]) for u in result["undeclared_files"]],
|
||||
[("315-6146.bin", False)],
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -157,7 +157,6 @@ class ThePolicyIsSpeltInOnePlace(unittest.TestCase):
|
||||
}
|
||||
result = verify.verify_platform(
|
||||
config, {"files": {}, "indexes": {}}, emu_profiles={},
|
||||
supplemental_names=set(),
|
||||
)
|
||||
self.assertEqual(result["verification_mode"], nativemode.DEFAULT_MODE)
|
||||
|
||||
|
||||
@@ -659,11 +659,10 @@ class TestReportAndBuilderNarrowTogether(unittest.TestCase):
|
||||
|
||||
plain = reporter.verify_platform(
|
||||
config, db, str(root / "emulators"), profiles,
|
||||
supplemental_names=set(),
|
||||
)
|
||||
narrowed = reporter.verify_platform(
|
||||
config, db, str(root / "emulators"), profiles,
|
||||
supplemental_names=set(), regions=["north-america"],
|
||||
regions=["north-america"],
|
||||
)
|
||||
before = {u["name"] for u in plain["undeclared_files"]}
|
||||
after = {u["name"] for u in narrowed["undeclared_files"]}
|
||||
@@ -694,11 +693,10 @@ class TestReportAndBuilderNarrowTogether(unittest.TestCase):
|
||||
profiles = common.load_emulator_profiles(str(root / "emulators"))
|
||||
plain = reporter.verify_platform(
|
||||
config, db, str(root / "emulators"), profiles,
|
||||
supplemental_names=set(),
|
||||
)
|
||||
narrowed = reporter.verify_platform(
|
||||
config, db, str(root / "emulators"), profiles,
|
||||
supplemental_names=set(), regions=["north-america"],
|
||||
regions=["north-america"],
|
||||
)
|
||||
missing = [u["name"] for u in plain["undeclared_files"] if not u["in_repo"]]
|
||||
self.assertEqual(missing, ["jp.bin"])
|
||||
@@ -722,7 +720,7 @@ class TestReportAndBuilderNarrowTogether(unittest.TestCase):
|
||||
profiles = common.load_emulator_profiles(str(root / "emulators"))
|
||||
result = reporter.verify_platform(
|
||||
config, db, str(root / "emulators"), profiles,
|
||||
supplemental_names=set(), regions=["brazil"],
|
||||
regions=["brazil"],
|
||||
)
|
||||
self.assertEqual(result["region_fallbacks"], ["demo-system"])
|
||||
out = io.StringIO()
|
||||
|
||||
@@ -68,7 +68,7 @@ class TwinDeclarations(unittest.TestCase):
|
||||
},
|
||||
}
|
||||
report = verify_platform(
|
||||
config, self.db, str(self.emulators), {}, supplemental_names=set()
|
||||
config, self.db, str(self.emulators), {}
|
||||
)
|
||||
by_system = {d["system"]: d for d in report["details"] if d["name"] in ("N88SUB.ROM", "disk.rom")}
|
||||
statuses = sorted(d["status"] for d in by_system.values())
|
||||
|
||||
@@ -86,7 +86,7 @@ class SlugPlatform(unittest.TestCase):
|
||||
|
||||
def test_the_report_does_not_count_it_packed(self):
|
||||
report = verify_platform(
|
||||
self.config, self.db, "emulators", self.profiles, supplemental_names=set()
|
||||
self.config, self.db, "emulators", self.profiles
|
||||
)
|
||||
entry = next(u for u in report["undeclared_files"] if u["name"] == "MT32_CONTROL.ROM")
|
||||
self.assertTrue(entry["in_repo"])
|
||||
|
||||
Reference in new issue
Block a user