diff options
Diffstat (limited to 'Tests/RunCMake/GoogleTest/RunCMakeTest.cmake')
-rw-r--r-- | Tests/RunCMake/GoogleTest/RunCMakeTest.cmake | 62 |
1 files changed, 40 insertions, 22 deletions
diff --git a/Tests/RunCMake/GoogleTest/RunCMakeTest.cmake b/Tests/RunCMake/GoogleTest/RunCMakeTest.cmake index 8070512..97a777b 100644 --- a/Tests/RunCMake/GoogleTest/RunCMakeTest.cmake +++ b/Tests/RunCMake/GoogleTest/RunCMakeTest.cmake @@ -1,6 +1,6 @@ include(RunCMake) -function(run_GoogleTest) +function(run_GoogleTest DISCOVERY_MODE) # Use a single build tree for a few tests without cleaning. set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/GoogleTest-build) set(RunCMake_TEST_NO_CLEAN 1) @@ -10,7 +10,7 @@ function(run_GoogleTest) file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") - run_cmake(GoogleTest) + run_cmake_with_options(GoogleTest -DCMAKE_GTEST_DISCOVER_TESTS_DISCOVERY_MODE=${DISCOVERY_MODE}) run_cmake_command(GoogleTest-build ${CMAKE_COMMAND} @@ -26,15 +26,6 @@ function(run_GoogleTest) --target property_timeout_test ) - set(RunCMake_TEST_OUTPUT_MERGE 1) - run_cmake_command(GoogleTest-discovery-timeout-build - ${CMAKE_COMMAND} - --build . - --config Debug - --target discovery_timeout_test - ) - set(RunCMake_TEST_OUTPUT_MERGE 0) - run_cmake_command(GoogleTest-test1 ${CMAKE_CTEST_COMMAND} -C Debug @@ -69,16 +60,9 @@ 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() -function(run_GoogleTestXML) +function(run_GoogleTestXML DISCOVERY_MODE) # Use a single build tree for a few tests without cleaning. set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/GoogleTestXML-build) set(RunCMake_TEST_NO_CLEAN 1) @@ -88,7 +72,7 @@ function(run_GoogleTestXML) file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") - run_cmake(GoogleTestXML) + run_cmake_with_options(GoogleTestXML -DCMAKE_GTEST_DISCOVER_TESTS_DISCOVERY_MODE=${DISCOVERY_MODE}) run_cmake_command(GoogleTestXML-discovery ${CMAKE_COMMAND} @@ -105,5 +89,39 @@ function(run_GoogleTestXML) ) endfunction() -run_GoogleTest() -run_GoogleTestXML() +function(run_GoogleTest_discovery_timeout DISCOVERY_MODE) + # Use a single build tree for a few tests without cleaning. + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/GoogleTest-discovery-timeout) + set(RunCMake_TEST_NO_CLEAN 1) + if(NOT RunCMake_GENERATOR_IS_MULTI_CONFIG) + set(RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Debug) + endif() + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + + run_cmake_with_options(GoogleTestDiscoveryTimeout -DDISCOVERY_MODE=${DISCOVERY_MODE}) + + set(RunCMake_TEST_OUTPUT_MERGE 1) + run_cmake_command(GoogleTest-discovery-${DISCOVERY_MODE}-timeout-build + ${CMAKE_COMMAND} + --build . + --config Debug + --target discovery_timeout_test + ) + set(RunCMake_TEST_OUTPUT_MERGE 0) + + run_cmake_command(GoogleTest-discovery-${DISCOVERY_MODE}-timeout-test + ${CMAKE_CTEST_COMMAND} + -C Debug + -R discovery_timeout_test + --no-label-sumary + ) +endfunction() + +foreach(DISCOVERY_MODE POST_BUILD PRE_TEST) + message("Testing ${DISCOVERY_MODE} discovery mode via CMAKE_GTEST_DISCOVER_TESTS_DISCOVERY_MODE global override...") + run_GoogleTest(${DISCOVERY_MODE}) + run_GoogleTestXML(${DISCOVERY_MODE}) + message("Testing ${DISCOVERY_MODE} discovery mode via DISCOVERY_MODE option...") + run_GoogleTest_discovery_timeout(${DISCOVERY_MODE}) +endforeach() |