tools/client/test_portable_atof.py (991B)
1 """Compare guest floating-point conversion 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-atof" 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/atof.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/atof"], check=True) 19 actual = subprocess.check_output(wsl + ["./build/linux/atof"], text=True, timeout=30) 20 assert actual == expected, (expected, actual) 21 print("Windows == Linux contract: " + actual.strip()) 22