tests: check the startup argv snapshot on Wine (TEST-CRT-ARGV-WINE) #1098

Closed
github-bot wants to merge 1 commit from gh-pr/1098/head into gh-pr/1098/base
Owner

@⁠Moriz82 on GitHub · 2026-11-24 18:21 UTC · original
split/test-crt-argv-wine → main · +19 −3 · 1 files · 1 commits · closed without merging

Claimed in the coordination issue as: TEST-CRT-ARGV-WINE (claim).

Part of the split of #984 into small pull requests.

Depends on: none
Overlaps: #984 (integration source). No separate open or merged change to this fixture was found.

What and why

The direct reference executable fails before the loader runs. Wine's UCRT can populate both argument vectors before the process-attach callback. The fixture now accepts that state on Wine only when the count, argument widths and each argument match at entry. Both command-line strings still have to match. Native Windows keeps the existing checks for an unconfigured UCRT at attach.

Tested

Cross-built the runtime, fixture DLL and fixture executable with clang-cl 23 and the xwin SDK. The same Proton Experimental prefix and Microsoft Visual C++ 2022 redistributable were used for the red and green runs. The loader used the redistributable's C++ DLLs from its application directory; the fixture still used Proton's UCRT.

export WINEPATH="$VC_RUNTIME_DIR"   # Windows path to the x64 redistributable DLLs
export WINEDLLOVERRIDES="msvcp140,msvcp140_1,msvcp140_2,msvcp140_atomic_wait,msvcp140_codecvt_ids,vcruntime140,vcruntime140_1=n,b"
cmake --build runtime/build/boot --target gta6rt tiny_startup_cmdline tiny_startup_cmdline_dll -j6
ctest --test-dir runtime/build/boot -j1 -R '^run_startup_cmdline$' --output-on-failure
python3 -I scripts/check_no_game_data.py runtime/test/fixtures/tiny_startup_cmdline.cpp
git diff --check
  • Base 94daa515f passed 0/1 tests. The direct executable returned 1 in the argument case and printed tiny_startup_cmdline: FAIL.
  • Child passed 1/1 tests. Five process invocations cover direct and loaded execution with arguments, both without arguments, and a rejected DLL attach. The negative control checks the error message, import report, exit code and that the entry point was never called.
  • Under stock Proton the four positive invocations passed with the change. The failed-attach control received the generic C++ exception message Unknown exception. Using the application-local Microsoft C++ runtime preserves the original diagnostic. The negative assertion was retained.
  • Tested on CachyOS, Linux 7.3, Ryzen 5 5600X and 16 GB RAM. Native Windows, AMD GPU and Intel GPU runs were not performed.

GPUs tested: none. This is a CPU fixture.
AI-assisted: yes

Checklist

  • Based on current upstream main at the cut. Merge check passed against the subsequently fetched main.
  • One test fixture and one topic.
  • Content guard and whitespace check passed.
  • No translator rule changed.

🤖 Generated with Claude Code

**@⁠Moriz82** on GitHub · 2026-11-24 18:21 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1098) `split/test-crt-argv-wine` → `main` · +19 −3 · 1 files · 1 commits · closed without merging Claimed in the coordination issue as: TEST-CRT-ARGV-WINE ([claim](https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14)). Part of the split of #984 into small pull requests. Depends on: none Overlaps: #984 (integration source). No separate open or merged change to this fixture was found. ### What and why The direct reference executable fails before the loader runs. Wine's UCRT can populate both argument vectors before the process-attach callback. The fixture now accepts that state on Wine only when the count, argument widths and each argument match at entry. Both command-line strings still have to match. Native Windows keeps the existing checks for an unconfigured UCRT at attach. ### Tested Cross-built the runtime, fixture DLL and fixture executable with clang-cl 23 and the xwin SDK. The same Proton Experimental prefix and Microsoft Visual C++ 2022 redistributable were used for the red and green runs. The loader used the redistributable's C++ DLLs from its application directory; the fixture still used Proton's UCRT. ```sh export WINEPATH="$VC_RUNTIME_DIR" # Windows path to the x64 redistributable DLLs export WINEDLLOVERRIDES="msvcp140,msvcp140_1,msvcp140_2,msvcp140_atomic_wait,msvcp140_codecvt_ids,vcruntime140,vcruntime140_1=n,b" cmake --build runtime/build/boot --target gta6rt tiny_startup_cmdline tiny_startup_cmdline_dll -j6 ctest --test-dir runtime/build/boot -j1 -R '^run_startup_cmdline$' --output-on-failure python3 -I scripts/check_no_game_data.py runtime/test/fixtures/tiny_startup_cmdline.cpp git diff --check ``` - Base `94daa515f` passed 0/1 tests. The direct executable returned 1 in the argument case and printed `tiny_startup_cmdline: FAIL`. - Child passed 1/1 tests. Five process invocations cover direct and loaded execution with arguments, both without arguments, and a rejected DLL attach. The negative control checks the error message, import report, exit code and that the entry point was never called. - Under stock Proton the four positive invocations passed with the change. The failed-attach control received the generic C++ exception message `Unknown exception`. Using the application-local Microsoft C++ runtime preserves the original diagnostic. The negative assertion was retained. - Tested on CachyOS, Linux 7.3, Ryzen 5 5600X and 16 GB RAM. Native Windows, AMD GPU and Intel GPU runs were not performed. GPUs tested: none. This is a CPU fixture. AI-assisted: yes ### Checklist - [x] Based on current upstream main at the cut. Merge check passed against the subsequently fetched main. - [x] One test fixture and one topic. - [x] Content guard and whitespace check passed. - [x] No translator rule changed. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The startup fixture fails on Wine before the loader gets to run. Its UCRT
can populate both argv widths during process attach.

On Wine, accept an early argv only if its count, widths and every argument
match the entry snapshot. Keep the native UCRT checks.

Built gta6rt and both fixture targets. The focused Proton CTest failed on
the base and passed all five process invocations with this change.


AI-assisted (Codex and Claude Code agents).

Co-authored-by: Plaaasma <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:38:03 +00:00
github-bot closed this pull request 2026-11-26 09:38:03 +00:00
Author
Owner

@⁠abnalstlll-byte on GitHub · 2026-11-24 18:42 UTC · original · approved these changes

Audited and verified. Adapts
untime/test/fixtures/tiny_startup_cmdline.cpp to account for Wine's early UCRT argv initialization during TLS attach when wine_get_version is present, while strictly maintaining native Windows timing assertions. Clean-room compliant. Approved.

**@⁠abnalstlll-byte** on GitHub · 2026-11-24 18:42 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1098#pullrequestreview-6045239750) · **approved these changes** Audited and verified. Adapts untime/test/fixtures/tiny_startup_cmdline.cpp to account for Wine's early UCRT argv initialization during TLS attach when wine_get_version is present, while strictly maintaining native Windows timing assertions. Clean-room compliant. Approved.
Author
Owner

@⁠abnalstlll-byte on GitHub · 2026-11-24 18:54 UTC · original · approved these changes

Clean-Room Audit — PR #1098 (TEST-CRT-ARGV-WINE)

Clean adjustment in tiny_startup_cmdline.cpp using ntdll!wine_get_version to accept Wine UCRT's early __argv/__wargv initialization while retaining strict native Windows uninitialized checks. 0 game data.

Verdict: APPROVED

**@⁠abnalstlll-byte** on GitHub · 2026-11-24 18:54 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1098#pullrequestreview-6045400647) · **approved these changes** ### Clean-Room Audit — PR #1098 (`TEST-CRT-ARGV-WINE`) Clean adjustment in `tiny_startup_cmdline.cpp` using `ntdll!wine_get_version` to accept Wine UCRT's early `__argv`/`__wargv` initialization while retaining strict native Windows uninitialized checks. 0 game data. **Verdict: APPROVED**
Author
Owner

@⁠madhyn on GitHub · 2026-11-24 19:20 UTC · original

Verified 8bfdb6662 on Arch Linux + Wine 11.22 (clang-cl + xwin cross-build):

  • ctest --test-dir runtime/build/win -R "^run_startup_cmdline$" --output-on-failure: Passed (26.88 s)

AI-assisted: yes

**@⁠madhyn** on GitHub · 2026-11-24 19:20 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1098#issuecomment-7141963269) Verified `8bfdb6662` on Arch Linux + Wine 11.22 (clang-cl + xwin cross-build): - `ctest --test-dir runtime/build/win -R "^run_startup_cmdline$" --output-on-failure`: **Passed** (26.88 s) AI-assisted: yes
Author
Owner

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

Recommendation: [MERGE]

Reasoning: Test-fixture-only change: tiny_startup_cmdline accepts Wine UCRT pre-populating argv before process attach, only when every argument matches, and still requires both command-line strings to match. No runtime code changes. Verified on Arch + Wine 11.22 by madhyn. CI (label, change-scope, no-game-data and the Runtime jobs) is still queued awaiting maintainer workflow approval, so nothing has run in CI yet; GitHub reports no merge conflict with main. Merge once the queued checks are green.

Impact level: 2/10

**@⁠Deedlyy** on GitHub · 2026-11-24 20:18 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1098#issuecomment-7143333374) **Recommendation:** [MERGE] **Reasoning:** Test-fixture-only change: `tiny_startup_cmdline` accepts Wine UCRT pre-populating argv before process attach, only when every argument matches, and still requires both command-line strings to match. No runtime code changes. Verified on Arch + Wine 11.22 by madhyn. CI (label, change-scope, no-game-data and the Runtime jobs) is still queued awaiting maintainer workflow approval, so nothing has run in CI yet; GitHub reports no merge conflict with `main`. Merge once the queued checks are green. **Impact level:** 2/10
Author
Owner

@⁠Moriz82 on GitHub · 2026-11-25 03:41 UTC · original · edited 2026-11-25 03:58 UTC

The Wine argv fixture on current main is byte-for-byte identical to this PR. It came in through #984, so rebasing the branch produces an empty diff. The independent Wine run above still documents the fixture behavior.

The check alert on 8bfdb66 reflects workflow state. Runtime, No Game Data, and CI awaited maintainer approval and ran no jobs. The label job was cancelled before a runner picked it up. I rechecked 5129be10; merging this split yields exactly the current main tree.

AI-assisted.

**@⁠Moriz82** on GitHub · 2026-11-25 03:41 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1098#issuecomment-7152147264) · edited 2026-11-25 03:58 UTC The Wine argv fixture on current main is byte-for-byte identical to this PR. It came in through #984, so rebasing the branch produces an empty diff. The independent Wine run above still documents the fixture behavior. The check alert on `8bfdb66` reflects workflow state. Runtime, No Game Data, and CI awaited maintainer approval and ran no jobs. The label job was cancelled before a runner picked it up. I rechecked `5129be10`; merging this split yields exactly the current main tree. AI-assisted.
Author
Owner

@⁠aslan2142 on GitHub · 2026-11-25 19:10 UTC · original

Closing, as you noted above: the Wine argv fixture on main is byte-for-byte this change. It came in through #984, and merging this into main (490f5b9ec) leaves every file as it is. The Wine run in this thread still documents the fixture's behaviour. Thanks!

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

**@⁠aslan2142** on GitHub · 2026-11-25 19:10 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1098#issuecomment-7171910131) Closing, as you noted above: the Wine argv fixture on `main` is byte-for-byte this change. It came in through #984, and merging this into `main` (`490f5b9ec`) leaves every file as it is. The Wine run in this thread still documents the fixture's behaviour. Thanks! AI-assisted (Claude Code, Claude Opus 5.5).

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.