summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorCraig Scott <craig.scott@crascit.com>2018-03-14 13:16:36 (GMT)
committerBrad King <brad.king@kitware.com>2018-03-15 11:36:42 (GMT)
commit96fdde26bbbc969944e556ad649191cd21f46990 (patch)
tree0304a27601c4392c7f0a88527c4b0c6fc37d8cc0 /Modules
parentc1e087a9d3af74299d7681c9f9de59e5977a1539 (diff)
downloadCMake-96fdde26bbbc969944e556ad649191cd21f46990.zip
CMake-96fdde26bbbc969944e556ad649191cd21f46990.tar.gz
CMake-96fdde26bbbc969944e556ad649191cd21f46990.tar.bz2
GoogleTest: Rename TIMEOUT parameter to avoid clash
In gtest_discover_tests(), the TIMEOUT keyword was making it impossible to set the TIMEOUT test property via the PROPERTIES keyword. This would be a frequent case, but it doesn't complain and instead silently does something different to what would normally be expected. The TIMEOUT keyword has been renamed to DISCOVERY_TIMEOUT, thereby removing the clash. This is a breaking change. 3.10.1 and 3.10.2 were the only versions that supported the TIMEOUT keyword and uses of it were likely not working as intended. Fixes: #17801
Diffstat (limited to 'Modules')
-rw-r--r--Modules/GoogleTest.cmake21
1 files changed, 16 insertions, 5 deletions
diff --git a/Modules/GoogleTest.cmake b/Modules/GoogleTest.cmake
index c525101..bfb83e1 100644
--- a/Modules/GoogleTest.cmake
+++ b/Modules/GoogleTest.cmake
@@ -150,6 +150,7 @@ same as the Google Test name (i.e. ``suite.testcase``); see also
[NO_PRETTY_TYPES] [NO_PRETTY_VALUES]
[PROPERTIES name1 value1...]
[TEST_LIST var]
+ [DISCOVERY_TIMEOUT seconds]
)
``gtest_discover_tests`` sets up a post-build command on the test executable
@@ -217,7 +218,7 @@ same as the Google Test name (i.e. ``suite.testcase``); see also
executable is being used in multiple calls to ``gtest_discover_tests()``.
Note that this variable is only available in CTest.
- ``TIMEOUT num``
+ ``DISCOVERY_TIMEOUT num``
Specifies how long (in seconds) CMake will wait for the test to enumerate
available tests. If the test takes longer than this, discovery (and your
build) will fail. Most test executables will enumerate their tests very
@@ -225,6 +226,16 @@ same as the Google Test name (i.e. ``suite.testcase``); see also
longer timeout. The default is 5. See also the ``TIMEOUT`` option of
:command:`execute_process`.
+ .. note::
+
+ In CMake versions 3.10.1 and 3.10.2, this option was called ``TIMEOUT``.
+ This clashed with the ``TIMEOUT`` test property, which is one of the
+ common properties that would be set with the ``PROPERTIES`` keyword,
+ usually leading to legal but unintended behavior. The keyword was
+ changed to ``DISCOVERY_TIMEOUT`` in CMake 3.10.3 to address this
+ problem. The ambiguous behavior of the ``TIMEOUT`` keyword in 3.10.1
+ and 3.10.2 has not been preserved.
+
#]=======================================================================]
#------------------------------------------------------------------------------
@@ -357,7 +368,7 @@ function(gtest_discover_tests TARGET)
cmake_parse_arguments(
""
"NO_PRETTY_TYPES;NO_PRETTY_VALUES"
- "TEST_PREFIX;TEST_SUFFIX;WORKING_DIRECTORY;TEST_LIST;TIMEOUT"
+ "TEST_PREFIX;TEST_SUFFIX;WORKING_DIRECTORY;TEST_LIST;DISCOVERY_TIMEOUT"
"EXTRA_ARGS;PROPERTIES"
${ARGN}
)
@@ -368,8 +379,8 @@ function(gtest_discover_tests TARGET)
if(NOT _TEST_LIST)
set(_TEST_LIST ${TARGET}_TESTS)
endif()
- if(NOT _TIMEOUT)
- set(_TIMEOUT 5)
+ if(NOT _DISCOVERY_TIMEOUT)
+ set(_DISCOVERY_TIMEOUT 5)
endif()
get_property(
@@ -418,7 +429,7 @@ function(gtest_discover_tests TARGET)
-D "NO_PRETTY_VALUES=${_NO_PRETTY_VALUES}"
-D "TEST_LIST=${_TEST_LIST}"
-D "CTEST_FILE=${ctest_tests_file}"
- -D "TEST_DISCOVERY_TIMEOUT=${_TIMEOUT}"
+ -D "TEST_DISCOVERY_TIMEOUT=${_DISCOVERY_TIMEOUT}"
-P "${_GOOGLETEST_DISCOVER_TESTS_SCRIPT}"
VERBATIM
)