21 lines
1.1 KiB
Python
21 lines
1.1 KiB
Python
#!/usr/bin/env python3
|
|
import json, os, pathlib, signal, subprocess, sys
|
|
root=pathlib.Path('/mnt/storage/src/mosaic-stack-rocko-49')
|
|
out=pathlib.Path(__file__).resolve().parent/'gate';out.mkdir(exist_ok=True)
|
|
steps=[]
|
|
for package in ['bus','tasks','cli','webui','harness','seat']:
|
|
files=[str(f.relative_to(root)) for f in sorted((root/'packages'/package/'tests').glob('*.test.mjs'))]
|
|
steps.append(('pkg-'+package,['node','--test','--test-concurrency=1','--test-reporter=spec',*files]))
|
|
steps.append(('script-land-work',['bash','scripts/test-land-work.sh']))
|
|
results=[]
|
|
for name,command in steps:
|
|
with (out/(name+'.log')).open('w') as log:
|
|
p=subprocess.Popen(command,cwd=root,env={**os.environ,'DOCKER_HOST':'unix:///nonexistent.sock'},
|
|
stdout=log,stderr=subprocess.STDOUT,start_new_session=True)
|
|
try: rc=p.wait(timeout=1200)
|
|
except subprocess.TimeoutExpired: os.killpg(p.pid,signal.SIGKILL);p.wait();rc='timeout'
|
|
results.append(dict(suite=name,exit=rc,command=command))
|
|
(out/'results.json').write_text(json.dumps(results,indent=2)+'\n')
|
|
print(name,rc,flush=True)
|
|
if rc!=0:sys.exit(1)
|