Files
dotnet-runtime/eng/testing/RunnerTemplate.cmd
T
Michal Strehovský 6902c5accf Consider failing tests a failure (#50898)
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.
2021-04-09 10:58:05 +02:00

76 lines
2.4 KiB
Batchfile

@echo off
setlocal enabledelayedexpansion
set EXECUTION_DIR=%~dp0
:argparser_start
if "%~1" == "" goto argparser_end
set "argparser_currentarg=%~1"
shift
set "argparser_help_specified_inloop="
if /i "%argparser_currentarg%"=="-h" ( set "argparser_help_specified_inloop=1" )
if /i "%argparser_currentarg%"=="--help" ( set "argparser_help_specified_inloop=1" )
if defined argparser_help_specified_inloop (
goto usage
)
set "argparser_runtime_path_specified_inloop="
if /i "%argparser_currentarg%"=="-r" ( set "argparser_runtime_path_specified_inloop=1" )
if /i "%argparser_currentarg%"=="--runtime-path" ( set "argparser_runtime_path_specified_inloop=1" )
if defined argparser_runtime_path_specified_inloop (
if "%~1" == "" ( goto argparser_invalid )
set "RUNTIME_PATH=%~1"
goto argparser_break
)
if /i "%argparser_currentarg%"=="--rsp-file" (
if "%~1" == "" ( goto argparser_invalid )
set "RSP_FILE=@%~1"
goto argparser_break
)
:argparser_invalid
echo Invalid argument or value: %argparser_currentarg%
call :usage
exit /b -1
:argparser_break
shift
goto argparser_start
:argparser_end
:: Don't use a globally installed SDK.
set DOTNET_MULTILEVEL_LOOKUP=0
:: ========================= BEGIN Test Execution =============================
echo ----- start %DATE% %TIME% =============== To repro directly: =====================================================
echo pushd %EXECUTION_DIR%
[[RunCommandsEcho]]
echo popd
echo ===========================================================================================================
pushd %EXECUTION_DIR%
@echo on
[[RunCommands]]
@echo off
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
)
)
exit /b %ERRORLEVEL%
:: ========================= END Test Execution =================================
:usage
echo Usage: RunTests.cmd {-r^|--runtime-path} ^<runtime-path^> [{--rsp-file} ^<rsp-file^>]
echo.
echo Parameters:
echo --runtime-path (Mandatory) Testhost containing the test runtime used during test execution (short: -r)"
echo --rsp-file RSP file to pass in additional arguments
echo --help Print help and exit (short: -h)