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

27 lines
2.3 KiB
Python

#!/usr/bin/env python3
"""Owned Windows fixture; does not call Forever or claim gameplay compatibility."""
import 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(t) for t in ('clang','lld-link','wine')) or not (ROOT/'runtime/native-wine-prefix/gateway-private-prefix.json').exists():
print('SKIP: requires local Windows toolchain and private test prefix');sys.exit(77)
from build_wine_wire import FLAGS,LIBS
from wine_console import run_console
ownership='--ownership-loss-only' in sys.argv
folder=ROOT/('runtime/vm-build-share/transfer-ownership-loss-fixture-20261026-r1' if ownership else 'runtime/vm-build-share/transfer-channel-fixture');folder.mkdir(parents=True,exist_ok=True);obj=folder/'policy.obj';exe=folder/'policy.exe'
flags=list(FLAGS)
if ownership:
source=(ROOT/'native/wine_pipe_host.c').read_text();start=source.index('void WINAPI gw_wire_engine_session_poll(void* owner){');end=source.index('\n}\n',start)+3
production=folder/'production-owner-poller.inc';production.write_text(source[start:end])
flags+=['-DGW_OWNERSHIP_LOSS_DIAGNOSTIC_FIXTURE=1',f'-DGW_OWNER_LOSS_POLLER_INCLUDE="{production}"']
if '--run-existing' not in sys.argv:
subprocess.run(['clang',*flags,'-c',str(ROOT/'tests/engine_transfer_channel_win_fixture.c'),'-o',str(obj)],check=True)
subprocess.run(['lld-link','/entry:fixture_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)
r=run_console(['wine',str(exe)],env=env,timeout=15)
(folder/'run-stdout-private.log').write_bytes(r.stdout)
(folder/'run-stderr-private.log').write_bytes(r.stderr)
assert r.returncode==0,f'Loading-channel executable exit{r.returncode}; host/fixture attribution requires saved private stdout/stderr'
print('PASS phase12 ownership diagnostic: 11 cases, production poller, 48B ABI, first-loss bits/raw state/prior-error preservation; no original client.' if ownership else 'PASS new loading-channel boundary: explicit proof stubs, owner/connection lifetime, unchanged stage/secondary/queue guards; no native WorldPort acceptance claimed.')