Skip to content

Propagate te.exe exit code from run-tests.ps1#40497

Merged
benhillis merged 1 commit into
microsoft:masterfrom
benhillis:user/benhill/fix-run-tests-exit-code
May 11, 2026
Merged

Propagate te.exe exit code from run-tests.ps1#40497
benhillis merged 1 commit into
microsoft:masterfrom
benhillis:user/benhill/fix-run-tests-exit-code

Conversation

@benhillis
Copy link
Copy Markdown
Member

Split out from #40489.

te.exe is invoked as a native command in run-tests.ps1, so its failure should be detected via 0 rather than !True (which can be unreliable for native processes under Set-StrictMode). The script also substitutes a hardcoded 1 instead of propagating te.exe's actual exit code, which loses information for CI / wrapper scripts that distinguish between failure modes.

The -Package parameter doc lists the default as .\wsl.msix, but the actual default in the param() block is .\installer.msix.

Changes (tools/test/run-tests.ps1)

  • Detect te.exe failure with 0 -ne 0 and propagate 0 on exit.
  • Update -Package parameter doc to match the real default .\installer.msix.

`te.exe` is invoked as a native command, so its failure should be
detected via `0` rather than `!True` (which can be
unreliable for native processes under `Set-StrictMode`). Also
propagate the actual exit code instead of substituting a hardcoded `1`
so callers (CI, wrapper scripts) can distinguish between te.exe failure
modes.

Also fix the `-Package` parameter doc: the actual default is
`.\installer.msix`, not `.\wsl.msix`.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 11, 2026 17:42
@benhillis benhillis marked this pull request as ready for review May 11, 2026 17:48
@benhillis benhillis requested a review from a team as a code owner May 11, 2026 17:48
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Updates the PowerShell test runner to correctly detect and propagate te.exe exit codes, and aligns parameter help text with the actual default package path.

Changes:

  • Switch failure detection from $? to $LASTEXITCODE for the native te.exe invocation.
  • Propagate the real te.exe exit code instead of exiting with a hardcoded 1.
  • Fix -Package parameter docs to match the actual default (.\installer.msix).

Comment thread tools/test/run-tests.ps1
Comment on lines 105 to 109
te.exe $teArgList
if (!$?)
if ($LASTEXITCODE -ne 0)
{
exit 1
exit $LASTEXITCODE
}
Comment thread tools/test/run-tests.ps1
Path to test data folder. Defaults to ".\test_data".
.PARAMETER Package
Path to the wsl.msix package to install. Defaults to ".\wsl.msix".
Path to the wsl.msix package to install. Defaults to ".\installer.msix".
Comment thread tools/test/run-tests.ps1
if ($LASTEXITCODE -ne 0)
{
exit 1
exit $LASTEXITCODE
@benhillis benhillis merged commit e7f5202 into microsoft:master May 11, 2026
13 checks passed
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.

3 participants