Files
WoW-Hybrid-gateway/tests/profile5_channel_auto_win_test.py
praxisandClaude Fable 5.2 7f2139d8d0 Offline test fixtures
883 files, from working commit b1a079a.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-19 01:32:48 +02:00

33 lines
1.6 KiB
Python

#!/usr/bin/env python3
"""Exercise Profile5 channel admission in the production frame consumer."""
import os
import shutil
import subprocess
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
sys.path.insert(0, str(ROOT / 'ops'))
if any(shutil.which(tool) is None for tool in ('clang', 'lld-link', 'wine')) or not (ROOT / 'runtime/native-wine-prefix/gateway-private-prefix.json').exists():
print('SKIP: local Windows toolchain and private Wine prefix required')
raise SystemExit(77)
from build_wine_wire import FLAGS, LIBS
from wine_console import run_console
folder = ROOT / 'build/profile5-channel-auto-fixture'
folder.mkdir(exist_ok=True)
obj = folder / 'policy.obj'
exe = folder / 'policy.exe'
subprocess.run(['clang', *FLAGS, '-DGW_SOURCE_ONLY_PROFILE=5',
'-DGW_PROFILE5_AUTO_FIXTURE=1', '-c',
str(ROOT / 'tests/engine_channel_win_fixture.c'), '-o', str(obj)], check=True)
subprocess.run(['lld-link', '/entry:fixture_auto_start', '/subsystem:console',
'/nodefaultlib', '/timestamp:0', '/out:' + str(exe), str(obj),
str(LIBS[2]), str(LIBS[3])], check=True)
env = dict(os.environ, WINEPREFIX=str(ROOT / 'runtime/native-wine-prefix'), WINEDEBUG='-all')
for key in ('LD_PRELOAD', 'GW_NATIVE_BOOTSTRAP', 'GW_NATIVE_EXPECTED_EXE', 'GW_NATIVE_REGISTER'):
env.pop(key, None)
result = run_console(['wine', str(exe)], env=env, timeout=15)
assert result.returncode == 0, f'Profile5 channel admission failed at check {result.returncode}'
print('Profile5 channel auto-admission: world gate, original queue, explicit disable, manual re-enable and retirement rearm passed.')