Capture current mission, AI, map and administration development
Include the current addon, terrain integrations, tools, regression tests and recorded development evidence.
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
from pathlib import Path
|
||||
import sys,hashlib,json,subprocess,importlib.util,time,traceback
|
||||
R=Path('/home/jakub/devel/escapistsrereintroduced');B=Path('/tmp/erri-mounted-intercept-root-1247');sys.path.insert(0,str(R/'tools'))
|
||||
sha=lambda p:hashlib.sha256(p.read_bytes()).hexdigest()
|
||||
inputs={str(p.relative_to(R)):sha(p) for folder in ['addons','tests','tools'] for p in (R/folder).rglob('*') if p.is_file() and '__pycache__' not in p.parts and p.suffix not in {'.pyc'}}
|
||||
(B/'suite-inputs.json').write_text(json.dumps(inputs,indent=2)+'\n')
|
||||
original=subprocess.run;programs=[]
|
||||
def track(args,*a,**kw):
|
||||
entry=None
|
||||
if isinstance(args,list) and len(args)>1 and str(args[1]).startswith(str(R/'tests')+'/'):
|
||||
entry={'path':str(Path(args[1]).relative_to(R)),'exit':None};programs.append(entry)
|
||||
try:result=original(args,*a,**kw)
|
||||
except subprocess.CalledProcessError as error:
|
||||
if entry is not None:entry['exit']=error.returncode
|
||||
raise
|
||||
if entry is not None:entry['exit']=result.returncode
|
||||
return result
|
||||
subprocess.run=track
|
||||
spec=importlib.util.spec_from_file_location('repository_check',R/'tools/check.py');module=importlib.util.module_from_spec(spec);spec.loader.exec_module(module)
|
||||
code=0;started=time.monotonic()
|
||||
try:module.check()
|
||||
except Exception:traceback.print_exc();code=1
|
||||
unchanged=all((R/p).is_file() and sha(R/p)==h for p,h in inputs.items());code=code or int(not unchanged)
|
||||
(B/'suite-result.json').write_text(json.dumps({'exit':code,'seconds':round(time.monotonic()-started,2),'inputs_unchanged':unchanged,'regression_programs':len(programs),'programs':programs},indent=2)+'\n')
|
||||
print('Suite exit',code,'programs',len(programs),'unchanged',unchanged)
|
||||
raise SystemExit(code)
|
||||
Reference in New Issue
Block a user