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

19 lines
1.7 KiB
Python

from pathlib import Path
import sys,os,json,hashlib,subprocess,time
R=Path('/home/jakub/devel/escapistsrereintroduced');B=Path('/tmp/erri-bmp-native-2103');sys.path.insert(0,str(R/'tools'));from source_manifest import addon_manifest
names=['test_native_mounted_ammo_probe.py','test_native_mounted_swap_probe.py','test_native_mounted_courier_probe.py','test_native_convoy_mine_stock.py','test_native_mine_stock_runner.py','test_native_memory_deadlines.py','test_convoy_budget.py','test_supply_convoys.py','test_hq_mounted_ammo_sampler.py','test_hq_watch.py']
assert all((R/'tests'/n).is_file() for n in names),names
inputs=addon_manifest(R)
for folder in ['tools','tests']:
for p in (R/folder).rglob('*'):
if p.is_file() and '__pycache__' not in p.parts and p.suffix!='.pyc':inputs[str(p.relative_to(R))]=hashlib.sha256(p.read_bytes()).hexdigest()
(B/'focused-inputs.json').write_text(json.dumps(inputs,indent=2)+'\n')
env={k:v for k,v in os.environ.items() if not k.startswith('ERR_')};env['PYTHONDONTWRITEBYTECODE']='1';env['ERR_REPO']=str(R)
results=[]
for name in names:
process=subprocess.run([sys.executable,'-B',str(R/'tests'/name)],env=env,cwd=R)
results.append({'path':'tests/'+name,'exit':process.returncode})
if process.returncode:break
unchanged=all(hashlib.sha256((R/n).read_bytes()).hexdigest()==h for n,h in inputs.items());code=0 if unchanged and len(results)==len(names) and all(r['exit']==0 for r in results) else 1
(B/'focused-result.json').write_text(json.dumps({'exit':code,'inputs_unchanged':unchanged,'programs':results,'fresh_full_suite_claimed':False},indent=2)+'\n');print('Focused result',code,len(results),'programs', 'inputs unchanged',unchanged);raise SystemExit(code)