tools/client/test_portable_jump.py (1154B)
1 """Compare MSVCRT x86 nonlocal jumps with the portable generated-C landing pads.""" 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-jump' 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/guest_jump.c', '-o', str(reference), 13 ], cwd=decompiled, check=True) 14 expected = subprocess.check_output([str(reference)], text=True, timeout=30) 15 linux_path = '/mnt/' + decompiled.drive[0].lower() + decompiled.as_posix()[2:] 16 wsl = ['wsl', '-d', 'Ubuntu-26.04', '--cd', linux_path, '--exec'] 17 subprocess.run(wsl + ['make', '-s', '-f', 'Makefile.linux', 18 'build/linux/guest-jump', 'build/linux/guest-jump-local'], check=True) 19 for executable in ['guest-jump', 'guest-jump-local']: 20 actual = subprocess.check_output(wsl + ['./build/linux/' + executable], text=True, timeout=30) 21 assert actual == expected, (expected, actual) 22 print('Windows MSVCRT == Linux (global and local registers): ' + expected.strip())