#!/usr/bin/env python3 """Check global exits through real guest keys without controlling a desktop.""" import argparse,base64,hashlib,json,re,subprocess from pathlib import Path ROOT=Path(__file__).resolve().parents[1] p=argparse.ArgumentParser(description=__doc__) p.add_argument('--app',type=Path,default=Path('/Applications/VCC Plus.app')) p.add_argument('--rom',type=Path,required=True);p.add_argument('--disk-rom',type=Path,required=True) p.add_argument('--evidence',type=Path,default=ROOT/'test-output/quit') a=p.parse_args();a.evidence.mkdir(parents=True,exist_ok=True) mp=(ROOT/'build/BONEQ.map').read_text();symbols={n:int(v,16) for n,v in re.findall(r'Symbol: _(\w+) .*?= ([0-9A-Fa-f]+)',mp)} rows=json.loads((ROOT/'data/bones.json').read_text());disk=(ROOT/'build/BONEQ.dsk').read_bytes();sha=hashlib.sha256(disk).hexdigest();reports=[] for cpu in ('6809','6309'): for scenario in ('title-Q','credits-Break','choice-Q','typed-q','typed-ASCII27','spelling-Break','typed-feedback-Q','auto-feedback-Break'): proc=subprocess.Popen([str(a.app/'Contents/Helpers/vcc-playtest')],stdin=subprocess.PIPE,stdout=subprocess.PIPE,text=True) def call(op,**kw): proc.stdin.write(json.dumps(dict(op=op,**kw))+'\n');proc.stdin.flush();r=json.loads(proc.stdout.readline());assert 'error' not in r,r;return r['result'] def step(n=600):call('input',steps=[dict(mask=0,fields=n)]) def press(mask,settle=600):call('input',steps=[dict(mask=mask,fields=8)]+([dict(mask=0,fields=settle)] if settle else [])) def key(bit,settle=600):press(1<