mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-05 17:43:54 -06:00
feat: categorize missing platform entries
A platform list can name a game's data files or a file no core it runs opens. Verify gives each missing entry a category read from the profiles of the platform's cores: firmware, game data or unread. Only firmware gaps carry a severity and fail --strict; the others are counted on their own line, and the pack check no longer counts them as pack errors. Missing firmware stays a conformance error.
This commit is contained in:
1 parent
7e2f753c96
commit
f66adfdcbc
7 files changed
+269
-27
No files matched your search
@@ -0,0 +1,94 @@
|
||||
"""What a platform entry is: firmware, a game's data, or unread.
|
||||
|
||||
Strict verification fails on firmware gaps only, so the category has to come
|
||||
from what the cores the platform runs open, never from the entry's name.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parent.parent / "scripts"))
|
||||
|
||||
import verify # noqa: E402
|
||||
from exporter.candidates import BIOS, GAME_DATA, UNREAD, EntryCategories # noqa: E402
|
||||
|
||||
PROFILES = {
|
||||
"bluemsx": {
|
||||
"emulator": "blueMSX", "type": "libretro", "cores": ["bluemsx"],
|
||||
"systems": ["microsoft-msx"],
|
||||
"files": [{"name": "MSX.ROM", "path": "Machines/Shared Roms/MSX.ROM"}],
|
||||
},
|
||||
"devilutionx": {
|
||||
"emulator": "DevilutionX", "type": "game", "cores": ["devilutionx"],
|
||||
"systems": ["diablo"],
|
||||
"files": [{"name": "diabdat.mpq", "category": "game_data"}],
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
def _config(cores: list[str], files: list[dict], system: str = "s") -> dict:
|
||||
return {"platform": "P", "verification_mode": "md5", "cores": cores,
|
||||
"systems": {system: {"files": files}}}
|
||||
|
||||
|
||||
class Category(unittest.TestCase):
|
||||
def test_each_category(self):
|
||||
cats = EntryCategories(_config(["bluemsx", "devilutionx"], []), PROFILES)
|
||||
self.assertEqual(cats.category({"name": "MSX.ROM"}, "bios/Machines/MSX/MSX.ROM", "microsoft-msx"), BIOS)
|
||||
self.assertEqual(cats.category({"name": "diabdat.mpq"}, "ports/diablo/diabdat.mpq", "diablo"),
|
||||
GAME_DATA)
|
||||
self.assertEqual(
|
||||
cats.category({"name": "hardwareconfig.xml"}, "bios/Machines/MSX/hardwareconfig.xml", "microsoft-msx"),
|
||||
UNREAD)
|
||||
|
||||
def test_a_core_without_profile_leaves_unread_open(self):
|
||||
cats = EntryCategories(_config(["bluemsx", "devilutionx", "mystery"], []), PROFILES)
|
||||
self.assertEqual(
|
||||
cats.category({"name": "hardwareconfig.xml"}, "bios/Machines/MSX/hardwareconfig.xml", "microsoft-msx"),
|
||||
BIOS)
|
||||
self.assertEqual(cats.category({"name": "diabdat.mpq"}, "ports/diablo/diabdat.mpq", "diablo"),
|
||||
GAME_DATA)
|
||||
|
||||
def test_a_system_no_examined_core_emulates_stays_firmware(self):
|
||||
cats = EntryCategories(_config(["bluemsx", "devilutionx"], []), PROFILES)
|
||||
self.assertEqual(cats.category({"name": "syscard3.pce"}, "syscard3.pce", "nec-pc-engine"),
|
||||
BIOS)
|
||||
|
||||
def test_cores_guessed_from_system_ids_prove_nothing(self):
|
||||
config = _config([], [])
|
||||
del config["cores"]
|
||||
cats = EntryCategories(config, PROFILES)
|
||||
self.assertEqual(
|
||||
cats.category({"name": "hardwareconfig.xml"}, "bios/Machines/MSX/hardwareconfig.xml",
|
||||
"microsoft-msx"),
|
||||
BIOS)
|
||||
|
||||
def test_a_platform_with_no_core_is_all_firmware(self):
|
||||
cats = EntryCategories(_config([], []), PROFILES)
|
||||
self.assertEqual(cats.category({"name": "anything.bin"}, "anything.bin", "s"), BIOS)
|
||||
|
||||
|
||||
class StrictCountsFirmwareOnly(unittest.TestCase):
|
||||
def test_missing_game_data_and_unread_carry_no_severity(self):
|
||||
config = _config(["bluemsx", "devilutionx"], [
|
||||
{"name": "diabdat.mpq", "destination": "ports/diablo/diabdat.mpq", "required": True},
|
||||
{"name": "hardwareconfig.xml",
|
||||
"destination": "bios/Machines/MSX/hardwareconfig.xml", "required": True},
|
||||
{"name": "MSX.ROM", "destination": "bios/Machines/MSX/MSX.ROM", "required": True},
|
||||
], system="microsoft-msx")
|
||||
db = {"files": {}, "indexes": {"by_md5": {}, "by_name": {}, "by_crc32": {},
|
||||
"by_path_suffix": {}}}
|
||||
result = verify.verify_platform(config, db, emu_profiles=PROFILES)
|
||||
self.assertEqual(result["severity_counts"][verify.Severity.CRITICAL], 1)
|
||||
self.assertEqual(result["missing_not_firmware"], {
|
||||
"game_data": ["ports/diablo/diabdat.mpq"],
|
||||
"unread": ["bios/Machines/MSX/hardwareconfig.xml"],
|
||||
})
|
||||
self.assertEqual(result["status_counts"][verify.Status.MISSING], 3)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user