Skip to content

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

Open
robot00f wants to merge 1 commit into
ProjectLeonida:mainfrom
robot00f:fix/device-filter-wine
Open

robot00f wants to merge 1 commit into
ProjectLeonida:mainfrom
robot00f:fix/device-filter-wine

Conversation

@robot00f

Copy link
Copy Markdown
Contributor

Claim: #14 (comment) (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.)

@lixonik lixonik left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 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 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

Copy link
Copy Markdown
Contributor

Tested 9a04373 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

Tauwni commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants