[PR #983] Tests: seven runtime tests say what Wine's libraries answer and still check the shim (TEST-WINE-RUNTIME-TESTS) #1021

Open
opened 2026-11-26 20:19:49 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/983
Author: @milk4sale
Created: 11/24/2026
Status: 🔄 Open

Base: main ← Head: test/wine-runtime-tests


📝 Commits (4)

  • 8167723 Tests: seven runtime tests say what Wine's libraries answer and still check the shim (TEST-WINE-RUNTIME-TESTS)
  • e8ea3fa Merge main into test/wine-runtime-tests: keep #758's versioned zero-checksum check, asked of Wine's host the same way
  • edaf545 Merge main into test/wine-runtime-tests
  • 898c1bd Merge main into test/wine-runtime-tests: take main's Wine view checks in xmem_test

📊 Changes

8 files changed (+153 additions, -29 deletions)

View changed files

📝 docs/linux.md (+32 -0)
📝 docs/testing.md (+3 -2)
📝 runtime/test/bcrypt_rng_test.cpp (+27 -2)
📝 runtime/test/check_startup_cmdline.cmake (+9 -1)
📝 runtime/test/dstorage_test.cpp (+7 -2)
📝 runtime/test/gameinput_host_test.cpp (+38 -15)
📝 runtime/test/host_wine.h (+8 -1)
📝 runtime/test/root_sig_test.cpp (+29 -6)

📄 Description

Claimed in the coordination issue as: TEST-WINE-RUNTIME-TESTS (claim)

What and why

Seven runtime tests (six test programs) fail under Wine on what Wine's own libraries do, not on the shim or the loader they are there to check. Each now says what the host did and still checks our side where it can, as #519 did for the D3D12 and DXGI tests.

Test What happens under Wine on main With this change
bcrypt_rng, bcrypt_rng_seeded The shim hands back the host's status for an algorithm it does not serve. Wine's bcrypt answers 0xC0000002 for an unknown name, Microsoft's answers STATUS_NOT_FOUND, and the test expects the second. The test asks the host's BCryptOpenAlgorithmProvider directly and checks that the shim returns the same failure with a null handle. The value itself is still checked wherever the host is not Wine.
gameinput_host Wine's GameInput.dll loads, and its GameInputCreate answers E_NOTIMPL: 3 failures. The import binding is still checked. The calls into the library are skipped only when the host is Wine and its GameInputCreate, asked before anything is mapped, answers E_NOTIMPL.
root_sig Wine's deserializer refuses a container whose checksum is zeroed (E_INVALIDARG) and takes the same one with its checksum intact. The shim forwards the cleared copy, so it cannot succeed there. The host is asked about the cleared copy directly. Wine's refusal, and only Wine's, skips that one check.
run_startup_cmdline The native control fails: Wine's ucrtbase has __argc, __argv and __wargv set before process attach, and the fixture expects them unset there, as on Windows. When the control runs through an emulator (RUNNER set) it is reported and not required. Without one it is required as before. The run through gta6rt is checked on every host, and passes.
dstorage the copy reached the guard page and a running request is pending fail. The one-page allocation can land right above the queue worker's stack, and Wine drops the guard of a page that starts at the reading thread's StackBase without raising anything. One page higher the exception arrives. The guard page is the middle one of three, on every host. No host check.
xmem 2 failures. The first write to a SEC_RESERVE view goes through with no fault and VirtualQuery keeps reporting MEM_RESERVE, so xmem's first-touch handler never runs. Under Wine the page is committed with rt::xmem::commit_physical_range, the call the runtime makes before it imports title memory, and the bytes written before must still be there. On Windows the first touch has to have committed it, as before.

runtime/test/host_wine.h gets is_wine(), the host check with nothing printed; host_is_wine() calls it and behaves as before. docs/linux.md gets a section listing these differences, plus the two that still fail tests (file_system, device_proxy), and docs/testing.md points to it. Tests and docs only: no shim, loader or layer change.

Not in this pull request: file_system (a real shim difference under Wine, posted as a finding), device_proxy and device_proxy_trace (BL-2, #913), and the eight tests of #519. This shares no file with #519 and does not depend on it.

Tested

Cross-built on Linux with clang-cl 23.1.4 and xwin (SDK 10.0.26100), run under wine-staging 11.21.

  • The seven tests on this branch, on main cf4c00cba: all pass, with these SKIP lines: the unknown-algorithm value (2), the calls into GameInput.dll (1), the zero-checksum deserializer check (1), the first-touch commit (2), the native control for args and no_args (2). The branch was then rebased on 98a977b4b, two merges later, which touch only vk_store_test and shader fixtures; not rebuilt after that.
  • Control for the path Windows takes: with is_wine() forced to false and the four programs that use it rebuilt, bcrypt_rng, bcrypt_rng_seeded, gameinput_host, root_sig and xmem fail with the same eight FAIL lines they print on main (1 + 1, 3, 1 and 2). dstorage has no host check, and run_startup_cmdline keys on RUNNER, not on Wine.
  • The whole suite (301 tests run), ctest -j 4, on main 1504c1af6: 17 fail with this change. A run of the same tree with the seven files at main's versions gave 25. The seven go from failed to passed in that comparison. The two runs were not equally quiet: the machine was busy with other jobs during the second (load average above 40), and five more results differ between them: run_tiny_frame, run_tiny_frame_queue_test_settings and d3d12_queue_wait_timeout failed only in the base run, and d3d12_xdxr_rt timed out (so d3d12_xdxr_rt_check did not run) only in the patched one. None of those five uses a program that was rebuilt between the runs, so I count them as timing noise, not as an effect of the change. Without that pair the 15 still failing here are device_proxy, device_proxy_trace, file_system, d3d12_clear, d3d12_clear_formats, d3d12_present, xbox_present (a tiling compositor resizes their window) and the eight of #519.
  • The twelve tests/test_docs_*.py, python -I scripts/check_no_game_data.py on the nine files, and git diff --check.
  • After the merge of main 4a50cafc7 into the branch (e8ea3fa0c; it conflicted with #758 in root_sig_test.cpp): rebuilt, and the seven tests pass under Wine. #758's new check, that the versioned deserializer shim accepts a zero-checksum blob, is kept next to the legacy one and asks Wine's host the same way, since the versioned shim forwards the same cleared copy and Wine refuses a zero checksum there too; root_sig prints one more SKIP line for it. With the Wine check forced off in that file both zero-checksum checks run, so on Windows #758's check runs as it was written.

Not run on Windows, and not built with MSVC: I have neither here. On Windows is_wine() is false and RUNNER is empty, so each test takes the path it took before, except dstorage, whose guard page moves inside a three-page allocation on every host, and bcrypt_rng, which also compares the shim's status with the host's.

GPUs tested: NVIDIA GeForce RTX 4070 Ti, driver 620.70.06, Linux (CachyOS), through wine-staging 11.21

AI-assisted: yes

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/983 **Author:** [@milk4sale](https://github.com/milk4sale) **Created:** 11/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `test/wine-runtime-tests` --- ### 📝 Commits (4) - [`8167723`](https://github.com/ubiquitarianism/leonida/commit/81677234b736649bda6f60b0fa9806edc1c8644f) Tests: seven runtime tests say what Wine's libraries answer and still check the shim (TEST-WINE-RUNTIME-TESTS) - [`e8ea3fa`](https://github.com/ubiquitarianism/leonida/commit/e8ea3fa0cbeff21c1b814ceb87faed17e7b3064e) Merge main into test/wine-runtime-tests: keep #758's versioned zero-checksum check, asked of Wine's host the same way - [`edaf545`](https://github.com/ubiquitarianism/leonida/commit/edaf54593cf7027eab2330ce9550d5f838f89823) Merge main into test/wine-runtime-tests - [`898c1bd`](https://github.com/ubiquitarianism/leonida/commit/898c1bd231ae122f178587107aba3701eda8730b) Merge main into test/wine-runtime-tests: take main's Wine view checks in xmem_test ### 📊 Changes **8 files changed** (+153 additions, -29 deletions) <details> <summary>View changed files</summary> 📝 `docs/linux.md` (+32 -0) 📝 `docs/testing.md` (+3 -2) 📝 `runtime/test/bcrypt_rng_test.cpp` (+27 -2) 📝 `runtime/test/check_startup_cmdline.cmake` (+9 -1) 📝 `runtime/test/dstorage_test.cpp` (+7 -2) 📝 `runtime/test/gameinput_host_test.cpp` (+38 -15) 📝 `runtime/test/host_wine.h` (+8 -1) 📝 `runtime/test/root_sig_test.cpp` (+29 -6) </details> ### 📄 Description Claimed in the coordination issue as: TEST-WINE-RUNTIME-TESTS ([claim](https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7135606065)) ### What and why Seven runtime tests (six test programs) fail under Wine on what Wine's own libraries do, not on the shim or the loader they are there to check. Each now says what the host did and still checks our side where it can, as #519 did for the D3D12 and DXGI tests. | Test | What happens under Wine on `main` | With this change | |---|---|---| | `bcrypt_rng`, `bcrypt_rng_seeded` | The shim hands back the host's status for an algorithm it does not serve. Wine's bcrypt answers `0xC0000002` for an unknown name, Microsoft's answers `STATUS_NOT_FOUND`, and the test expects the second. | The test asks the host's `BCryptOpenAlgorithmProvider` directly and checks that the shim returns the same failure with a null handle. The value itself is still checked wherever the host is not Wine. | | `gameinput_host` | Wine's `GameInput.dll` loads, and its `GameInputCreate` answers `E_NOTIMPL`: 3 failures. | The import binding is still checked. The calls into the library are skipped only when the host is Wine and its `GameInputCreate`, asked before anything is mapped, answers `E_NOTIMPL`. | | `root_sig` | Wine's deserializer refuses a container whose checksum is zeroed (`E_INVALIDARG`) and takes the same one with its checksum intact. The shim forwards the cleared copy, so it cannot succeed there. | The host is asked about the cleared copy directly. Wine's refusal, and only Wine's, skips that one check. | | `run_startup_cmdline` | The native control fails: Wine's `ucrtbase` has `__argc`, `__argv` and `__wargv` set before process attach, and the fixture expects them unset there, as on Windows. | When the control runs through an emulator (`RUNNER` set) it is reported and not required. Without one it is required as before. The run through `gta6rt` is checked on every host, and passes. | | `dstorage` | `the copy reached the guard page` and `a running request is pending` fail. The one-page allocation can land right above the queue worker's stack, and Wine drops the guard of a page that starts at the reading thread's `StackBase` without raising anything. One page higher the exception arrives. | The guard page is the middle one of three, on every host. No host check. | | `xmem` | 2 failures. The first write to a `SEC_RESERVE` view goes through with no fault and `VirtualQuery` keeps reporting `MEM_RESERVE`, so xmem's first-touch handler never runs. | Under Wine the page is committed with `rt::xmem::commit_physical_range`, the call the runtime makes before it imports title memory, and the bytes written before must still be there. On Windows the first touch has to have committed it, as before. | `runtime/test/host_wine.h` gets `is_wine()`, the host check with nothing printed; `host_is_wine()` calls it and behaves as before. `docs/linux.md` gets a section listing these differences, plus the two that still fail tests (`file_system`, `device_proxy`), and `docs/testing.md` points to it. Tests and docs only: no shim, loader or layer change. Not in this pull request: `file_system` (a real shim difference under Wine, posted as a [finding](https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7135606714)), `device_proxy` and `device_proxy_trace` (BL-2, #913), and the eight tests of #519. This shares no file with #519 and does not depend on it. ### Tested Cross-built on Linux with clang-cl 23.1.4 and xwin (SDK 10.0.26100), run under wine-staging 11.21. - The seven tests on this branch, on `main` cf4c00cba: all pass, with these `SKIP` lines: the unknown-algorithm value (2), the calls into GameInput.dll (1), the zero-checksum deserializer check (1), the first-touch commit (2), the native control for `args` and `no_args` (2). The branch was then rebased on 98a977b4b, two merges later, which touch only `vk_store_test` and shader fixtures; not rebuilt after that. - Control for the path Windows takes: with `is_wine()` forced to `false` and the four programs that use it rebuilt, `bcrypt_rng`, `bcrypt_rng_seeded`, `gameinput_host`, `root_sig` and `xmem` fail with the same eight `FAIL` lines they print on `main` (1 + 1, 3, 1 and 2). `dstorage` has no host check, and `run_startup_cmdline` keys on `RUNNER`, not on Wine. - The whole suite (301 tests run), `ctest -j 4`, on `main` 1504c1af6: 17 fail with this change. A run of the same tree with the seven files at `main`'s versions gave 25. The seven go from failed to passed in that comparison. The two runs were not equally quiet: the machine was busy with other jobs during the second (load average above 40), and five more results differ between them: `run_tiny_frame`, `run_tiny_frame_queue_test_settings` and `d3d12_queue_wait_timeout` failed only in the base run, and `d3d12_xdxr_rt` timed out (so `d3d12_xdxr_rt_check` did not run) only in the patched one. None of those five uses a program that was rebuilt between the runs, so I count them as timing noise, not as an effect of the change. Without that pair the 15 still failing here are `device_proxy`, `device_proxy_trace`, `file_system`, `d3d12_clear`, `d3d12_clear_formats`, `d3d12_present`, `xbox_present` (a tiling compositor resizes their window) and the eight of #519. - The twelve `tests/test_docs_*.py`, `python -I scripts/check_no_game_data.py` on the nine files, and `git diff --check`. - After the merge of `main` 4a50cafc7 into the branch (`e8ea3fa0c`; it conflicted with #758 in `root_sig_test.cpp`): rebuilt, and the seven tests pass under Wine. #758's new check, that the versioned deserializer shim accepts a zero-checksum blob, is kept next to the legacy one and asks Wine's host the same way, since the versioned shim forwards the same cleared copy and Wine refuses a zero checksum there too; `root_sig` prints one more `SKIP` line for it. With the Wine check forced off in that file both zero-checksum checks run, so on Windows #758's check runs as it was written. Not run on Windows, and not built with MSVC: I have neither here. On Windows `is_wine()` is false and `RUNNER` is empty, so each test takes the path it took before, except `dstorage`, whose guard page moves inside a three-page allocation on every host, and `bcrypt_rng`, which also compares the shim's status with the host's. GPUs tested: NVIDIA GeForce RTX 4070 Ti, driver 620.70.06, Linux (CachyOS), through wine-staging 11.21 AI-assisted: yes ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
starred/leonida#1021
No description provided.