Skip to content

Commit f7116eb

Browse files
authored
Fix exit code handling in runtests.cmd (#64820)
We were inadvertently setting exit code = 0 even if a test failed. This is because the way the `errorlevel` _command_ works is that it checks whether the last command exit code was **greater than or equal** to the argument. So checking `errorlevel 0` in the if reports true even when we have exit code 1 and then we negate that and don't enter the if block. We don't actually need this if check at all since we just want to print the value so we can just capture the `%errorlevel%` _variable_.
1 parent 84747bb commit f7116eb

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

eng/helix/content/runtests.cmd

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,9 @@ set "PATH=%HELIX_WORKITEM_ROOT%;%PATH%;%HELIX_WORKITEM_ROOT%\node\bin"
2121
echo Set path to: "%PATH%"
2222
echo.
2323

24-
set exit_code=0
25-
2624
echo "Running tests: dotnet %HELIX_CORRELATION_PAYLOAD%/HelixTestRunner/HelixTestRunner.dll --target %$target% --runtime %$aspRuntimeVersion% --queue %$queue% --arch %$arch% --quarantined %$quarantined% --helixTimeout %$helixTimeout% --playwright %$installPlaywright%"
2725
dotnet %HELIX_CORRELATION_PAYLOAD%/HelixTestRunner/HelixTestRunner.dll --target %$target% --runtime %$aspRuntimeVersion% --queue %$queue% --arch %$arch% --quarantined %$quarantined% --helixTimeout %$helixTimeout% --playwright %$installPlaywright%
28-
if not errorlevel 0 (
29-
set exit_code=%errorlevel%
30-
)
26+
set exit_code=%errorlevel%
27+
3128
echo "Finished running tests: exit_code=%exit_code%"
3229
EXIT /b %exit_code%

0 commit comments

Comments
 (0)