Files
WoW-Hybrid-gateway/tests/engine_packet_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

21 lines
1.8 KiB
Python

#!/usr/bin/env python3
"""Own Wine process only; verify Windows ABI and rejection gates, no game calls."""
import json,os,shutil,subprocess,sys
from pathlib import Path
ROOT=Path(__file__).resolve().parents[1]
sys.path.insert(0,str(ROOT/'ops'))
if not all(shutil.which(tool) for tool in ('clang','lld-link','wine')) or not (ROOT/'runtime/native-wine-prefix/gateway-private-prefix.json').exists():
print('SKIP: requires the existing private Wine development prefix and Windows build tools');sys.exit(77)
from native_pe_bridge import build
from wine_console import run_console
build();folder=ROOT/'build/native-pe'
source=ROOT/'tests/engine_packet_win_fixture.c';obj=folder/'packet-fixture.obj';exe=folder/'packet-fixture.exe'
dll='Z:'+str(folder/'GWNativeBridge.dll').replace('/','\\')
subprocess.run(['clang','--target=x86_64-pc-windows-msvc','-I/usr/include/wine/windows','-I/usr/include/wine/msvcrt','-O2','-ffreestanding','-fno-stack-protector','-DGW_DLL_PATH='+json.dumps(dll),'-c',str(source),'-o',str(obj)],check=True)
subprocess.run(['lld-link','/entry:fixture_start','/subsystem:console','/nodefaultlib','/timestamp:0','/out:'+str(exe),str(obj),'/usr/lib/wine/x86_64-windows/libkernel32.a'],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'Own Windows packet-host ABI fixture failed with code{result.returncode}; no raw diagnostics exported'
print('Own Windows DLL fixture: proof/length/owner/thread gates reject safely; six-argument submission, five-argument receive and original poll forwarding verified. No game function called.')