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

19 lines
1.4 KiB
Python

#!/usr/bin/env python3
"""Owned Windows fixture for the lazy Realm seam page touch; no game code runs."""
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
folder=ROOT/'build/realm-seam-page-fixture';folder.mkdir(parents=True,exist_ok=True)
obj=folder/'seam.obj';exe=folder/'seam.exe'
subprocess.run(['clang',*FLAGS,'-c',str(ROOT/'tests/realm_seam_page_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=20)
assert r.returncode==0,f'Realm seam page fixture failed at check{r.returncode}'
print('Realm seam page: RX passthrough, one in-page ret admits a lazily protected MEM_MAPPED page, same-generation re-protection defers, re-arm, off-page stub and null probe fail closed.')