Skip to content

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

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

Maraco91 wants to merge 4 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 it, so until that merges the diff here shows its commit too. The change of this PR is 11 test files, +55/−17 against main (3faac557).

Updated 2026-11-23: main was merged in at ffaa9721 to resolve a conflict in tests/test_meta_to_xml_paths.py, and ac48ad75 covers the four launches main gained in the meantime. The earlier reviews were of e034f95d.

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, 17 launches in all: tests/test_build_batch_launch.py, test_build_llvm_mc_batch.py, test_build_runtime_batch.py, test_carve_all_brackets.py, test_carve_all_paths.py (6 launches), test_first_look_exit.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 no longer changed here: main gave it its own full path in b2d00d240, and the merge keeps main's copy. After this PR no test under tests/ starts PowerShell by the bare name.

Tested

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

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

result
this branch, the 11 files plus test_meta_to_xml_paths.py and test_make_game_platform.py all 13 pass
the three files of ac48ad75 taken from main (test_carve_all_paths.py, test_build_batch_launch.py, test_first_look_rebuild.py) all three fail with FileNotFoundError (7, 3 and 2 errors)

test_build_llvm_mc_batch.py failed for another reason (TEST-668) when this PR was opened; on current main it passes here.

  • python -m compileall -q make_game.py tools tests: OK. git diff --check against main: clean.
  • Linux (WSL Ubuntu, Python 3.12.3), at ac48ad75: the 11 files and test_meta_to_xml_paths.py import and 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

Maraco91 and others added 2 commits November 22, 2026 23:32
…stage

The runtime stage ran scripts/build_runtime.ps1 through the bare name
"powershell". CreateProcess searches System32 but not
System32\WindowsPowerShell\v1.0, so on a PC whose PATH no longer lists
that folder the stage ended in a FileNotFoundError traceback, after the
shader and asset stages had already run.

windows_powershell() returns the file under %SystemRoot%, and the bare
name where the file is not at its usual place.

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

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.

4 participants