aorecomp

Anarchy Online classic in the browser

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


tools/client/test_portable_locale.py (990B)


      1 """Compare guest C-locale behavior with Windows MSVCRT."""
      2 import pathlib
      3 import subprocess
      4 
      5 
      6 root = pathlib.Path(__file__).resolve().parents[2]
      7 decompiled = root / "client"
      8 work = root / "local/client/portable-locale"
      9 work.mkdir(parents=True, exist_ok=True)
     10 reference = work / "reference.exe"
     11 subprocess.run([
     12     str(root / "toolchains/llvm-mingw-20261006-ucrt-x86_64/bin/i686-w64-mingw32-clang.exe"),
     13     "-O2", "tests/locale.c", "-o", str(reference),
     14 ], cwd=decompiled, check=True)
     15 expected = subprocess.check_output([str(reference)], 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/locale"], check=True)
     19 actual = subprocess.check_output(wsl + ["./build/linux/locale"], text=True, timeout=30)
     20 assert actual == expected, (expected, actual)
     21 print("Windows == Linux contract: " + actual.strip())