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

Closed
Moriz82 wants to merge 1 commit from upstream-pr/1098 into main
Moriz82 commented 2026-11-24 18:21:40 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Moriz82 on 2026-11-24T18:21:40Z.


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

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5477904385 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1098). Originally posted by [Moriz82](https://github.com/Moriz82) on 2026-11-24T18:21:40Z. --- Claimed in the coordination issue as: TEST-CRT-ARGV-WINE ([claim](https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7140533204)). 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)
abnalstlll-byte commented 2026-11-24 18:42:40 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-24T18:42:40Z.

Review: APPROVED


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6045239750 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1098#pullrequestreview-6045239750). Originally posted by [abnalstlll-byte](https://github.com/abnalstlll-byte) on 2026-11-24T18:42:40Z. **Review:** APPROVED --- 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 commented 2026-11-24 18:54:08 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-24T18:54:08Z.

Review: APPROVED


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

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6045400647 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1098#pullrequestreview-6045400647). Originally posted by [abnalstlll-byte](https://github.com/abnalstlll-byte) on 2026-11-24T18:54:08Z. **Review:** APPROVED --- ### 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**
madhyn commented 2026-11-24 19:20:51 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by madhyn on 2026-11-24T19:20:51Z.


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

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7141963269 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1098#issuecomment-7141963269). Originally posted by [madhyn](https://github.com/madhyn) on 2026-11-24T19:20:51Z. --- 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
Deedlyy commented 2026-11-24 20:18:11 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Deedlyy on 2026-11-24T20:18:11Z.


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

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7143333374 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1098#issuecomment-7143333374). Originally posted by [Deedlyy](https://github.com/Deedlyy) on 2026-11-24T20:18:11Z. --- **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
Moriz82 commented 2026-11-25 03:41:07 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Moriz82 on 2026-11-25T03:41:07Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7152147264 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1098#issuecomment-7152147264). Originally posted by [Moriz82](https://github.com/Moriz82) on 2026-11-25T03:41:07Z. --- 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.
aslan2142 commented 2026-11-25 19:10:06 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-11-25T19:10:06Z.


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

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7171910131 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1098#issuecomment-7171910131). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-11-25T19:10:06Z. --- 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

Sign in to join this conversation.
No reviewers
No labels
No milestone
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.

Reference
ProjectLeonida/mandy!1098
No description provided.