mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-12 17:19:05 -05:00
GoogleTest: Reports skipped test with gtest_add_tests
Skipped GTests were reported as success when tests where added with gtest_add_tests. This fixes this behaviour. Fixes: #24130
This commit is contained in:
committed by
David Perret
parent
182ef53d3d
commit
f54963e60f
@@ -405,6 +405,12 @@ function(gtest_add_tests)
|
|||||||
--gtest_filter=${gtest_test_name}
|
--gtest_filter=${gtest_test_name}
|
||||||
${ARGS_EXTRA_ARGS}
|
${ARGS_EXTRA_ARGS}
|
||||||
)
|
)
|
||||||
|
# Makes sure a skipped GTest is reported as so by CTest
|
||||||
|
set_tests_properties(
|
||||||
|
${ctest_test_name}
|
||||||
|
PROPERTIES
|
||||||
|
SKIP_REGULAR_EXPRESSION "\\[ SKIPPED \\]"
|
||||||
|
)
|
||||||
list(APPEND testList ${ctest_test_name})
|
list(APPEND testList ${ctest_test_name})
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|||||||
@@ -1,10 +1,13 @@
|
|||||||
Test project .*
|
Test project .*
|
||||||
*Start +[0-9]+: skip_test\.test1
|
*Start +[0-9]+: skip_test\.test1
|
||||||
*[0-9]+/[0-9]+ +Test +#[0-9]+: skip_test\.test1 \.+\*\*\*Skipped +[0-9.]+ sec
|
*[0-9]+/[0-9]+ +Test +#[0-9]+: skip_test\.test1 \.+\*\*\*Skipped +[0-9.]+ sec
|
||||||
|
*Start +[0-9]+: skip_test\.test1
|
||||||
|
*[0-9]+/[0-9]+ +Test +#[0-9]+: skip_test\.test1 \.+\*\*\*Skipped +[0-9.]+ sec
|
||||||
|
|
||||||
100% tests passed, 0 tests failed out of 1
|
100% tests passed, 0 tests failed out of 2
|
||||||
|
|
||||||
Total Test time \(real\) = +[0-9.]+ sec
|
Total Test time \(real\) = +[0-9.]+ sec
|
||||||
|
|
||||||
The following tests did not run:
|
The following tests did not run:
|
||||||
[ 0-9]+- skip_test\.test1 \(Skipped\)
|
[ 0-9]+- skip_test\.test1 \(Skipped\)
|
||||||
|
[ 0-9]+- skip_test\.test1 \(Skipped\)
|
||||||
|
|||||||
@@ -78,3 +78,7 @@ xcode_sign_adhoc(skip_test)
|
|||||||
gtest_discover_tests(
|
gtest_discover_tests(
|
||||||
skip_test
|
skip_test
|
||||||
)
|
)
|
||||||
|
|
||||||
|
gtest_add_tests(
|
||||||
|
TARGET skip_test
|
||||||
|
)
|
||||||
|
|||||||
@@ -1,6 +1,13 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
/* Having this as comment lets gtest_add_tests recognizes the test we fake
|
||||||
|
here without requiring googletest
|
||||||
|
TEST_F( skip_test, test1 )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
// Note: GoogleTest.cmake doesn't actually depend on Google Test as such;
|
// Note: GoogleTest.cmake doesn't actually depend on Google Test as such;
|
||||||
|
|||||||
Reference in New Issue
Block a user