24 lines
2.1 KiB
Python
24 lines
2.1 KiB
Python
from pathlib import Path
|
|
import datetime,hashlib,json,os,shutil,subprocess
|
|
root=Path('C:/ar-diagram-01a0d717')
|
|
run=root/'.local/native-reading';run.mkdir(exist_ok=False)
|
|
work=run/'working';work.mkdir()
|
|
fixture=root/'.local/issue38-probe-run01/eight-card-representative.json'
|
|
shutil.copyfile(fixture,work/'eight-card.json')
|
|
baseline=hashlib.sha256(fixture.read_bytes()).hexdigest()
|
|
bundle=Path('C:/ar-compact-01a0d717/.local/package39/extracted/ArcadiaStudio-0.2.0-preview.compact-help.20261001-x86_64-pc-windows-gnullvm')
|
|
exe=bundle/'arcadia-studio.exe'
|
|
sha=lambda p:hashlib.sha256(p.read_bytes()).hexdigest()
|
|
assert sha(exe)=='d55ecad4b0f75c0c9c26625e5441bef9c9360890b65bc13236c6ebfaf03d631e'
|
|
env=os.environ.copy();system=os.environ['SystemRoot'];env['PATH']=str(Path(system)/'System32')+';'+system
|
|
for k in list(env):
|
|
if k.startswith(('CARGO_','RUST','LLVM','WGPU','ARCADIA_')):del env[k]
|
|
receipt={'source':'6e7c4ddaf0775198384a8c4882809ea8e14b2976','routing_core_source':'715036e132677dd2bc2fb37ed316d93dc9987aec','fixture_probe_source':'f754ad85d3674a709d10054e6fe23079f977c547','start':datetime.datetime.now(datetime.timezone.utc).isoformat(),'binary_sha256':sha(exe),'runtime_sha256':sha(bundle/'libunwind.dll'),'fixture_sha256':baseline,'fixture':str(work/'eight-card.json'),'cwd':str(work),'path':env['PATH']}
|
|
with (run/'stdout.log').open('xb') as out,(run/'stderr.log').open('xb') as err:
|
|
child=subprocess.Popen([str(exe)],cwd=work,env=env,stdout=out,stderr=err,creationflags=subprocess.CREATE_NO_WINDOW)
|
|
receipt['pid']=child.pid;(run/'started.json').write_text(json.dumps(receipt,indent=2)+'\n',encoding='utf-8');print(json.dumps(receipt,indent=2),flush=True)
|
|
code=child.wait()
|
|
receipt.update({'exit_code':code,'finished':datetime.datetime.now(datetime.timezone.utc).isoformat(),'stdout_bytes':(run/'stdout.log').stat().st_size,'stderr_bytes':(run/'stderr.log').stat().st_size,'fixture_unchanged':sha(work/'eight-card.json')==baseline})
|
|
(run/'finished.json').write_text(json.dumps(receipt,indent=2)+'\n',encoding='utf-8');print(json.dumps(receipt,indent=2),flush=True)
|
|
assert code==0 and receipt['stdout_bytes']==receipt['stderr_bytes']==0 and receipt['fixture_unchanged']
|