Skip to content

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

Open
milk4sale wants to merge 4 commits into
ProjectLeonida:mainfrom
milk4sale:test/wine-runtime-tests
Open

milk4sale wants to merge 4 commits into
ProjectLeonida:mainfrom
milk4sale:test/wine-runtime-tests

Conversation

@milk4sale

@milk4sale milk4sale commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

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 cf4c00c: 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 98a977b, 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 1504c1a: 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 Tests: eight host-comparison tests skip Wine's host and still check the layer (TEST-WINE-HOST-GUARDS) #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 4a50caf into the branch (e8ea3fa0c; it conflicted with d3d12_xs: export D3D12CreateVersionedRootSignatureDeserializer, clearing the Xbox RTS0 flags (OLD-10012) #758 in root_sig_test.cpp): rebuilt, and the seven tests pass under Wine. d3d12_xs: export D3D12CreateVersionedRootSignatureDeserializer, clearing the Xbox RTS0 flags (OLD-10012) #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 d3d12_xs: export D3D12CreateVersionedRootSignatureDeserializer, clearing the Xbox RTS0 flags (OLD-10012) #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

… check the shim (TEST-WINE-RUNTIME-TESTS)

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 <noreply@anthropic.com>
@milk4sale

Copy link
Copy Markdown
Contributor Author

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:

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 and others added 2 commits November 24, 2026 15:34
…rsioned zero-checksum check, asked of Wine's host the same way

main 4a50caf 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 ProjectLeonida#758 wrote it.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Brings the branch up to date with main 68d1331. 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 ProjectLeonida#930).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@github-actions github-actions Bot added the needs rebase Conflicts with the base branch: rebase it on main label Nov 25, 2026
… in xmem_test

Main's 2deadb0 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.
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.

1 participant