tools/client/test_portable_data_record.py (1156B)
1 """Compare the actual generated data-record copy on Windows and Linux.""" 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-data-record" 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", "-Iruntime", "-ffunction-sections", "-fno-strict-aliasing", "tests/data_record.c", 14 "game/ar.dll/lifted-0001.c", "runtime/recomp_state.c", "-Wl,--gc-sections", "-o", str(reference), 15 ], cwd=decompiled, check=True) 16 expected = subprocess.check_output([str(reference)], text=True, timeout=30) 17 linux_path = "/mnt/" + decompiled.drive[0].lower() + decompiled.as_posix()[2:] 18 wsl = ["wsl", "-d", "Ubuntu-26.04", "--cd", linux_path, "--exec"] 19 subprocess.run(wsl + ["make", "-s", "-f", "Makefile.linux", "build/linux/data-record"], check=True) 20 actual = subprocess.check_output(wsl + ["./build/linux/data-record"], text=True, timeout=30) 21 assert actual == expected, (expected, actual) 22 print("Windows == Linux: " + actual.strip())