Merge topic 'GoogleTest-gtest_discover_tests-failure'

2ba8ac07ed GoogleTest: Fix CTest not failing if gtest_discover_tests fails
2c9680eec5 GoogleTest: Add missing test case for gtest_discover_tests failure

Acked-by: Kitware Robot <kwrobot@kitware.com>
Reviewed-by: Steffen Seckler <steffen.seckler@tum.de>
Acked-by: Matthew Woehlke <matthew.woehlke@kitware.com>
Merge-request: !4466
This commit is contained in:
Brad King 2020-03-13 14:46:11 +00:00 committed by Kitware Robot
commit c3ab1c22b0
7 changed files with 33 additions and 3 deletions

View File

@ -13,11 +13,13 @@ set(tests)
set(tests_buffer)
# Overwrite possibly existing ${CTEST_FILE} with empty file
file(WRITE "${CTEST_FILE}" "")
set(flush_tests_MODE WRITE)
# Flushes script to ${CTEST_FILE}
macro(flush_script)
file(APPEND "${CTEST_FILE}" "${script}")
file(${flush_tests_MODE} "${CTEST_FILE}" "${script}")
set(flush_tests_MODE APPEND)
set(script "")
endmacro()

View File

@ -0,0 +1,2 @@
Unable to find executable: discovery_timeout_test_NOT_BUILT
Errors while running CTest

View File

@ -0,0 +1,18 @@
Test project .*GoogleTest-build
[ \t]*Start [0-9]+: discovery_timeout_test_NOT_BUILT
Could not find executable discovery_timeout_test_NOT_BUILT
Looked in the following places:
discovery_timeout_test_NOT_BUILT
discovery_timeout_test_NOT_BUILT(\.exe)?
Debug/discovery_timeout_test_NOT_BUILT
Debug/discovery_timeout_test_NOT_BUILT(\.exe)?
Debug/discovery_timeout_test_NOT_BUILT
Debug/discovery_timeout_test_NOT_BUILT(\.exe)?
[^\n]+discovery_timeout_test_NOT_BUILT +\.+\*\*\*Not Run +[0-9.]+ sec
+
0% tests passed, 1 tests failed out of 1
+
Total Test time \(real\) = +[0-9.]+ sec
+
The following tests FAILED:
[^\n]+discovery_timeout_test_NOT_BUILT \(Not Run\)

View File

@ -27,7 +27,7 @@ function(run_GoogleTest)
)
set(RunCMake_TEST_OUTPUT_MERGE 1)
run_cmake_command(GoogleTest-discovery-timeout
run_cmake_command(GoogleTest-discovery-timeout-build
${CMAKE_COMMAND}
--build .
--config Debug
@ -69,6 +69,13 @@ function(run_GoogleTest)
-R property_timeout\\.case_with_discovery
--no-label-summary
)
run_cmake_command(GoogleTest-discovery-timeout-test
${CMAKE_CTEST_COMMAND}
-C Debug
-R discovery_timeout_test
--no-label-summary
)
endfunction()
run_GoogleTest()