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

Open
github-bot wants to merge 4 commits from github-bot/gh-983 into main AGit
Owner

@⁠milk4sale on GitHub · 2026-11-24 16:23 UTC · original
milk4sale:test/wine-runtime-tests → main · +153 −29 · 8 files · 4 commits · open

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

**@⁠milk4sale** on GitHub · 2026-11-24 16:23 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/983) `milk4sale:test/wine-runtime-tests` → `main` · +153 −29 · 8 files · 4 commits · open Claimed in the coordination issue as: TEST-WINE-RUNTIME-TESTS ([claim](https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14)) ### 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://git.gtahub.st/github/ubiquitarianism--leonida/issues/14)), `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)
Under Wine these tests failed on what Wine's own libraries do, not on the
shim or the loader they are there to check:

- bcrypt_rng, bcrypt_rng_seeded: the shim hands back the host's status for
  an algorithm it does not serve, and Wine's bcrypt answers 0xC0000002 for
  an unknown name where Microsoft's answers STATUS_NOT_FOUND. The test now
  compares the shim with the host, asked directly, and checks the value
  itself wherever the host is not Wine.
- gameinput_host: Wine's GameInput.dll loads and its GameInputCreate
  answers E_NOTIMPL. The import binding is still checked; the calls into
  the library are skipped there.
- root_sig: Wine's deserializer refuses a container whose checksum is
  zeroed. The host is asked about the cleared copy directly, and Wine's
  refusal, and only Wine's, skips that one check.
- run_startup_cmdline: the native control cannot hold through an emulator,
  because Wine's ucrtbase has __argc, __argv and __wargv set before process
  attach. It is reported and not required when a RUNNER is set; the run
  through gta6rt is checked on every host.
- dstorage: the guard page is the middle one of three, so it cannot start
  at the reading thread's StackBase, where Wine drops the guard without
  raising anything. No host check.
- xmem: Wine raises no fault on the first write to a SEC_RESERVE view and
  keeps reporting MEM_RESERVE, so xmem's first-touch handler never runs.
  There the page is committed with rt::xmem::commit_physical_range and the
  bytes written before must still be there.

host_wine.h gets is_wine(), the host check with nothing printed.
docs/linux.md lists the measured differences and docs/testing.md points
to it. Tests and docs only.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
main 4a50cafc7 added a check to root_sig_test that the versioned deserializer shim accepts an all-zero-checksum Xbox
blob, next to the legacy check this branch had put behind a question to the host. Both stay. The versioned shim
forwards the same cleared copy to the host's versioned deserializer, and Wine's (wine-staging 11.21) refuses a zero
checksum there too, so the host's versioned deserializer is asked about the cleared copy directly and Wine's refusal,
and only Wine's, skips that check. Off Wine the check runs as #758 wrote it.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Brings the branch up to date with main 68d1331e5. No conflicts; the merged tree was tested before the push (every standalone
test file under tests/ passes except tests/test_ci_registration.py, which fails on main alone since #930).

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Main's 2deadb076 already makes xmem_test's mapped-view checks hold under Wine by skipping
the reported state and protection. Keep that version and describe it in docs/linux.md.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:31:47 +00:00
Author
Owner

@⁠milk4sale on GitHub · 2026-11-24 20:18 UTC · original

The red windows and linux-gpu-tools jobs come from main as it was when this run was created, not from this change. Their checkout step says Merge 81677234b into 98a977b4b, and 98a977b4b is older than two fixes:

  • windows: linking gta6rt.exe fails with __imp_WaitOnAddress, __imp_WakeByAddressSingle and __imp_WakeByAddressAll unresolved in leonida_xma2_decoder.lib. #877 (merged 16:58 UTC) adds synchronization to that library's link libraries.
  • linux-gpu-tools: cs_imgload_tfe and cs_imgload_d16_tfe fail (r32 sint (sint view): 64 bad, texel(5,3) = 2071). #892 (merged 17:15 UTC) corrected those two fixtures' expected TFE status.

This pull request touches none of the files #877 and #892 change, and it merges into current main (58be9cdf8) without conflict. Re-running the failed jobs would test the same old merge, so I'm not pushing just to restart CI. I haven't found a finished run of these jobs on a main that has both fixes yet.

AI-assisted.

**@⁠milk4sale** on GitHub · 2026-11-24 20:18 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/983#issuecomment-7143345550) The red `windows` and `linux-gpu-tools` jobs come from `main` as it was when this run was created, not from this change. Their checkout step says `Merge 81677234b into 98a977b4b`, and `98a977b4b` is older than two fixes: - `windows`: linking `gta6rt.exe` fails with `__imp_WaitOnAddress`, `__imp_WakeByAddressSingle` and `__imp_WakeByAddressAll` unresolved in `leonida_xma2_decoder.lib`. #877 (merged 16:58 UTC) adds `synchronization` to that library's link libraries. - `linux-gpu-tools`: `cs_imgload_tfe` and `cs_imgload_d16_tfe` fail (`r32 sint (sint view): 64 bad, texel(5,3) = 2071`). #892 (merged 17:15 UTC) corrected those two fixtures' expected TFE status. This pull request touches none of the files #877 and #892 change, and it merges into current `main` (`58be9cdf8`) without conflict. Re-running the failed jobs would test the same old merge, so I'm not pushing just to restart CI. I haven't found a finished run of these jobs on a `main` that has both fixes yet. AI-assisted.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/983/head:github-bot/gh-983'
git switch 'github-bot/gh-983'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-983'
git switch 'github-bot/gh-983'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-983'
git switch 'github-bot/gh-983'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-983'
git switch 'main'
git merge --squash 'github-bot/gh-983'
git switch 'main'
git merge --ff-only 'github-bot/gh-983'
git switch 'main'
git merge 'github-bot/gh-983'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.