Skip to content

Apply CTest environment modifications under Wine - #4378

Open
AGInformatique81 wants to merge 2 commits into
ItsNotRexed:mainfrom
AGInformatique81:fix/wine-ctest-environment
Open

AGInformatique81 wants to merge 2 commits into
ItsNotRexed:mainfrom
AGInformatique81:fix/wine-ctest-environment

Conversation

@AGInformatique81

Copy link
Copy Markdown

Change

Apply CTest's ENVIRONMENT_MODIFICATION entries in order, after ENVIRONMENT, in the child process only. Support reset, set, unset and ordered string/path/CMake-list edits. A malformed entry fails the affected test before it starts.

Coordination claim: #4257 (comment)

Testing

  • Linux (WSL, Python 3.14.7): 52 tests passed in python3 -I tests/test_run_wine_tests.py.
  • Windows (Python 3.15.2): 47 passed and 5 POSIX-only tests skipped. The new test reproduced the missing edits on main.
  • Checked the list-valued JSON emitted by CTest 4.5.1 and the separator behavior with a synthetic CTest project.
  • Simulated a merge with Clean up incomplete Wine drive mappings #4359. Both changes merge cleanly and all 54 Wine runner tests passed under WSL.

Synthetic tests only. No Wine installation, GPU, driver or game data. AI-assisted with Codex.

@Kam471 Kam471 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.

Ran this at 3c349e21 on Windows 11: python -I tests/test_run_wine_tests.py -> 52 tests, OK (5 skipped); git diff --check clean.

CTest environment modifications are now applied under Wine as well, and the existing runner tests pass. No blocking issue.

@SphyserX

SphyserX commented Nov 23, 2026 •

Copy link
Copy Markdown

Tested 3c349e2 on Arch Linux (in a VM), CPython 3.14: python -I tests/test_run_wine_tests.py passes.

Code read against CMake 4.5.1's Help/include/ENVIRONMENT_MODIFICATION_OPS.rst: reset returning to the ENVIRONMENT value, the ordering, the child-only scope and failing on an unknown OP all match the docs. One point on path_list_*:

  • The docs define it with "the host platform's path list separator (; on Windows and : elsewhere)". Here the inventory comes from the Windows build (ctest --show-only=json-v1 on windows-latest), and the child is a Windows program running under Wine. Using os.pathsep therefore gives : on the Linux runner, where CTest on the Windows runner would give ; for the same test. Checked under Wine 11: a variable is passed through as is (LX=a:b reads a:b in cmd), so a path_list_append reaches the program with a different separator than it gets on Windows. (PATH is a separate case: the program sees the prefix's Windows PATH, not the runner's; a Unix PATH=/usr/bin:/bin:/tmp read back as C:\windows\system32;C:\windows;....) I'd use ";" for path_list here (and change the test's expectation), or say in a comment why the Linux separator is wanted.

Nothing in runtime/CMakeLists.txt sets ENVIRONMENT_MODIFICATION today (the main Runtime artifact's ctest.json only carries ENVIRONMENT), so this doesn't change any current result.

@AGInformatique81

Copy link
Copy Markdown
Author

Thanks for checking what the Windows child receives. Addressed in 9beff02: path_list_* now uses ; to replay Windows CTest semantics on the Wine host.

I checked the same three synthetic drive-letter paths with CTest 4.5.1 on Windows and with cmd.exe under Wine 10.0 via the updated runner. Both produced C:/first;D:/middle;E:/last. The strengthened regression failed on the previous head under WSL and now passes. The full runner suite passed under WSL (52 tests); on Windows, 47 passed and 5 POSIX-only cases skipped.

AI-assisted with Codex.

@Flyander Flyander 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.

This replays CTest environment edits in order on the child copy, with reset based on the per-test ENVIRONMENT values. The path-list separator was corrected to Windows ; semantics for the Windows-built inventory running under Wine, and the regression checks it against Windows CTest behavior.

@SphyserX

Copy link
Copy Markdown

Retested 9beff02 on Arch Linux (in a VM), CPython 3.14: python -I tests/test_run_wine_tests.py passes, and path_list now joins with ;. LGTM.

@zzEmmazz zzEmmazz 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.

Independent recheck of current head 9beff02 (TEST-955): the separator correction matches a real Windows CTest inventory.

I generated a synthetic inventory with Windows CMake/CTest 4.1.1-msvc1 using ENVIRONMENT LX_PATH=middle and ordered path_list_prepend:first, path_list_append:last. Windows CTest executes it with first;middle;last. Feeding those exact JSON properties to the Linux helper at 3c349e21 gives first:middle:last; current 9beff025 gives first;middle;last, matching the oracle.

Runner suite: Linux under WSL/Python 3.13.3, 52/52 pass; Windows 11/Python 3.14.0, 52 tests OK with 5 POSIX skips. Integration with #4359 applies cleanly; with the separate TEST-962 ownership follow-up (#4446), all 57 tests pass on Linux and Windows has 57 OK with 10 POSIX skips. Ordering, reset-to-ENVIRONMENT, invalid-operation failure and child-local scope remain covered. No defect found in the environment-modification change at this head.

Synthetic inputs only; no Wine installation, GPU or game files. AI-assisted (Codex).

@tupacfan04

Copy link
Copy Markdown
Contributor

Approved. All nine documented ops (reset/set/unset/string/path_list/cmake_list prepend/append) are applied in order after ENVIRONMENT; reset restores the ENVIRONMENT value and then the host state (scripts/run_wine_tests.py:125-139), unset variables are removed, edits stay child-local, and malformed/non-list entries fail before launch. 52 tests (47 pass, 5 POSIX skips), compileall clean, and the negative control fails 6 subtests on main. Merge clean.

Minor: :127 hardcodes ; for path_list - correct for the Windows inventory/Wine child, though CMake documents the host separator; it is intentional per the commit, so a comment saying why would help.

Approve. AI-assisted review, no game files, no GPU.

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.

6 participants