Capture current source, content data, tests, asset licenses, and original-specification traceability. Original implementation remains incomplete. The accepted matching UI generation passed 154 suites and 12,253 checks, with eight rendered staff-contract screens reviewed. Latest native Windows and full-original acceptance remain outstanding.
51 lines
2.5 KiB
Python
51 lines
2.5 KiB
Python
#!/usr/bin/env python3
|
|
"""Debug a naturally opened inn through three closes and an actual process restart."""
|
|
import argparse
|
|
import hashlib
|
|
import json
|
|
import os
|
|
from pathlib import Path
|
|
import subprocess
|
|
import time
|
|
import uuid
|
|
|
|
|
|
def main():
|
|
parser = argparse.ArgumentParser(description=__doc__)
|
|
parser.add_argument('--godot', default='godot')
|
|
parser.add_argument('--rendered', action='store_true')
|
|
parser.add_argument('--output', type=Path, default=Path('artifacts/opening-restart-flow'))
|
|
args = parser.parse_args()
|
|
root = Path(__file__).resolve().parents[1]
|
|
output = args.output.resolve()
|
|
output.mkdir(parents=True, exist_ok=True)
|
|
env = dict(os.environ, THE_TREE_OPENING_RESTART_SLOT=f'user://tests/opening_restart_{uuid.uuid4().hex}/manual', THE_TREE_OPENING_RESTART_OUTPUT=str(output))
|
|
env.pop('THE_TREE_OPENING_CAPTURE', None)
|
|
command = [args.godot] + ([] if args.rendered else ['--headless']) + ['--path', str(root), '--script', 'res://tests/ui/fixtures/opening_restart_flow.gd']
|
|
source_paths = [p for directory in ('autoload', 'scripts', 'scenes', 'data', 'tests') for p in (root/directory).rglob('*') if p.suffix in ('.gd', '.tres', '.tscn', '.json')]
|
|
hashes = {str(p.relative_to(root)): hashlib.sha256(p.read_bytes()).hexdigest() for p in sorted(source_paths)}
|
|
(output/'source-start.json').write_text(json.dumps(hashes, indent=2)+'\n')
|
|
results = []
|
|
for phase in ('write', 'read'):
|
|
started = time.monotonic()
|
|
log_path = output/f'{phase}.log'
|
|
with log_path.open('w') as log:
|
|
try:
|
|
code = subprocess.run(command + (['--', '--read'] if phase == 'read' else []), cwd=root, env=env, stdout=log, stderr=subprocess.STDOUT, timeout=1200).returncode
|
|
except subprocess.TimeoutExpired:
|
|
code = 124
|
|
content = log_path.read_text()
|
|
passed = code == 0 and '0 failures' in content and 'ERROR:' not in content
|
|
results.append(dict(phase=phase, exit_code=code, passed=passed, seconds=round(time.monotonic()-started, 2), log=log_path.name))
|
|
(output/'result.json').write_text(json.dumps(results, indent=2)+'\n')
|
|
print(json.dumps(results[-1]), flush=True)
|
|
if not passed:
|
|
return 1
|
|
changed = [p for p,h in hashes.items() if not (root/p).exists() or hashlib.sha256((root/p).read_bytes()).hexdigest()!=h]
|
|
(output/'source-change.json').write_text(json.dumps(changed, indent=2)+'\n')
|
|
return 1 if changed else 0
|
|
|
|
|
|
if __name__ == '__main__':
|
|
raise SystemExit(main())
|