Skip to content

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

Closed
Moriz82 wants to merge 1 commit into
ProjectLeonida:mainfrom
Moriz82:split/test-crt-argv-wine
Closed

Moriz82 wants to merge 1 commit into
ProjectLeonida:mainfrom
Moriz82:split/test-crt-argv-wine

Conversation

@Moriz82

@Moriz82 Moriz82 commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator

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

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 <47513553+Plaaasma@users.noreply.github.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

@abnalstlll-byte abnalstlll-byte left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 abnalstlll-byte left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

madhyn commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

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

Deedlyy commented Nov 24, 2026

Copy link
Copy Markdown

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

Moriz82 commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator Author

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

Copy link
Copy Markdown
Collaborator

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 aslan2142 closed this Nov 25, 2026
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.

5 participants