Skip to content

tests: start Windows PowerShell by its full path (TEST-869) - #3965

Open
Maraco91 wants to merge 5 commits into
ItsNotRexed:mainfrom
Maraco91:test/powershell-full-path
Open

Maraco91 wants to merge 5 commits into
ItsNotRexed:mainfrom
Maraco91:test/powershell-full-path

Conversation

@Maraco91

@Maraco91 Maraco91 commented Nov 22, 2026 •

Copy link
Copy Markdown

Claimed in the coordination issue as: TEST-869 (claim in #3918).

Depends on: #3930 (BUILD-1118). This branch is stacked on its first commit, so until that merges the diff here shows it too. The change of this PR is 15 test files, +71/−23 against main (f875cda2).

Updated 2026-11-23 (second time): main keeps gaining tests that start PowerShell by the bare name, so this branch has now merged it twice. 9ab0337f resolves a conflict in tests/test_first_look_rebuild.py, and 2d8e3722 covers the six launches added since the last update. Earlier reviews were of e034f95d and ac48ad75.

What and why

Windows-only test files start a bare "powershell.exe". CreateProcess searches System32 but not System32\WindowsPowerShell\v1.0, so on a PC whose PATH no longer lists that folder every one of them ends in FileNotFoundError at subprocess.run and tests nothing.

Each launch now starts the file make_game.windows_powershell() returns (added by #3930), the same one the runtime stage starts. Per file that is sys.path.insert(0, <repository root>), from make_game import windows_powershell, and the one token; import sys where the file didn't have it. Nothing else in the tests changes.

Files, 23 launches in all: tests/test_build_batch_launch.py, test_build_llvm_mc_batch.py, test_build_llvm_mc_cleanup.py, test_build_runtime_batch.py, test_build_runtime_cmake.py, test_build_runtime_fallback.py, test_carve_all_brackets.py, test_carve_all_paths.py (8 launches), test_first_look_exit.py, test_first_look_paths.py, test_first_look_rebuild.py, test_first_look_shim_report.py, test_llvm_install_destination.py, test_llvm_install_path.py (2), test_llvm_source_version.py.

tests/test_meta_to_xml_paths.py is not changed here: main gave it its own full path in b2d00d240. At f875cda2 no test under tests/ starts PowerShell by the bare name after this PR.

Tested

Windows 11 26200, Python 3.12.6, at 2d8e3722. No game files; no GPU is involved.

With System32\WindowsPowerShell\v1.0 removed from PATH:

result
this branch: the 15 files plus test_meta_to_xml_paths.py and test_make_game_platform.py 14 pass; 3 fail past the launch, the same way they fail on main (below)
the five files of 2d8e3722 taken from main (test_carve_all_paths.py, test_build_llvm_mc_cleanup.py, test_build_runtime_cmake.py, test_build_runtime_fallback.py, test_first_look_paths.py) all five fail with FileNotFoundError at the launch

The three that fail are not this PR's: on main (6664b0db; the files involved are unchanged up to f875cda2) with the PowerShell folder on PATH they fail on this PC with the same messages.

  • test_build_batch_launch.py: build_runtime.ps1: expected one $p = Start-Process cmd.exe -ArgumentList ... line, found 0.
  • test_first_look_shim_report.py: the copied tools/gdk_runtime_calls.py stops at from report_paths import same_report_path.
  • test_first_look_paths.py: reports\exe\fixture[1]\checklist.md is not written.

Before, on a PATH like mine, these three stopped at the launch and never showed those failures.

  • python -m compileall -q make_game.py tools tests: OK. git diff --check: clean.
  • Linux (WSL Ubuntu, Python 3.12.3), at 2d8e3722: the 15 files import, and their Windows-only tests skip as before (OK (skipped=N) for each), so the new import works where the tests don't run.

Checklist

  • 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. (Not applicable.)

AI-assisted (Claude Code).

🤖 Generated with Claude Code

Ten Windows-only test files started a bare "powershell.exe", 14 launches in
all. CreateProcess does not search System32\WindowsPowerShell\v1.0, so on a
PC whose PATH no longer lists that folder every one of them ended in a
FileNotFoundError at subprocess.run and tested nothing.

They now start the file make_game.windows_powershell() returns, the one the
runtime stage starts.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@evilclanker9000

Copy link
Copy Markdown
Contributor

Independent Windows Python check of e034f95. With PATH empty, launching the old bare powershell command raised FileNotFoundError, while the new helper's full path launched Windows PowerShell and printed the expected marker. With its usual directory on PATH, both commands printed the same marker. The two focused tests passed, covering the runtime arguments via a mocked runner and the bare-name fallback when the standard executable is absent. No build script ran.

AI-assisted.

@tupacfan04

Copy link
Copy Markdown
Contributor

PASS as a test-only follow-up (the author's comment does not change the result). 20/20 across the 10 changed test files, compileall clean, and it merges cleanly; with System32\WindowsPowerShell\v1.0 removed from PATH, the base files give 4 FileNotFoundErrors and the PR passes.

Minor: tests/test_first_look_exit.py:15 and tests/test_meta_to_xml_paths.py:14 resolve windows_powershell() at import time, before the skip decorators - harmless, just an unnecessary filesystem probe.

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

Maraco91 and others added 2 commits November 23, 2026 12:01
tests/test_meta_to_xml_paths.py: main's copy is kept. It already starts
Windows PowerShell by its full path (b2d00d2), so this branch no longer
changes that file.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
main gained four launches by the bare name after this branch was opened:
two in tests/test_carve_all_paths.py and one each in the new
tests/test_build_batch_launch.py and tests/test_first_look_rebuild.py.
They start windows_powershell() like the others.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@Maraco91

Copy link
Copy Markdown
Author

Updated to ac48ad75; the earlier checks here were of e034f95d.

  • ffaa9721 merges main (3faac557). The one conflict was tests/test_meta_to_xml_paths.py: main gave that file its own full path in b2d00d240, so the merge keeps main's copy and this PR no longer changes it.
  • ac48ad75 covers the four launches by the bare name that main gained since: two in tests/test_carve_all_paths.py, one each in the new tests/test_build_batch_launch.py and tests/test_first_look_rebuild.py. Same one-token change as the rest.

Tested on Windows 11 26200, Python 3.12.6, with System32\WindowsPowerShell\v1.0 removed from PATH: the 11 files of this PR, test_meta_to_xml_paths.py and test_make_game_platform.py all pass. Negative control: with main's copies of the three files of ac48ad75, each fails with FileNotFoundError (7, 3 and 2 errors). On Linux (WSL, Python 3.12.3) the files import and skip as before. compileall and git diff --check are clean.

The description is updated to match. AI-assisted (Claude Code); no game files, no GPU.

@sovljanskii

Copy link
Copy Markdown
Contributor

Re-review of ac48ad75 merged onto main 3faac557 (clean): pass. Tested on macOS (Apple M4), Python 3.15.2 and 3.12.16, CPU only.

Delta since e034f95d, the head the earlier checks covered

  • I compared the PR's net diff against main now with its net diff at e034f95d.
    • make_game.py (windows_powershell and the runtime stage) and test_make_game_platform.py are identical.
    • The only additions are the four launches ac48ad75 converts: two in test_carve_all_paths.py, one in test_build_batch_launch.py and one in test_first_look_rebuild.py.
    • test_meta_to_xml_paths.py is no longer touched, since main already starts that one by its full path.
  • Coverage count: main has 17 bare "powershell"/"powershell.exe" launches in 11 tests/*.py files. The PR head has 0, and the 11 files are exactly the ones this PR changes.
  • Imports: both new imports insert ROOT on sys.path before from make_game import windows_powershell. Both files already import sys.

Ran

  • The 13 touched or related test files on both Python versions: 67 tests OK, 26 skipped. The skipped ones are the Windows-only skipUnless(os.name == "nt") cases. main gives 65 OK with the same 26 skipped; the 2 extra are the new test_make_game_platform tests.
    • The module-level make_game import is harmless off Windows.
  • Mutations of windows_powershell: the two platform tests mock os.name and run on macOS, so they can be checked here. Each mutation is caught by one failure:
    • always returning "powershell";
    • dropping the isfile fallback;
    • ignoring SystemRoot.
  • I can't re-run the ac48ad75 negative control off Windows, because those tests skip. The author's Windows run covers it.
  • compileall and git diff --check are clean.

Note (outside this PR's scope, not blocking): tools/pc_checker.py:480 still starts "powershell" by name for the Get-CimInstance Win32_VideoController query. _run (:402-411) swallows the FileNotFoundError and returns "". So on a PC whose PATH lost System32\WindowsPowerShell\v1.0, the checker silently drops the GPUs it would find that way (the non-NVIDIA ones) instead of failing. No open PR touches that line. It could reuse the same full-path lookup in a follow-up.

AI-assisted.

Maraco91 and others added 2 commits November 23, 2026 18:11
tests/test_first_look_rebuild.py: main's new lines are kept, with the
launch by the full path.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Since the last merge main gained six launches by the bare name: two more
in tests/test_carve_all_paths.py and one each in the new
tests/test_build_llvm_mc_cleanup.py, test_build_runtime_cmake.py,
test_build_runtime_fallback.py and test_first_look_paths.py.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@Maraco91

Copy link
Copy Markdown
Author

Updated to 2d8e3722; the last checks here were of ac48ad75.

  • 9ab0337f merges main (f875cda2). The one conflict was tests/test_first_look_rebuild.py, where main added lines next to the launch; they are kept, with the launch by the full path.
  • 2d8e3722 covers six launches by the bare name that main gained since the last update: two more in tests/test_carve_all_paths.py, one each in the new test_build_llvm_mc_cleanup.py, test_build_runtime_cmake.py, test_build_runtime_fallback.py and test_first_look_paths.py. The PR is now 15 files and 23 launches, the same one-token change in each.

Tested on Windows 11 26200, Python 3.12.6, with System32\WindowsPowerShell\v1.0 removed from PATH. Negative control: main's copies of the five files of 2d8e3722 all fail with FileNotFoundError at the launch. On this branch 14 of the 17 files I ran pass. Three fail past the launch, and they fail the same way on main with the PowerShell folder on PATH, so they are not this PR's:

  • test_build_batch_launch.py: build_runtime.ps1: expected one $p = Start-Process cmd.exe -ArgumentList ... line, found 0
  • test_first_look_shim_report.py: the copied tools/gdk_runtime_calls.py stops at from report_paths import same_report_path
  • test_first_look_paths.py: reports\exe\fixture[1]\checklist.md is not written

On Linux (WSL, Python 3.12.3) the 15 files import and skip as before. compileall and git diff --check are clean. The description is updated.

On the review note about tools/pc_checker.py:480 (thanks, sovljanskii): it is outside this PR, as the note says, and I have not touched it here.

AI-assisted (Claude Code); no game files, no GPU.

@YordiLorenzo

Copy link
Copy Markdown

Tested 2d8e372 on Linux, Python 3.12.16: pass

  • the 15 changed test files with python -I: all OK on the head and on the head merged with main dde82f2. 34 of 41 tests skip on Linux as they should, so the launches still need a Windows run
  • compileall on tests: clean
  • grep of tests/ on the merge: no launch by the bare powershell or powershell.exe name is left

@AryamanKalia AryamanKalia left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

CPU review of head 2d8e372229ace81da61a01dcd3f0782084556254 (TEST-869).

I reviewed all 23 replaced launches and their imports, including the dependency on windows_powershell() from #3930. A search of tests/*.py at this head found no remaining bare PowerShell launch. No blocking issue found in these substitutions. The change remains dependent on #3930.

Windows, Python 3.12.13: ran all 15 changed test files with the Windows PowerShell directory removed from PATH. Twelve files passed. Three failed after reaching PowerShell, consistent with failures noted in the PR description: test_build_batch_launch.py (script pattern mismatch), test_first_look_shim_report.py (missing report_paths in the temporary checkout), and test_first_look_paths.py (missing report_paths; its temporary stand-in executable was also blocked by McAfee). I did not independently complete a base comparison: I stopped it after the antivirus alert. These failures limit the validation; this is not a full green suite or GPU test.

No game files used. AI-assisted (Codex).

@isfcrctfs isfcrctfs left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Read 2d8e3722 on Linux (CPython 3.12.16): the test-only change is correct.

All 15 changed files run cleanly with python3.12 -I tests/<file> on this head — 34 tests skip as designed off Windows and the rest pass. import make_game is side-effect-free here (0.12 s, no output), so the module-level windows_powershell() calls do not change collection on non-Windows, and the helper's two behaviours are already pinned by tests/test_make_game_platform.py (the System32\WindowsPowerShell\v1.0 path, and the bare-name fallback when it is absent).

No defect found. Not run: the Windows launches themselves.

One leftover of the same class, outside this PR's scope: tools/pc_checker.py:480 still starts bare powershell for the VRAM lookup; _run swallows the failure, so a PATH without System32\WindowsPowerShell\v1.0 loses VRAM data rather than erroring. Worth a follow-up ticket if TEST-869 is about PATH loss generally.

AI-assisted.

@rideinstead

Copy link
Copy Markdown

✅ Automated security review: CLEAN (commit 2d8e3722)

  • No findings.

Scope: static analysis of added diff lines only; no code was executed. Please review findings manually.

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.

8 participants