Files
CoCo3_Plus_MiSTer/tests/test_release_guards.py
T
bholman cb40fed3b9 Introduce Coco 3 Plus for MiSTer
Add original-firmware Sound & Speech, four configurable Multi-Pak sockets,
bounded per-slot ROM allocation and a nine-page menu organized around devices
and media. Repair inherited clock/reset/CPU-memory/video paths and add explicit
conditional external-I/O timing contracts. Preserve native Main startup-file
ordering, saved layouts, stock-core separation and the coco3plus media profile.

Provide native Windows tool downloads, pinned ToolShed ROM assembly, fresh
Quartus builds, functional and fitted timing checks, reviewed release packaging
and passwordless SSH installation with backups. Retain original component
notices, document contribution copyright and keep SSC ROM inputs outside Git.

Validation: Quartus17.0.2 Build602 seed5, zero errors; 15 functional jobs,
368 both-corner timing scopes and eight tooling-integrity checks pass.
The renamed build reaches Disk BASIC, PRINT1+1 returns2 and SSC loads ready.
Physical cold power cycling and conditional board-delay assumptions remain
separate. Full original upstream histories are preserved before this single
consolidated implementation commit.
2026-11-18 16:00:45 -07:00

34 lines
1.9 KiB
Python

"""Check release integrity boundaries against a real completed local build."""
import json,sys,tempfile,unittest,zipfile
from pathlib import Path
ROOT=Path(__file__).resolve().parents[1]
sys.path.insert(0,str(ROOT/'tools'))
from release import default_config,make_release,SSC
class ReleaseGuards(unittest.TestCase):
def test_fresh_profile_preserves_status_contract(self):
data=default_config(True);self.assertEqual(len(data),16)
value=int.from_bytes(data,'little')
self.assertEqual(value>>63,1)
self.assertEqual((value>>12)&3,3)
self.assertEqual([(value>>(43+3*i))&7 for i in range(4)],[6,3,1,2])
self.assertEqual(value^int.from_bytes(default_config(False),'little'),1<<42)
def test_changed_ssc_fails_before_creating_output(self):
with tempfile.TemporaryDirectory(dir=ROOT/'build') as folder:
base=Path(folder);roms=base/'roms';roms.mkdir()
for name in SSC:
original=(ROOT/'roms/ssc'/name).read_bytes()
(roms/name).write_bytes(original)
chip=roms/'pic-7040-510.bin';data=bytearray(chip.read_bytes());data[-1]^=1;chip.write_bytes(data)
out=base/'release'
with self.assertRaisesRegex(RuntimeError,'incorrect input'):
make_release(out,ROOT/'build/fpga',ROOT/'build/roms',roms)
self.assertFalse(out.exists())
def test_corresponding_source_contains_no_local_roms(self):
release=ROOT/'dist/coco3plus'
with zipfile.ZipFile(release/'corresponding-source.zip') as archive:
names=archive.namelist();self.assertTrue(any(n.endswith('/rtl/coco3fpga.sv') for n in names))
self.assertFalse(any('/roms/ssc/' in n or '/.deps/' in n or '/build/' in n for n in names))
record=json.loads((release/'manifest.json').read_text())
self.assertEqual(record['files']['config/coco3plus_v51.CFG']['policy'],'create-if-missing')
if __name__=='__main__':unittest.main()