Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempt to fix unfailing helix test run when testResults.xml are missing #86342

Merged
merged 9 commits into from
May 29, 2023
13 changes: 9 additions & 4 deletions eng/testing/RunnerTemplate.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ set EXECUTION_DIR=%~dp0
:: Don't use a globally installed SDK.
set DOTNET_MULTILEVEL_LOOKUP=0

:: ========================= BEGIN Test Execution =============================
echo ----- start %DATE% %TIME% =============== To repro directly: =====================================================
:: ========================= BEGIN Test Execution =============================
echo ----- start %DATE% %TIME% =============== To repro directly: =====================================================
echo pushd %EXECUTION_DIR%
[[RunCommandsEcho]]
echo popd
Expand All @@ -54,13 +54,18 @@ pushd %EXECUTION_DIR%
@echo on
[[RunCommands]]
@echo off
if exist testResults.xml (
set "HAS_TEST_RESULTS=1"
)
popd
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 (
if not "%HELIX_WORKITEM_PAYLOAD%"=="" (
exit /b 0
if %HAS_TEST_RESULTS%==1 (
if not "%HELIX_WORKITEM_PAYLOAD%"=="" (
exit /b 0
)
)
)
exit /b %ERRORLEVEL%
Expand Down
5 changes: 4 additions & 1 deletion eng/testing/RunnerTemplate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,9 @@ echo ===========================================================================
pushd $EXECUTION_DIR
[[RunCommands]]
test_exitcode=$?
if [[ -f testResults.xml ]]; then
ManickaP marked this conversation as resolved.
Show resolved Hide resolved
has_test_results=1;
fi;
popd
echo ----- end $(date) ----- exit code $test_exitcode ----------------------------------------------------------

Expand Down Expand Up @@ -230,7 +233,7 @@ popd >/dev/null
# ======================== END Core File Inspection ==========================
# 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
if [[ "$test_exitcode" == "1" && $has_test_results ]]; then
if [ -n "$HELIX_WORKITEM_PAYLOAD" ]; then
exit 0
fi
Expand Down