aorecomp

Anarchy Online classic in the browser

git clone https://aorecomp.ubeagle.com/code/aorecomp.git


tools/client/test_portable_audio.py (1078B)


      1 """Compare the reached Miles startup contract with the bundled Windows runtime."""
      2 import pathlib
      3 import subprocess
      4 
      5 root = pathlib.Path(__file__).resolve().parents[2]
      6 decompiled = root / 'client'
      7 work = root / 'local/client/portable-audio'
      8 work.mkdir(parents=True, exist_ok=True)
      9 reference = work / 'reference.exe'
     10 subprocess.run([
     11     str(root / 'toolchains/llvm-mingw-20261006-ucrt-x86_64/bin/i686-w64-mingw32-clang.exe'),
     12     '-O2', 'tests/audio.c', '-lwinmm', '-o', str(reference),
     13 ], cwd=decompiled, check=True)
     14 expected = subprocess.check_output([str(reference),
     15     str(root / 'anarchy-runtime-14.9.1/Mss32.dll')], text=True, timeout=30)
     16 linux_path = '/mnt/' + decompiled.drive[0].lower() + decompiled.as_posix()[2:]
     17 wsl = ['wsl', '-d', 'Ubuntu-26.04', '--cd', linux_path, '--exec']
     18 subprocess.run(wsl + ['make', '-s', '-f', 'Makefile.linux', 'build/linux/audio'], check=True)
     19 actual = subprocess.check_output(wsl + ['./build/linux/audio'], text=True, timeout=30)
     20 assert actual == expected, (expected, actual)
     21 print('Windows Miles == Linux contract: ' + actual.strip())