KAZIK/tools/tests/test_hell_tower_runthrough.py
Игорь Федосеев eaac8b861e feat: rework artifacts and tower relics
Extend profiles from 280 to 312 bytes with legacy compatibility.
Keep tower relics run-local and share the profile bankroll.
2026-10-30 23:22:19 +03:00

34 lines
1.6 KiB
Python

"""Smoke-test six real tower scene launches; outcomes injected, not balance measurement."""
import hashlib
from pathlib import Path
import subprocess
from check_artifacts import toolchain
ROOT = Path(__file__).resolve().parents[2]
OUT = ROOT/'build/hell-tower'
def main():
OUT.mkdir(parents=True, exist_ok=True)
source_hash = hashlib.sha256((ROOT/'poker.asm').read_bytes()).digest()
runtime = {p: hashlib.sha256(p.read_bytes()).digest()
for p in (ROOT/'runtime').rglob('*') if p.is_file()}
ml, link = toolchain()
sdk = Path('C:/Program Files (x86)/Windows Kits/10/Lib')
libraries = next(p/'um/x86' for p in sorted(sdk.iterdir(), reverse=True)
if (p/'um/x86/kernel32.lib').exists())
subprocess.run([str(ml), '/c', '/coff', '/Cp', '/nologo', '/I.', '/DHELL_TOWER_TEST=1',
'/Fobuild/hell-tower/test.obj', 'poker.asm'], cwd=ROOT, check=True)
subprocess.run([str(link), '/nologo', '/SUBSYSTEM:CONSOLE', '/LIBPATH:'+str(libraries),
'/OUT:build/hell-tower/test.exe', 'build/hell-tower/test.obj',
'kernel32.lib', 'winmm.lib', 'user32.lib', 'gdi32.lib', 'opengl32.lib'],
cwd=ROOT, check=True)
subprocess.run([str(OUT/'test.exe')], cwd=ROOT, check=True, timeout=90)
assert hashlib.sha256((ROOT/'poker.asm').read_bytes()).digest() == source_hash
assert {p: hashlib.sha256(p.read_bytes()).digest()
for p in (ROOT/'runtime').rglob('*') if p.is_file()} == runtime
print('PASS: six tower scene launches, reward transitions and exit; source/runtime unchanged')
if __name__ == '__main__':
main()