From 161528dddb61417624fb1b48be7c8bf5e84f9911 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Strehovsk=C3=BD?= Date: Thu, 8 Apr 2021 11:11:17 +0200 Subject: [PATCH] Consider failing tests a failure When running `build libs.tests -test` locally, I see the build succeeding even though there's failing tests. This seems to be caused by Helix specific logic in the runner template. It should not apply when we're not running in Helix. --- eng/testing/RunnerTemplate.cmd | 7 ++++--- eng/testing/RunnerTemplate.sh | 9 ++++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/eng/testing/RunnerTemplate.cmd b/eng/testing/RunnerTemplate.cmd index 9e6c6d1e7866bf..0d898b4aa182ad 100644 --- a/eng/testing/RunnerTemplate.cmd +++ b/eng/testing/RunnerTemplate.cmd @@ -59,10 +59,11 @@ echo ----- end %DATE% %TIME% ----- exit code %ERRORLEVEL% ---------------------- :: The helix work item should not exit with non-zero if tests ran and produced results :: The special console runner for runtime returns 1 when tests fail if %ERRORLEVEL%==1 ( - exit /b 0 -) else ( - exit /b %ERRORLEVEL% + if not "%HELIX_WORKITEM_PAYLOAD%"=="" ( + exit /b 0 + ) ) +exit /b %ERRORLEVEL% :: ========================= END Test Execution ================================= :usage diff --git a/eng/testing/RunnerTemplate.sh b/eng/testing/RunnerTemplate.sh index a8bdcb1d478849..4770323fdc9c7d 100644 --- a/eng/testing/RunnerTemplate.sh +++ b/eng/testing/RunnerTemplate.sh @@ -225,8 +225,11 @@ popd >/dev/null # The helix work item should not exit with non-zero if tests ran and produced results # The special console runner for runtime returns 1 when tests fail if [ "$test_exitcode" == "1" ]; then - exit 0 -else - exit $test_exitcode + if [ -n "$HELIX_WORKITEM_PAYLOAD" ]; then + exit 0 + fi +fi + +exit $test_exitcode fi