Files
jakub 6a667d8deb Capture current mission, AI, map and administration development
Include the current addon, terrain integrations, tools, regression tests and recorded development evidence.
2026-10-13 22:52:53 +02:00

16 lines
1.6 KiB
Python

from pathlib import Path
import sys,json,hashlib,subprocess,os
r=Path('/home/jakub/devel/escapistsrereintroduced');b=Path('/tmp/erri-gameplay-root-1720');sys.path.insert(0,str(r/'tools'));from source_manifest import addon_manifest
h=lambda p:hashlib.sha256(p.read_bytes()).hexdigest();inputs=addon_manifest(r)
for folder in ['tests','tools']:
inputs.update({str(p.relative_to(r)):h(p) for p in (r/folder).rglob('*') if p.is_file() and '__pycache__' not in p.parts and p.suffix!='.pyc'})
programs=['test_mounted_ammo_transfer.py','test_mounted_ammo_pickup.py','test_infantry_mine_transfer.py','test_infantry_mine_coordinator.py','test_mounted_resupply.py','test_mounted_supply_integration.py','hq_network_regression.py','test_hq_radio_node.py','test_hq_assignment_lifecycle.py','test_finite_magazine_reservation.py','test_infantry_ammo_transfer.py'];results=[]
for name in programs:
with (b/(name+'.log')).open('w') as log:
result=subprocess.run([sys.executable,'-B',str(r/'tests'/name)],cwd=r,env={**os.environ,'PYTHONDONTWRITEBYTECODE':'1'},stdout=log,stderr=subprocess.STDOUT)
results.append({'path':'tests/'+name,'exit':result.returncode,'log_sha256':h(b/(name+'.log'))})
unchanged=all((r/p).is_file() and h(r/p)==v for p,v in inputs.items())
(b/'focused-inputs.json').write_text(json.dumps(inputs,indent=2)+'\n');(b/'focused-result.json').write_text(json.dumps({'programs':results,'inputs_unchanged':unchanged,'native_run':False},indent=2)+'\n')
print(json.dumps({'checks':len(results),'failed':[v for v in results if v['exit']],'inputs_unchanged':unchanged}))
raise SystemExit(int(not unchanged or any(v['exit'] for v in results)))