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

57 lines
3.0 KiB
Python

#!/usr/bin/env python3
"""Exercise the maintained Source club identity implementation by PE profile.
Uses the existing context fixture and a synthetic Win32 memory boundary only;
no client process, account data, network traffic, or credential input is used.
"""
import argparse
import json
from pathlib import Path
import subprocess
import tempfile
ROOT = Path(__file__).resolve().parents[1]
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('build', type=Path)
args = parser.parse_args()
evidence = ROOT/'runtime/continuation-20261113/codex/Accepted-work-recovery-20261118/guild-agent'
evidence.mkdir(parents=True, exist_ok=True)
checks = []
with tempfile.TemporaryDirectory(dir=evidence) as directory:
path = Path(directory)
for profile in (2, 5):
exe = path/f'context-profile{profile}'
command = ['g++', '-std=c++20', '-O1', '-Wall', '-Wextra', '-Wpedantic', '-Werror',
f'-DGW_SOURCE_ONLY_PROFILE={profile}', '-I'+str(ROOT/'native'),
'-I'+str(ROOT/'include'), str(ROOT/'tests/native_club_source_context_test.cpp'),
str(args.build.resolve()/'libgateway_protocol.a'), '-lcrypto', '-lz', '-o', str(exe)]
with (evidence/f'admission-profile{profile}-compile.private.log').open('w') as log:
subprocess.run(command, stdout=log, stderr=subprocess.STDOUT, check=True)
with (evidence/f'admission-profile{profile}-run.private.log').open('w') as log:
subprocess.run([str(exe)], stdout=log, stderr=subprocess.STDOUT, check=True)
checks.append({'profile': profile, 'expected': 'Source context implementation', 'result': 'PASS'})
# Other profiles must keep the original no-op boundary. This fixture
# intentionally supplies no native memory/identity dependencies: an
# accidental widening of the implementation cannot compile silently.
source = path/'excluded.c'
source.write_text('#include <assert.h>\n#include "wine_club_source_context.inc"\n'
'int main(void){assert(club_source_publish()==0);club_source_clear();return 0;}\n')
for profile in (0, 3, 4):
exe = path/f'excluded-profile{profile}'
command = ['cc', '-std=c11', '-Wall', '-Wextra', '-Wpedantic', '-Werror',
f'-DGW_SOURCE_ONLY_PROFILE={profile}', '-I'+str(ROOT/'native'),
str(source), '-o', str(exe)]
with (evidence/f'admission-profile{profile}-compile.private.log').open('w') as log:
subprocess.run(command, stdout=log, stderr=subprocess.STDOUT, check=True)
subprocess.run([str(exe)], check=True)
checks.append({'profile': profile, 'expected': 'No-op implementation', 'result': 'PASS'})
(evidence/'profile-admission-results.private.json').write_text(json.dumps(checks, indent=2)+'\n')
print('PASS Source club context profiles2/5; unrelated profiles0/3/4 remain excluded')
if __name__ == '__main__':
main()