From 46c066de0c041dfc70a87718db14c89f021a9a20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Fri, 19 Dec 2025 12:35:08 +0100 Subject: [PATCH] Fix exit code handling in runtests.cmd 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. --- eng/helix/content/runtests.cmd | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/eng/helix/content/runtests.cmd b/eng/helix/content/runtests.cmd index f54dccdeeb61..6dc33efc3011 100644 --- a/eng/helix/content/runtests.cmd +++ b/eng/helix/content/runtests.cmd @@ -21,12 +21,9 @@ set "PATH=%HELIX_WORKITEM_ROOT%;%PATH%;%HELIX_WORKITEM_ROOT%\node\bin" echo Set path to: "%PATH%" echo. -set exit_code=0 - echo "Running tests: dotnet %HELIX_CORRELATION_PAYLOAD%/HelixTestRunner/HelixTestRunner.dll --target %$target% --runtime %$aspRuntimeVersion% --queue %$queue% --arch %$arch% --quarantined %$quarantined% --helixTimeout %$helixTimeout% --playwright %$installPlaywright%" dotnet %HELIX_CORRELATION_PAYLOAD%/HelixTestRunner/HelixTestRunner.dll --target %$target% --runtime %$aspRuntimeVersion% --queue %$queue% --arch %$arch% --quarantined %$quarantined% --helixTimeout %$helixTimeout% --playwright %$installPlaywright% -if not errorlevel 0 ( - set exit_code=%errorlevel% -) +set exit_code=%errorlevel% + echo "Finished running tests: exit_code=%exit_code%" EXIT /b %exit_code%