45 lines
1.8 KiB
Python
45 lines
1.8 KiB
Python
#!/usr/bin/env python3
|
|
"""Summarize native smoke evidence without confusing it with gameplay acceptance."""
|
|
from pathlib import Path
|
|
import argparse
|
|
import json
|
|
import re
|
|
|
|
|
|
def analyze(log_text, log_name):
|
|
failures = [line.strip() for line in log_text.splitlines()
|
|
if 'ERR SMOKE FAIL:' in line or 'Virtual Machine Exception' in line
|
|
or re.search(r'\bSCRIPT\s+\(E\)', line)
|
|
or "won't take damage and wont replicate" in line]
|
|
return {
|
|
'log': str(log_name),
|
|
'smoke_completions': log_text.count('ERR SMOKE COMPLETE:'),
|
|
'assertions_passed': len(re.findall('ERR SMOKE PASS:', log_text)),
|
|
'script_or_runtime_failures': failures,
|
|
'engine_errors': [line.strip() for line in log_text.splitlines()
|
|
if re.search(r'\b[A-Z][A-Z0-9_]*\s+\(E\)', line)],
|
|
'missing_end_screen': [line.strip() for line in log_text.splitlines()
|
|
if 'Could not find' in line and 'endscreen' in line],
|
|
'scope': 'scripted local Workbench integration only; no multiplayer, piloting or FPS claim',
|
|
}
|
|
|
|
|
|
def clean(report, require_completions=1):
|
|
return (report['smoke_completions'] >= require_completions
|
|
and not report['script_or_runtime_failures']
|
|
and not report['engine_errors'] and not report['missing_end_screen'])
|
|
|
|
|
|
def main():
|
|
parser = argparse.ArgumentParser(description=__doc__)
|
|
parser.add_argument('log', type=Path)
|
|
parser.add_argument('--require-completions', type=int, default=1)
|
|
args = parser.parse_args()
|
|
report = analyze(args.log.read_text(errors='replace'), args.log)
|
|
print(json.dumps(report, indent=2))
|
|
return 0 if clean(report, args.require_completions) else 1
|
|
|
|
|
|
if __name__ == '__main__':
|
|
raise SystemExit(main())
|