mirror of
https://github.com/D-Modem/courier-emu.git
synced 2026-11-28 20:38:07 -08:00
624 tests across 51 files, 5-12 minutes, and this session showed what that
was worth: the 403 datapump carried a zero transmit level through every one
of them, and what found it was ATGLK2=0000:0C00 on the board. A green suite
here says the harness still does what it did, not that it matches the
hardware.
So the rule for what stays is: a test earns its place by pinning a fact
established against hardware or against a file format, cheaply, where a
refactor could break it silently. Fourteen files, thirty test functions,
32 collected - test_ac01_codec and test_dsp_board_ndx each run one of theirs
over both board images. 4.4 seconds.
formats xmf identity, sector checksum, Microwire round-trip and
write-enable, the 302 records and the 403 block offset,
flash program/erase 10
constants the instruction/timer-tick round trip, the timer gate,
AC01 reset registers and both B-register rate paths,
ASIC port decode 7
measured DSP the NDX/ARCR board probes and PA7, mailbox tag/data on
58-5e, the 1c commit bit, host cells not data memory,
the datapump family table 7
end to end the ROM reset stub, the C52 payload, the supervisor's
download through the bridge, 302 to its service loop,
fixture forwarding 5
board tools flash_dump address coverage and target selection,
ram_dump's opt-in and peripheral-window guard 3
What went is everything asserting main211/XMF behaviour - there is no 211
hardware, so those expectations are inferences that can never be settled -
along with the multi-second full-boot runs, the probe and sampler files, and
the ISDN/NAC/XMP and SV25 recovery tests, which cover machines this work is
not about. All of it is in the history if a specific one is wanted back.
Two things fixed in passing. README pointed at tests/test_nac.py as the
assertion behind the NAC/XMP cross-check; it now says to re-check that with
nac-info. And `make test` ran `unittest discover`, which never saw
pytest-style module-level tests - 369 of the old 624, and it would have seen
17 of these 30 - so it runs pytest now.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
95 lines
2.3 KiB
Python
95 lines
2.3 KiB
Python
from __future__ import annotations
|
|
|
|
import argparse
|
|
from contextlib import redirect_stdout
|
|
from io import StringIO
|
|
import json
|
|
from pathlib import Path
|
|
import subprocess
|
|
import sys
|
|
import tempfile
|
|
import unittest
|
|
|
|
from courier_emu.cli import _worker_command, build_parser, daa_codec_wanted, main, ring_cadence
|
|
from courier_emu.daa import RING_OFF_MS, RING_ON_MS
|
|
from courier_emu.parameters import FEATURE_BITS, ParameterSector, features_value
|
|
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
|
|
|
|
class CliTests(unittest.TestCase):
|
|
def test_idsl302_nvram_fixture_is_forwarded_to_the_worker(self) -> None:
|
|
args = build_parser().parse_args(
|
|
["run", str(ROOT / "IDSDL302.ROM"), "--nvram-fixture", "idsdl302"]
|
|
)
|
|
command = _worker_command(args)
|
|
self.assertIn("--nvram-fixture", command)
|
|
self.assertEqual(command[command.index("--nvram-fixture") + 1], "idsdl302")
|
|
with self.assertRaises(SystemExit):
|
|
build_parser().parse_args(
|
|
[
|
|
"run",
|
|
str(ROOT / "IDSDL302.ROM"),
|
|
"--nvram-fixture",
|
|
"idsdl302",
|
|
"--nvram",
|
|
"settings.nv",
|
|
]
|
|
)
|
|
|
|
|
|
def test_dsp_reaches_stable_service_loop(self) -> None:
|
|
output = StringIO()
|
|
with redirect_stdout(output):
|
|
result = main(
|
|
["dsp-run", str(ROOT / "main211.xmf"), "--instructions", "20000"]
|
|
)
|
|
self.assertEqual(result, 0)
|
|
run = json.loads(output.getvalue())
|
|
self.assertEqual(run["status"], "stable-loop")
|
|
self.assertEqual(run["error"], "")
|
|
self.assertGreater(run["instructions"], 10_000)
|
|
self.assertLessEqual(run["recent_unique_pcs"], 256)
|
|
|
|
def _run_command(self, command: str, instructions: int) -> dict:
|
|
output = StringIO()
|
|
with redirect_stdout(output):
|
|
result = main(
|
|
[
|
|
"run",
|
|
str(ROOT / "main211.xmf"),
|
|
"--instructions",
|
|
str(instructions),
|
|
"--at",
|
|
command,
|
|
"--summary",
|
|
]
|
|
)
|
|
self.assertEqual(result, 0)
|
|
return json.loads(output.getvalue())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|