mirror of
https://github.com/reactos/CMake.git
synced 2024-11-23 11:39:48 +00:00
Merge topic 'googletest-skipped'
89a843d6ea
GoogleTest: Add testcase for skipped tests98868dad1c
GoogleTest: Add support for skipped tests Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4586
This commit is contained in:
commit
6c737b273a
@ -134,6 +134,7 @@ function(gtest_discover_tests_impl)
|
||||
"${prefix}${pretty_suite}.${pretty_test}${suffix}"
|
||||
PROPERTIES
|
||||
WORKING_DIRECTORY "${_TEST_WORKING_DIR}"
|
||||
SKIP_REGULAR_EXPRESSION "\\\\[ SKIPPED \\\\]"
|
||||
${properties}
|
||||
)
|
||||
list(APPEND tests_buffer "${prefix}${pretty_suite}.${pretty_test}${suffix}")
|
||||
|
10
Tests/RunCMake/GoogleTest/GoogleTest-skip-timeout-stdout.txt
Normal file
10
Tests/RunCMake/GoogleTest/GoogleTest-skip-timeout-stdout.txt
Normal file
@ -0,0 +1,10 @@
|
||||
Test project .*
|
||||
Start 20: skip_test.test1
|
||||
1/1 Test #20: skip_test.test1 \.+\*\*\*Skipped +[0-9.]+ sec
|
||||
|
||||
100% tests passed, 0 tests failed out of 1
|
||||
|
||||
Total Test time \(real\) = +[0-9.]+ sec
|
||||
|
||||
The following tests did not run:
|
||||
.*20 - skip_test\.test1 \(Skipped\)
|
@ -49,3 +49,9 @@ gtest_discover_tests(
|
||||
DISCOVERY_TIMEOUT 20
|
||||
PROPERTIES TIMEOUT 2
|
||||
)
|
||||
|
||||
add_executable(skip_test skip_test.cpp)
|
||||
|
||||
gtest_discover_tests(
|
||||
skip_test
|
||||
)
|
||||
|
@ -60,6 +60,20 @@ function(run_GoogleTest DISCOVERY_MODE)
|
||||
-R property_timeout\\.case_with_discovery
|
||||
--no-label-summary
|
||||
)
|
||||
|
||||
run_cmake_command(GoogleTest-build
|
||||
${CMAKE_COMMAND}
|
||||
--build .
|
||||
--config Debug
|
||||
--target skip_test
|
||||
)
|
||||
|
||||
run_cmake_command(GoogleTest-skip-test
|
||||
${CMAKE_CTEST_COMMAND}
|
||||
-C Debug
|
||||
-R skip_test
|
||||
--no-label-summary
|
||||
)
|
||||
endfunction()
|
||||
|
||||
function(run_GoogleTestXML DISCOVERY_MODE)
|
||||
|
18
Tests/RunCMake/GoogleTest/skip_test.cpp
Normal file
18
Tests/RunCMake/GoogleTest/skip_test.cpp
Normal file
@ -0,0 +1,18 @@
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
// Note: GoogleTest.cmake doesn't actually depend on Google Test as such;
|
||||
// it only requires that we produces output in the expected format when
|
||||
// invoked with --gtest_list_tests. Thus, we fake that here. This allows us
|
||||
// to test the module without actually needing Google Test.
|
||||
if (argc > 1 && std::string(argv[1]) == "--gtest_list_tests") {
|
||||
std::cout << "skip_test." << std::endl;
|
||||
std::cout << " test1" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::cout << "[ SKIPPED ] skip_test.test1" << std::endl;
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user