mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-08 11:03:46 -06:00
fix: list what the emulator pack writes
verify --emulator listed only OK destinations, while the emulator pack also writes a copy whose hash the profile contradicts, loose or archive. pack_destinations now records the paths the replay places, and both branches resolve through packresolve.resolve_file as the pack does.
This commit is contained in:
1 parent
4ceca6acc5
commit
084dff84f4
2 files changed
+54
-5
No files matched your search
@@ -52,6 +52,23 @@ def _db(path: Path, name: str) -> dict:
|
||||
}
|
||||
|
||||
|
||||
def _pack_files(root: Path, emulators: Path, db: dict) -> set[str]:
|
||||
"""The paths the emulator pack writes, built in memory as the pipeline does."""
|
||||
import generate_pack
|
||||
|
||||
record = generate_pack.PackRecord()
|
||||
cwd = os.getcwd()
|
||||
os.chdir(root)
|
||||
try:
|
||||
generate_pack.generate_emulator_pack(
|
||||
["demo"], str(emulators), db, "bios", "", False, {}, offline=True,
|
||||
record=record,
|
||||
)
|
||||
finally:
|
||||
os.chdir(cwd)
|
||||
return set(record.files)
|
||||
|
||||
|
||||
class HashMismatchIsNotCoverage(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self._tmp = tempfile.TemporaryDirectory()
|
||||
@@ -113,6 +130,17 @@ class HashMismatchIsNotCoverage(unittest.TestCase):
|
||||
self.assertIn("reason", detail)
|
||||
self.assertIn("hash", detail["reason"].lower())
|
||||
|
||||
def test_the_contradicted_copy_the_pack_writes_is_a_pack_destination(self):
|
||||
"""The pack writes it with a DISCREPANCY, so verify's list of what
|
||||
the pack holds names it too: step 5 compared the two and failed."""
|
||||
self._profile("f" * 32)
|
||||
result = self._run()
|
||||
self.assertEqual(result["pack_destinations"], ["shared.rom"])
|
||||
self.assertEqual(
|
||||
set(result["pack_destinations"]),
|
||||
_pack_files(self.root, self.emulators, self.db),
|
||||
)
|
||||
|
||||
def test_a_matching_hash_is_still_ok(self):
|
||||
self._profile(hashlib.md5(self.rom.read_bytes()).hexdigest())
|
||||
detail = next(
|
||||
@@ -230,6 +258,15 @@ class ArchiveHashMismatchIsNotCoverage(unittest.TestCase):
|
||||
"an archive whose bytes contradict its declared hash counted as covered",
|
||||
)
|
||||
|
||||
def test_the_contradicted_archive_the_pack_writes_is_a_pack_destination(self):
|
||||
self._profile("f" * 32)
|
||||
result = self._run()
|
||||
self.assertEqual(result["pack_destinations"], ["romset.zip"])
|
||||
self.assertEqual(
|
||||
set(result["pack_destinations"]),
|
||||
_pack_files(self.root, self.emulators, self.db),
|
||||
)
|
||||
|
||||
def test_a_matching_container_hash_is_still_ok(self):
|
||||
self._profile(hashlib.md5(self.archive.read_bytes()).hexdigest())
|
||||
self.assertEqual(set(self._statuses(self._run())), {verify.Status.OK})
|
||||
|
||||
Reference in new issue
Block a user