From 01908e9fe3b5a3c51935e1f6622ef4bf10b805c3 Mon Sep 17 00:00:00 2001 From: Bruce Forstall Date: Tue, 7 Aug 2018 14:58:12 -0700 Subject: [PATCH] Add basic check that the correct number of tests is built (#19290) Fixes #19286 --- build-test.cmd | 9 +++++++++ build-test.sh | 14 ++++++++++++++ tests/runtest.proj | 25 ++++++++++++++++++++++++- 3 files changed, 47 insertions(+), 1 deletion(-) diff --git a/build-test.cmd b/build-test.cmd index 9df2033da57e..242c39e70d6d 100644 --- a/build-test.cmd +++ b/build-test.cmd @@ -335,6 +335,15 @@ for /l %%G in (1, 1, %__BuildLoopCount%) do ( set __AppendToLog=true ) +REM Check that we've built about as many tests as we expect. This is primarily intended to prevent accidental changes that cause us to build +REM drastically fewer Pri-1 tests than expected. +echo %__MsgPrefix%Check the managed tests build +call %__DotnetHost% msbuild %__ProjectDir%\tests\runtest.proj /t:CheckTestBuild /p:CLRTestPriorityToBuild=%__Priority% %__msbuildArgs% %__unprocessedBuildArgs% +if errorlevel 1 ( + echo %__MsgPrefix%Error: build failed. + exit /b 1 +) + :SkipManagedBuild REM ========================================================================================= diff --git a/build-test.sh b/build-test.sh index fd2d8af3d99f..b661ebaef98f 100755 --- a/build-test.sh +++ b/build-test.sh @@ -252,6 +252,20 @@ build_Tests() echo "${__MsgPrefix}Error: build failed. Refer to the build log files for details (above)" exit 1 else + echo "Checking the Managed Tests Build..." + + if [ -n __priority1 ]; then + __Priority=1 + else + __Priority=0 + fi + build_Tests_internal "Check_Test_Build" "${__ProjectDir}/tests/runtest.proj" "Check Test Build" "/t:CheckTestBuild /p:CLRTestPriorityToBuild=$__Priority" + + if [ $? -ne 0 ]; then + echo "${__MsgPrefix}Error: Check Test Build failed." + exit 1 + fi + echo "Managed tests build success!" fi diff --git a/tests/runtest.proj b/tests/runtest.proj index 3d12bd32fb94..52eeaaf1e560 100644 --- a/tests/runtest.proj +++ b/tests/runtest.proj @@ -27,7 +27,7 @@ + Text="$(XunitTestBinBase) does not exist. Please run build-test.cmd from the repo root at least once to get the tests built." /> @@ -54,6 +54,29 @@ + + + + + + @(AllRunnableTestPaths->Count()) + + + + + + + + + + False