test: run the device-filter tools through wine on a non-Windows host (#1150) #1219

Merged
leonida/mandy
robot00f merged 1 commit from fix/device-filter-wine into main 2026-11-28 09:38:48 +00:00

Pull request successfully merged and closed

robot00f commented 2026-11-24 20:30:01 +00:00

Claim: https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7143617202 (ID VK-DEVICE-FILTER-WINE; from #1150)

vk_device_filter_tools runs a host Python that started vk_descriptor_bench.exe directly, so a ctest run on Linux got OSError: [Errno 8] Exec format error (PierreEbele, #1150) -- a runner bug, not a tool bug: the tools are right to be Windows executables, and the test passes natively here.

Change

runtime/test/check_device_filter_tools.py: one launcher() picks the prefix a tool runs with -- [] on Windows and for a non-PE, wine when the target starts with MZ on any other host, with LEONIDA_WINE naming another loader. It is applied to both tools, not only the one that lists devices. When the host is not Windows and the loader is not on PATH, the script exits 77 with SKIP: ... <loader> is not on PATH instead of reporting the Exec format error as a failure. Native Windows is unchanged.

tests/test_check_device_filter_tools.py covers the choice itself (Windows direct, PE through wine, non-PE direct, no loader still names one, the override, a missing tool, and the 77 path through main), so the branch runs on Windows CI where wine is absent.

Tested

  • The script natively against both real tools: ok: vk_descriptor_bench refuses ... / ok: vk_sandbox refuses ..., exit 0 -- unchanged from before.
  • python -I tests/test_check_device_filter_tools.py -> OK (7 tests); compileall -> 0; check_no_game_data.py -> exit 0.

Not run: a Wine host (none here). The launcher branch is covered by the unit test, not by a real Wine launch.

GPUs tested: NVIDIA GPU (Pascal class, 4 GB), driver 582.28, Windows 10 19045 for the native run.

AI-assisted: yes (OpenCode, DeepSeek V4.1 Flash)

Checklist

  • Based on current main and merges cleanly.
  • One topic.
  • No game data, keys or decryption (CONTRIBUTING.md).
  • A new translator rule is in the contract table of docs/design.md. (No translator change.)
Claim: https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7143617202 (ID `VK-DEVICE-FILTER-WINE`; from #1150) `vk_device_filter_tools` runs a host Python that started `vk_descriptor_bench.exe` directly, so a ctest run on Linux got `OSError: [Errno 8] Exec format error` (PierreEbele, #1150) -- a runner bug, not a tool bug: the tools are right to be Windows executables, and the test passes natively here. ### Change `runtime/test/check_device_filter_tools.py`: one `launcher()` picks the prefix a tool runs with -- `[]` on Windows and for a non-PE, `wine` when the target starts with `MZ` on any other host, with `LEONIDA_WINE` naming another loader. It is applied to both tools, not only the one that lists devices. When the host is not Windows and the loader is not on `PATH`, the script exits 77 with `SKIP: ... <loader> is not on PATH` instead of reporting the Exec format error as a failure. Native Windows is unchanged. `tests/test_check_device_filter_tools.py` covers the choice itself (Windows direct, PE through wine, non-PE direct, no loader still names one, the override, a missing tool, and the 77 path through `main`), so the branch runs on Windows CI where wine is absent. ### Tested - The script natively against both real tools: `ok: vk_descriptor_bench refuses ...` / `ok: vk_sandbox refuses ...`, exit 0 -- unchanged from before. - `python -I tests/test_check_device_filter_tools.py` -> OK (7 tests); `compileall` -> 0; `check_no_game_data.py` -> exit 0. Not run: a Wine host (none here). The launcher branch is covered by the unit test, not by a real Wine launch. GPUs tested: NVIDIA GPU (Pascal class, 4 GB), driver 582.28, Windows 10 19045 for the native run. AI-assisted: yes (OpenCode, DeepSeek V4.1 Flash) ### Checklist - [x] Based on current main and merges cleanly. - [x] One topic. - [x] No game data, keys or decryption (CONTRIBUTING.md). - [ ] A new translator rule is in the contract table of docs/design.md. (No translator change.)
lixonik reviewed 2026-11-25 05:32:45 +00:00
lixonik left a comment
No description provided.
The Wine routing itself worked in an independent WSL run at `9a043734`. All seven launcher unit tests passed. A synthetic executable wrapper also received all three calls in order: device listing, filtered benchmark, and filtered sandbox. The filter was cleared for enumeration and set for both probes. One gap remains in the documented Proton cross-build. The [CTest registration](https://github.com/ubiquitarianism/leonida/blob/9a043734a4f4d9a4ef0705f4782f9ecdd6c86c2d/runtime/CMakeLists.txt#L1490-L1494) launches host Python and does not forward `CMAKE_CROSSCOMPILING_EMULATOR`. With the three arguments from that registration and no plain `wine` on PATH, the checker exited 77 while a working custom loader was available at a separate path. Passing that same loader through `LEONIDA_WINE` made it exit 0. The [documented Proton setup](https://github.com/ubiquitarianism/leonida/blob/9a043734a4f4d9a4ef0705f4782f9ecdd6c86c2d/docs/testing.md#L233-L242) configures the CMake emulator. Could the test pass the configured emulator and its arguments through to the checker? #1086 has a `--runner` pattern for this test. Autodetection can still serve direct invocations. AI-assisted. Synthetic executables and launcher, CPU only.
PierreEbele commented 2026-11-25 06:36:34 +00:00

Tested 9a043734a under Wine 10.0 on Linux, GTX 1050 Ti (NVIDIA 555.58), against the real Windows cross-build tools (clang-cl + xwin) vk_descriptor_bench.exe and vk_sandbox.exe:

  • main's check_device_filter_tools.py: exit 1, OSError: [Errno 8] Exec format error
  • this PR's: exit 0, both tools refuse LEONIDA_VK_DEVICE=leonida-no-such-gpu (exit 1), as TEST-1141 expects
  • python3 -I tests/test_check_device_filter_tools.py: OK

I had opened #1618 for the same fix without seeing this one; closing it in favour of this PR. AI-assisted.

Recommendation: Merge

Tested 9a043734a under Wine 10.0 on Linux, GTX 1050 Ti (NVIDIA 555.58), against the real Windows cross-build tools (clang-cl + xwin) `vk_descriptor_bench.exe` and `vk_sandbox.exe`: - `main`'s `check_device_filter_tools.py`: exit 1, `OSError: [Errno 8] Exec format error` - this PR's: exit 0, both tools refuse `LEONIDA_VK_DEVICE=leonida-no-such-gpu` (exit 1), as TEST-1141 expects - `python3 -I tests/test_check_device_filter_tools.py`: OK I had opened #1618 for the same fix without seeing this one; closing it in favour of this PR. AI-assisted. **Recommendation:** Merge
Tauwni commented 2026-11-26 15:37:23 +00:00

Tested on a Mac: Apple M3, macOS 26.5.1, with Wine 11.0 (the WineHQ macOS build, x86-64 under Rosetta, with its bundled MoltenVK 1.4.1). main fbf100b1b was cross-built with clang-cl/lld-link 23.1.6 and xwin's SDK 10.0.26100.

  • On main the test fails the same way as on Linux: OSError: [Errno 8] Exec format error: .../vk_descriptor_bench.exe. macOS has no binfmt, so the .exe never starts.
  • With this PR's script, both tools now run under wine and refuse the filter (exit 1, and they print LEONIDA_VK_DEVICE=leonida-no-such-gpu: no Vulkan physical device matches). The script still reports FAIL for both, though, because of the "device:" in out check. Wine's MoltenVK logs at info level by default, and every instance prints [mvk-info] GPU device:, so the test reads that as the tool having chosen a GPU.

The tools print their own pick at the start of a line (device: %s (...), as in vk_descriptor_bench.cpp), so anchoring the check fixes it. With this one line changed, both report ok and the script exits 0:

        if code == 0 or not named or re.search(r"^device:", out, re.M):

The unchanged script also passes with MVK_CONFIG_LOG_LEVEL=1, but the anchored match doesn't depend on the driver's logging. tests/test_check_device_filter_tools.py passes on this branch.

#1086 carries the same "device:" in out check in its version of the script.

AI-assisted (Claude Code). No game data.

Tested on a Mac: Apple M3, macOS 26.5.1, with Wine 11.0 (the WineHQ macOS build, x86-64 under Rosetta, with its bundled MoltenVK 1.4.1). `main` `fbf100b1b` was cross-built with clang-cl/lld-link 23.1.6 and xwin's SDK 10.0.26100. - On `main` the test fails the same way as on Linux: `OSError: [Errno 8] Exec format error: .../vk_descriptor_bench.exe`. macOS has no binfmt, so the `.exe` never starts. - With this PR's script, both tools now run under `wine` and refuse the filter (exit 1, and they print `LEONIDA_VK_DEVICE=leonida-no-such-gpu: no Vulkan physical device matches`). The script still reports **FAIL** for both, though, because of the `"device:" in out` check. Wine's MoltenVK logs at info level by default, and every instance prints `[mvk-info] GPU device:`, so the test reads that as the tool having chosen a GPU. The tools print their own pick at the start of a line (`device: %s (...)`, as in `vk_descriptor_bench.cpp`), so anchoring the check fixes it. With this one line changed, both report `ok` and the script exits 0: ```python if code == 0 or not named or re.search(r"^device:", out, re.M): ``` The unchanged script also passes with `MVK_CONFIG_LOG_LEVEL=1`, but the anchored match doesn't depend on the driver's logging. `tests/test_check_device_filter_tools.py` passes on this branch. #1086 carries the same `"device:" in out` check in its version of the script. AI-assisted (Claude Code). No game data.
MoonEyes commented 2026-11-28 09:38:41 +00:00

Red/green: tests/test_check_device_filter_tools.py fails on main (1 failed) and passes with this PR (7 passed).
Runtime batch of 20 PRs tested by OreoFR (full build, ctest without the game, Python suite, translator): same results as main 09c153948, RTX 4070 Laptop / Windows 11.
AI-assisted (Claude Code, Claude Opus 5.5)

Red/green: tests/test_check_device_filter_tools.py fails on main (1 failed) and passes with this PR (7 passed). Runtime batch of 20 PRs tested by OreoFR (full build, ctest without the game, Python suite, translator): same results as main 09c153948, RTX 4070 Laptop / Windows 11. AI-assisted (Claude Code, Claude Opus 5.5)
OreoFR commented 2026-11-28 21:47:48 +00:00

Verified by OreoFR

  • Base: main 09c153948 + PR head 9a043734a; integration package 1 of 6 (20 PRs, merged without conflict)
  • Test: full runtime build; ctest -j 6 without the 28 tests that launch gta6rt; full Python suite; translator suite
  • Red on main: n/a (integration test; main baseline: xbox_present and d3d12_set_descriptor_heaps)
  • Green with the PR: ctest: only xbox_present and d3d12_set_descriptor_heaps fail, as on main; Python: the same 7 failing files as main, the PRs' 11 test files pass; translator: 0 failures
  • Verdict: CLEAN PACKAGE (no new failure vs main)
  • Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11

AI-assisted (Claude Code, Claude Opus 5.5).

**Verified by OreoFR** - Base: main `09c153948` + PR head `9a043734a`; integration package 1 of 6 (20 PRs, merged without conflict) - Test: full runtime build; ctest -j 6 without the 28 tests that launch gta6rt; full Python suite; translator suite - Red on main: n/a (integration test; main baseline: xbox_present and d3d12_set_descriptor_heaps) - Green with the PR: ctest: only xbox_present and d3d12_set_descriptor_heaps fail, as on main; Python: the same 7 failing files as main, the PRs' 11 test files pass; translator: 0 failures - Verdict: CLEAN PACKAGE (no new failure vs main) - Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11 AI-assisted (Claude Code, Claude Opus 5.5).
Sign in to join this conversation.
No description provided.