#!/usr/bin/env python3 """Run the real Windows Qt binary with bundled DLLs; fixtures never touch BMC.""" import argparse import json import os from pathlib import Path import subprocess parser = argparse.ArgumentParser() parser.add_argument('--release', type=Path, default=Path(r'C:\Users\Administrator\delivery\XJKJ-STL-Qt-Clean-0.8.1.12')) args = parser.parse_args() app = args.release / 'app' evidence = args.release / 'evidence' evidence.mkdir(exist_ok=True) env = dict(os.environ, QT_QPA_PLATFORM='offscreen', STL_QT_DISABLE_SERIAL='1') env['PATH'] = os.path.join(env.get('SystemRoot', r'C:\Windows'), 'System32') + ';' + env.get('SystemRoot', r'C:\Windows') for key in ('QT_PLUGIN_PATH', 'QT_QPA_PLATFORM_PLUGIN_PATH', 'QTDIR', 'STL_QT_CONFIG_DIR', 'STL_QT_PLANS_FILE', 'STL_QT_BACKEND_URL'): env.pop(key, None) summary = [] for mode in ['fixture', 'fixture-amt', 'fixture-fail', 'fixture-unexpected-boot', 'fixture-silent', 'read-only']: label = 'windows-qt-' + mode report = evidence / (label + '.json') command = [str(app / 'QtCleanProbe.exe'), '--mode', mode, '--report', str(report), '--screenshot', str(evidence / (label + '.png')), '--timeout', '45'] if mode == 'read-only': command.extend(['--url', 'ws://192.168.2.79:8080/ws?view=qt-clean']) with (evidence / (label + '.log')).open('w', encoding='utf-8') as out: process = subprocess.run(command, cwd=app, env=env, stdout=out, stderr=subprocess.STDOUT, timeout=65) data = json.loads(report.read_text(encoding='utf-8')) if report.exists() else {} negative = mode in ('fixture-fail', 'fixture-unexpected-boot') passed = process.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': process.returncode, 'expected_negative': negative, 'passed': passed, 'checks': len(data.get('checks', {})), 'elapsed_ms': data.get('elapsed_ms'), 'false_checks': [key for key, value in data.get('checks', {}).items() if value is False]} summary.append(row) print(json.dumps(row), flush=True) result = {'passed': all(row['passed'] for row in summary), 'os': os.name, 'uses_bundled_runtime_without_sdk_path': True, 'scenarios': summary} (evidence / 'windows-qt-validation-summary.json').write_text(json.dumps(result, indent=2) + '\n', encoding='utf-8') raise SystemExit(0 if result['passed'] else 1)