From 75d4283ea04735119ffa1ac42ceb667b66c4cf12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marie=20P=C3=ADchov=C3=A1?= <11718369+ManickaP@users.noreply.github.com> Date: Mon, 29 May 2023 12:47:10 +0200 Subject: [PATCH] Fix unfailing helix test run when testResults.xml are missing (#86342) * Attempt to fix unfailing helix test run when testResults.xml are missing * Feedback and docker image attemted fix * Commenting out RHEL7 for a test run to see if there are any remaining problems elsewhere * AlmaLinux 8 instead of RHEL7 * Test docker image * Kdepak asi soudruzi udelali chybu * Fixed docker from centos stream 9 to 8 * Test with different Queue * Fixed docker image name --- eng/pipelines/libraries/helix-queues-setup.yml | 6 +++--- eng/testing/RunnerTemplate.cmd | 13 +++++++++---- eng/testing/RunnerTemplate.sh | 5 ++++- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/eng/pipelines/libraries/helix-queues-setup.yml b/eng/pipelines/libraries/helix-queues-setup.yml index 4ae7dd1865fb1..fbb977510d294 100644 --- a/eng/pipelines/libraries/helix-queues-setup.yml +++ b/eng/pipelines/libraries/helix-queues-setup.yml @@ -63,8 +63,8 @@ jobs: - ${{ if eq(parameters.platform, 'linux_x64') }}: - ${{ if and(eq(parameters.jobParameters.interpreter, ''), ne(parameters.jobParameters.isSingleFile, true)) }}: - ${{ if and(eq(parameters.jobParameters.testScope, 'outerloop'), eq(parameters.jobParameters.runtimeFlavor, 'mono')) }}: - - RedHat.7.Amd64.Open - SLES.15.Amd64.Open + - (Centos.8.Amd64.Open)Ubuntu.1804.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:centos-stream8-helix - (Fedora.36.Amd64.Open)Ubuntu.1804.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:fedora-36-helix - (Ubuntu.2204.Amd64.Open)Ubuntu.1804.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-22.04-helix-amd64 - (Debian.10.Amd64.Open)Ubuntu.2204.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:debian-10-helix-amd64 @@ -77,8 +77,8 @@ jobs: - (Mariner.2.0.Amd64.Open)ubuntu.1804.amd64.open@mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-helix-amd64 - (openSUSE.15.2.Amd64.Open)ubuntu.1804.amd64.open@mcr.microsoft.com/dotnet-buildtools/prereqs:opensuse-15.2-helix-amd64 - ${{ if or(ne(parameters.jobParameters.isExtraPlatforms, true), eq(parameters.jobParameters.includeAllPlatforms, true)) }}: - - (Centos.7.Amd64.Open)Ubuntu.1804.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:centos-7-mlnet-helix - - RedHat.7.Amd64.Open + - (Centos.8.Amd64.Open)Ubuntu.1804.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:centos-stream8-helix + - (AlmaLinux.8.Amd64.Open)RedHat.7.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:almalinux-8-helix-amd64 - (Debian.10.Amd64.Open)Ubuntu.1804.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:debian-10-helix-amd64 - Ubuntu.1804.Amd64.Open - ${{ if or(eq(parameters.jobParameters.interpreter, 'true'), eq(parameters.jobParameters.isSingleFile, true)) }}: diff --git a/eng/testing/RunnerTemplate.cmd b/eng/testing/RunnerTemplate.cmd index 0d898b4aa182a..fa39383ee81b1 100644 --- a/eng/testing/RunnerTemplate.cmd +++ b/eng/testing/RunnerTemplate.cmd @@ -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 @@ -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% diff --git a/eng/testing/RunnerTemplate.sh b/eng/testing/RunnerTemplate.sh index c0f2362601fe3..7c534f72b5e86 100644 --- a/eng/testing/RunnerTemplate.sh +++ b/eng/testing/RunnerTemplate.sh @@ -166,6 +166,9 @@ echo =========================================================================== pushd $EXECUTION_DIR [[RunCommands]] test_exitcode=$? +if [[ -s testResults.xml ]]; then + has_test_results=1; +fi; popd echo ----- end $(date) ----- exit code $test_exitcode ---------------------------------------------------------- @@ -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" == "1" ]]; then if [ -n "$HELIX_WORKITEM_PAYLOAD" ]; then exit 0 fi