test(memory): integrate pinned public memory compatibility suite
Add --suite memory with verified source hashes, ARM eval checkpoint 0x08000350, and the r12 result assertion. Keep default ARM and explicit Thumb preparation unchanged. Extend offline adapter and CLI tests; retain public binaries outside tracked files. The unmodified memory ROM passes in debug and release after 174 steps and 1478 nominal cycles, without changing core behavior. Document weak byte-write assertions and mode-selection caveats. Add original CPU-driven tests with exact sentinels, mode/mirror boundaries, byte lanes, forced blank, readback, and nominal device timing. Validated on Darwin arm64: 851 workspace tests in debug and release; 782 core/demo tests separately; 30 Python tests; all three pinned public suites in both profiles; native ROM windows; all ten demo smoke tests; fmt, clippy, rustdoc, and local documentation links.
This commit is contained in:
parent
3d67b136ba
commit
661f00d682
14 changed files with 351 additions and 19 deletions
54
tools/gba-tests-memory.lock.json
Normal file
54
tools/gba-tests-memory.lock.json
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
{
|
||||
"repository": "jsmolka/gba-tests",
|
||||
"revision": "a7113b67e63f83a9b321696ddd7042ccfad6c881",
|
||||
"license": "MIT",
|
||||
"rom": "memory/memory.gba",
|
||||
"completion_pc": "0x08000350",
|
||||
"result_register": 12,
|
||||
"files": {
|
||||
"LICENSE": {
|
||||
"sha256": "b59a9ed235d76752c977f04116bc72155a14af48176bdbf50d7e5c29fca35aa7",
|
||||
"bytes": 1070
|
||||
},
|
||||
"README.md": {
|
||||
"sha256": "488f50d9d9031c88cea4161fad69f6460209dd54d965645fa45cf5e972cc9062",
|
||||
"bytes": 434
|
||||
},
|
||||
"memory/memory.asm": {
|
||||
"sha256": "03c62d6ac9d72e65698f1f444780657998510c1c63ec8fe62905b20419a9559c",
|
||||
"bytes": 500
|
||||
},
|
||||
"memory/memory.gba": {
|
||||
"sha256": "21024fb6aae6343f5f0466dd54e3149de1fbeb23f78e7d85a015c983684d2f87",
|
||||
"bytes": 2172
|
||||
},
|
||||
"memory/mirrors.asm": {
|
||||
"sha256": "e5f0a092d1d20042169adecb0ed69fcdb07d82546812dca41aed5a1a9ac6d3ff",
|
||||
"bytes": 2334
|
||||
},
|
||||
"memory/video_strb.asm": {
|
||||
"sha256": "a57e5cdd37b85029ff14e7f6aab75056fe488b94d325d8a323b9400785863420",
|
||||
"bytes": 1911
|
||||
},
|
||||
"lib/constants.inc": {
|
||||
"sha256": "b4dd3f4760ac1ae7e99cdc7e255f8220eed666e1ab821b150561db58e5d3b7ea",
|
||||
"bytes": 900
|
||||
},
|
||||
"lib/macros.inc": {
|
||||
"sha256": "25b0ff553c4ca99d76ec82c8c9db874e25d6eed58e2e69fa27f1a0fe7a8c46d4",
|
||||
"bytes": 2864
|
||||
},
|
||||
"lib/header.asm": {
|
||||
"sha256": "e9d1e8c7b6382eeb1b7059423ec365e32911f702eadfa51804a2119438a87357",
|
||||
"bytes": 1720
|
||||
},
|
||||
"lib/text.asm": {
|
||||
"sha256": "77e579d6cf0db182fd24e8d420c8c0a81592d78197e8fb06accc8bcfb43db17e",
|
||||
"bytes": 2288
|
||||
},
|
||||
"lib/glyphs.asm": {
|
||||
"sha256": "538beb37f40b1fd56beed9253e0e9eab25444c748adba7440a2093f49e3cbcc9",
|
||||
"bytes": 2545
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env python3
|
||||
"""Prepare a hash-verified, pinned public ARM or Thumb test outside tracked paths.
|
||||
"""Prepare a pinned public ARM, Thumb, or memory test outside tracked paths.
|
||||
|
||||
This adapter is original. Upstream sources, license, and ROM bytes are downloaded
|
||||
only to the requested local directory. They are not embedded in this repository.
|
||||
|
|
@ -15,7 +15,7 @@ from urllib.request import Request, urlopen
|
|||
|
||||
ROOT = Path(__file__).resolve().parent.parent
|
||||
LOCKS = {suite: Path(__file__).with_name(f"gba-tests-{suite}.lock.json")
|
||||
for suite in ("arm", "thumb")}
|
||||
for suite in ("arm", "thumb", "memory")}
|
||||
MAX_FILE_BYTES = 1024 * 1024
|
||||
|
||||
|
||||
|
|
@ -64,7 +64,7 @@ def prepare(output, source=None, download=fetch, suite="arm"):
|
|||
files[name] = data
|
||||
|
||||
# The source-defined eval label starts with m_vsync's register save. All
|
||||
# failure exits arrive with the result register set (ARM r12, Thumb r7).
|
||||
# failure exits set the result register (ARM/memory r12, Thumb r7).
|
||||
# Thumb tests switch back to ARM before eval. Success leaves the result zero.
|
||||
# Hash pinning is authoritative; these checks catch adapter-offset mistakes.
|
||||
pc = int(lock["completion_pc"], 16)
|
||||
|
|
@ -111,7 +111,7 @@ def main():
|
|||
print(f"cannot prepare public {args.suite} test: {error}", file=sys.stderr)
|
||||
return 1
|
||||
print(f"Prepared pinned public {args.suite} suite: {manifest}")
|
||||
print("Run with gameboy-rust --test-suite PATH. Preparation does not mean the CPU tests passed.")
|
||||
print("Run with gameboy-rust --test-suite PATH. Preparation does not mean the tests passed.")
|
||||
return 0
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -23,9 +23,12 @@ class PreparationTests(unittest.TestCase):
|
|||
if self.suite == "arm":
|
||||
data = struct.pack("<II", 0xEAFFFFFE, 0xE92D0003)
|
||||
pc, result = "0x08000004", 12
|
||||
else:
|
||||
elif self.suite == "thumb":
|
||||
data = struct.pack("<IIHHI", 0xEAFFFFFE, 0xE1A00000, 0xA000, 0x4700, 0xE92D0003)
|
||||
pc, result = "0x0800000c", 7
|
||||
else:
|
||||
data = struct.pack("<III", 0xEAFFFFFE, 0xE1A00000, 0xE92D0003)
|
||||
pc, result = "0x08000008", 12
|
||||
self.files = {
|
||||
self.rom: data,
|
||||
"LICENSE": b"Original fixture, not upstream license content.\n",
|
||||
|
|
@ -59,7 +62,7 @@ class PreparationTests(unittest.TestCase):
|
|||
return self.files[url[len(prefix):]]
|
||||
|
||||
def prepare(self):
|
||||
# Exercise the existing default ARM API as well as explicit Thumb selection.
|
||||
# Exercise default ARM preparation and explicit selection of the other suites.
|
||||
options = {} if self.suite == "arm" else {"suite": self.suite}
|
||||
return adapter.prepare(self.output, download=self.download, **options)
|
||||
|
||||
|
|
@ -185,6 +188,10 @@ class ThumbPreparationTests(PreparationTests):
|
|||
self.assertFalse(self.output.exists())
|
||||
|
||||
|
||||
class MemoryPreparationTests(PreparationTests):
|
||||
suite = "memory"
|
||||
|
||||
|
||||
class SuiteSelectionTests(unittest.TestCase):
|
||||
def test_unknown_suite_is_rejected_before_download_or_output(self):
|
||||
with tempfile.TemporaryDirectory() as temp:
|
||||
|
|
@ -199,7 +206,11 @@ class SuiteSelectionTests(unittest.TestCase):
|
|||
self.assertFalse(output.exists())
|
||||
|
||||
def test_committed_locks_keep_distinct_verified_protocols(self):
|
||||
for suite, pc, register in [("arm", "0x08001d4c", 12), ("thumb", "0x08000934", 7)]:
|
||||
for suite, pc, register in [
|
||||
("arm", "0x08001d4c", 12),
|
||||
("thumb", "0x08000934", 7),
|
||||
("memory", "0x08000350", 12),
|
||||
]:
|
||||
lock = json.loads(adapter.LOCKS[suite].read_text())
|
||||
self.assertEqual(lock["repository"], "jsmolka/gba-tests")
|
||||
self.assertEqual(lock["revision"], "a7113b67e63f83a9b321696ddd7042ccfad6c881")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue