Build independent base gameplay and source-bound native verification
This commit is contained in:
+16
-5
@@ -21,7 +21,7 @@ except (OSError, ValueError) as error:
|
||||
dest=ROOT/'docs/evidence'/a.name
|
||||
try:dest.mkdir(parents=True,exist_ok=False)
|
||||
except FileExistsError:p.error('Evidence already exists; refusing to overwrite')
|
||||
for name in ['console.log','script.log','error.log','rereintroduced-hq.log','headless-launch.log','runner.json']:
|
||||
for name in ['console.log','script.log','error.log','crash.log','rereintroduced-hq.log','headless-launch.log','runner.json','game-startup-report.json']:
|
||||
if (source/name).is_file():shutil.copyfile(source/name,dest/(name+'.txt'))
|
||||
for capture in sorted(source.glob('err-*.png')):
|
||||
if capture.is_file():shutil.copyfile(capture,dest/capture.name)
|
||||
@@ -29,7 +29,18 @@ for capture in sorted(source.glob('err-*.png')):
|
||||
(dest/PROVENANCE).write_bytes(encoded(provenance))
|
||||
if launched:
|
||||
for name in (MANIFEST, METADATA): shutil.copyfile(source/name, dest/name)
|
||||
with (dest/'report.json').open('w') as report:
|
||||
result=subprocess.run([sys.executable,str(ROOT/'tools/native_report.py'),str((dest/'console.log.txt').relative_to(ROOT))],cwd=ROOT,stdout=report)
|
||||
print(f'Archived {dest.relative_to(ROOT)}; native report exit={result.returncode} (nonzero retains failures)')
|
||||
sys.exit(result.returncode)
|
||||
if (source/'game-startup-report.json').is_file():
|
||||
# Recompute from the sealed console rather than trusting the saved summary.
|
||||
# Ordinary startup has no scripted completion and cannot qualify as an escape.
|
||||
from headless_game import game_evidence
|
||||
runner=json.loads((source/'runner.json').read_text())
|
||||
report=game_evidence((dest/'console.log.txt').read_text(errors='replace'),runner.get('project'))
|
||||
report['log']=str((dest/'console.log.txt').relative_to(ROOT))
|
||||
(dest/'report.json').write_bytes(encoded(report))
|
||||
status=0 if report['ready'] and runner.get('result')=='game-started' and runner.get('cleanup_confirmed') is True else 1
|
||||
else:
|
||||
with (dest/'report.json').open('w') as report:
|
||||
result=subprocess.run([sys.executable,str(ROOT/'tools/native_report.py'),str((dest/'console.log.txt').relative_to(ROOT))],cwd=ROOT,stdout=report)
|
||||
status=result.returncode
|
||||
print(f'Archived {dest.relative_to(ROOT)}; native report exit={status} (nonzero retains failures)')
|
||||
sys.exit(status)
|
||||
|
||||
Reference in New Issue
Block a user