Skip to content

tests: update test_build_batch_launch for build_runtime.ps1 hidden launch - #7120

Open
limpan1212 wants to merge 1 commit into
ItsNotRexed:mainfrom
limpan1212:fix/test-build-batch-launch
Open

limpan1212 wants to merge 1 commit into
ItsNotRexed:mainfrom
limpan1212:fix/test-build-batch-launch

Conversation

@limpan1212

Copy link
Copy Markdown

Claim: #7049 (comment)

What changed and why

  • #1797 changed scripts/build_runtime.ps1 (lines 118-121) from Start-Process cmd.exe -ArgumentList ... -NoNewWindow -PassThru to Start-Process -FilePath cmd.exe -ArgumentList ... -PassThru -WindowStyle Hidden -RedirectStandardOutput ... -RedirectStandardError ... so the TUI board can capture output cleanly.
  • tests/test_build_batch_launch.py still required -NoNewWindow -PassThru without -FilePath, causing launch_arguments(build_runtime.ps1) to fail on Windows CI (found 0).
  • Updated LAUNCH in tests/test_build_batch_launch.py to match both build_runtime.ps1 and build_llvm_mc.ps1, exercised the -WindowStyle Hidden + redirected-log form for build_runtime.ps1 in start() / BatchLaunchTest, and added LaunchLineParseTest so launch-line drift is caught on non-Windows platforms too.

Tests run (Windows 11, Python 3.12.10, CPU-only, no GPU used, no game files)

  • python -I tests/test_build_batch_launch.py -v — failed before (found 0 for build_runtime.ps1), pass after (3/3 OK, all 6 special-character folders and exit codes 0 and 7 for both scripts)
  • python -I -m compileall -q tests/test_build_batch_launch.py — pass (exit 0)
  • python -I scripts/check_no_game_data.py — pass (exit 0)

AI-assisted.

@tikD1337

Copy link
Copy Markdown
Contributor

No blocking findings. This is a sound, scoped update to restore the batch-launch regression tests after build_runtime.ps1 switched to a hidden process with redirected output.

The updated LAUNCH expression accepts both scripts’ current forms: optional -FilePath, optional -NoNewWindow, and a trailing PowerShell continuation backtick after -PassThru. It still requires exactly one matching launch per script and extracts the actual -ArgumentList expression, preserving coverage of the quoting that protects paths containing spaces, &, and ^. The new LaunchLineParseTest also runs independently of the Windows-only execution tests, so incompatible script edits can be detected on other platforms.

The hidden_redirect branch reproduces the runtime script’s relevant process settings: -WindowStyle Hidden and separate stdout/stderr files, without -NoNewWindow. That parameter separation is correct: PowerShell documents -WindowStyle and -NoNewWindow as mutually exclusive. The LLVM branch retains its existing launch mode. See the Microsoft Start-Process documentation.

The execution checks remain meaningful: each script’s extracted arguments must run a synthetic batch file in all six folder variants and propagate both exit codes, 0 and 7. Checking ran.txt as well as the exit code prevents a successful process launch from being mistaken for successful batch execution. Keeping $p.Handle acquisition before WaitForExit() preserves the existing exit-code handling. The deliberately broken quoting control remains enabled and passes its assertions.

One non-blocking coverage limitation: the hidden-launch options are reconstructed in the test and selected by script filename; only the argument expression is extracted from the production script. Consequently, this tests batch execution under the current hidden/redirection configuration, but does not verify the production continuation lines, redirected log contents, log forwarding, or actual window visibility. Extending the synthetic batch to emit distinct stdout/stderr markers and asserting their log contents would strengthen redirection coverage.

Verification completed without game files on Windows 11 Pro, CPython 3.13.14, Windows PowerShell 5.1.26100.10068:

  • git diff HEAD^ HEAD --check — passed.
  • py -3.13 -m compileall -q make_game.py tools tests — passed.
  • py -3.13 -I scripts/check_no_game_data.py — passed.
  • py -3.13 -I make_game.py --help — passed.
  • py -3.13 -I tests/test_build_batch_launch.py -v — 3 tests passed, no skips, in 26.966 seconds, including both launch modes and the broken-quoting control.

The supplied Targeted tests: [] (All passed: True) report alone establishes no targeted-test coverage; the explicit run above closes that verification gap. No MSVC/Ninja build or GPU validation was needed for this test-only change.

The diff introduces no game data, keys, encryption bypass, or online-service access. It follows the fix-don’t-disable contract by adapting the tests to the current launch behavior while retaining execution assertions and the negative control. No translator rule or runtime-contract change requires a docs/design.md update.

AI-assisted.

@kapitche

Copy link
Copy Markdown
Contributor

Tested 9c66342 merged with main 8575d36 on Windows/Python 3.13.1: pass

The PR changes only tests/test_build_batch_launch.py, and the real launch test is skipped off Windows, so I ran it on native Windows (PowerShell 5.1, Python 3.13.1) in a scratch worktree with the merged test file and main's scripts/build_runtime.ps1 and scripts/build_llvm_mc.ps1:

  • python -I tests\test_build_batch_launch.py -v -> Ran 3 tests, OK (test_each_script_starts_its_batch_in_any_folder, test_the_check_catches_a_launch_line_that_drops_the_quotes, test_each_script_has_one_cmd_launch_line)
  • Control: main's version of the test against the same two scripts -> FAILED (failures=1): build_runtime.ps1: expected one '$p = Start-Process cmd.exe -ArgumentList ...' line, found 0, because build_runtime.ps1 on main now uses Start-Process -FilePath cmd.exe ... -PassThru with a backtick continuation. This is the failure the PR fixes. The PR touches no non-test file, so there is no source revert to run.
  • Linux/Python 3.12.16, merged tree: python -I tests/test_build_batch_launch.py -> Ran 3 tests, OK (skipped=2, the Windows-only ones; the new parse test ran).

Diff read: the LAUNCH regex now accepts an optional -FilePath, an optional -NoNewWindow and a trailing backtick; for build_runtime.ps1 the harness reproduces the hidden, redirected launch (-WindowStyle Hidden -RedirectStandardOutput/-RedirectStandardError) with the same folder names.

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

Verified on Windows 11:

  • python -m unittest tests/test_build_batch_launch.py passed all 3 tests (5.372s).
  • Validated LaunchLineParseTest and BatchLaunchTest matching build_runtime.ps1's -WindowStyle Hidden and redirected output launch line while preserving unquoted failure detection.
  • Whitespace clean (git diff HEAD~1..HEAD --check).

@illusionart453-max

Copy link
Copy Markdown

Independent native Windows/PowerShell/Python 3.15 verification at 9c66342: python -I tests/test_build_batch_launch.py passes 3/3 in an isolated worktree. Native launch cases ran, including the quote-dropping negative control. The current-main audit at 8575d36 reproduces the old parser failure (build_runtime.ps1 launch found 0), while this head passes. Synthetic batch files only, no GPU/game files. AI-assisted (Codex).

@aarushkha

Copy link
Copy Markdown

Tested 9c66342 merged onto main 86a7807dd on Windows 10 Pro 22H2 (19045), Python 3.14.3: pass.

  • python -I tests/test_build_batch_launch.py: Ran 3 tests in 7.334s OK (red on main)

It merges cleanly together with #7092 #6049 #6513 #7242 #7209 #6254 #7214 #6957 #7309 #4771 #7029 #7094 #7129 #6508 #7152 #7174 #7032 onto main; with all of them applied, the only standalone test still red on Windows is test_first_look_paths (claimed by Racurs156). Summary in #7333.

No GPU or game files needed. AI-assisted (Claude Code); I read the diff before running it.

@airp1ane

Copy link
Copy Markdown
Contributor

Tested 9c66342 on Windows 11, Python 3.15.2, NVIDIA RTX 4060 Ti (driver 621.24; CPU-only checks, no game files, no GPU/llvm-mc/MSVC used): pass.

Ran the test files this PR adds or changes, from a clean checkout of the PR head: test_build_batch_launch.py - all exit 0.

AI-assisted (Claude Code).

@Snooozs

Snooozs commented Nov 23, 2026

Copy link
Copy Markdown

Windows check: with this PR (head 9c66342) merged onto main 867d922, python -I tests/test_build_batch_launch.py is still red here, 2 of 3 tests fail:

FAIL: test_each_script_starts_its_batch_in_any_folder (script='build_llvm_mc.ps1')
AssertionError: Lists differ: ['a & b/7->0'] != []
FAIL: test_the_check_catches_a_launch_line_that_drops_the_quotes
AssertionError: 'a & b/0->1' not found in ['plain/7->0', 'a & b/0->0', 'a & b/7->0', 'a&b/0->0', 'a&b/7->0', 'x^y/0->0', 'x^y/7->0', 'sp (x)/7->0', '東京 & co/0->0', '東京 & co/7->0']

So build_llvm_mc.ps1 still fails to start its batch from a folder named a & b (exit 7), and the negative-control case a & b/0->1 does not occur. Windows 10 Pro 22H2 (19045), Windows PowerShell 5.1, CPython 3.12.10. On main the same test fails with 3 failures. AI-assisted (Claude Code); run on that machine.

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