| 123456789101112131415161718192021222324252627282930313233 |
- #!/usr/bin/env python3
- import json
- import os
- from pathlib import Path
- import subprocess
- release = Path('/home/user/XJKJ-STL-qt-clean-0.8.0')
- binary = release / 'qt-client/build-probe/QtCleanProbe'
- evidence = release / 'evidence'
- env = dict(os.environ, QT_QPA_PLATFORM='offscreen')
- env.pop('LD_LIBRARY_PATH', None)
- summary = []
- for mode in ['fixture', 'fixture-amt', 'fixture-fail', 'fixture-unexpected-boot']:
- report = evidence / ('qt-' + mode + '.json')
- with (evidence / ('qt-' + mode + '.log')).open('w') as out:
- p = subprocess.run([str(binary), '--mode', mode, '--report', str(report),
- '--screenshot', str(evidence / ('qt-' + mode + '.png')), '--timeout', '45'],
- env=env, stdout=out, stderr=subprocess.STDOUT, timeout=60)
- data = json.loads(report.read_text()) if report.exists() else {}
- negative = mode in ('fixture-fail', 'fixture-unexpected-boot')
- passed = p.returncode == (1 if negative else 0) and data.get('pass') is not negative
- if negative:
- passed = passed and data.get('checks', {}).get('no_firmware_execution_failure') is False
- if mode == 'fixture-unexpected-boot':
- passed = passed and data.get('checks', {}).get('unexpected_boot_failure_is_prompt') is True
- passed = passed and data.get('checks', {}).get('unexpected_boot_stopped_with_pending_stage') is True
- row = {'mode': mode, 'exit_code': p.returncode, 'expected_negative': negative,
- 'passed': passed, 'checks': len(data.get('checks', {})),
- 'false_checks': [key for key, value in data.get('checks', {}).items() if value is False]}
- summary.append(row)
- print(json.dumps(row), flush=True)
- (evidence / 'qt-fixtures-summary.json').write_text(json.dumps(summary, indent=2) + '\n')
- raise SystemExit(0 if all(row['passed'] for row in summary) else 1)
|