Skip to content

Commit 79f2d66

Browse files
committed
Use SKIP_RETURN_CODE test property in catch_discover_tests
I also added `SKIP_IS_FAILURE` option to the `catch_discover_tests` function, to allow users to get back the old behaviour. Closes #2873
1 parent e200443 commit 79f2d66

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

extras/Catch.cmake

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ same as the Catch name; see also ``TEST_PREFIX`` and ``TEST_SUFFIX``.
3838
[OUTPUT_PREFIX prefix]
3939
[OUTPUT_SUFFIX suffix]
4040
[DISCOVERY_MODE <POST_BUILD|PRE_TEST>]
41+
[SKIP_IS_FAILURE]
4142
)
4243
4344
``catch_discover_tests`` sets up a post-build command on the test executable
@@ -131,7 +132,7 @@ same as the Catch name; see also ``TEST_PREFIX`` and ``TEST_SUFFIX``.
131132
of test cases from the test executable and when the tests are executed themselves.
132133
This requires cmake/ctest >= 3.22.
133134
134-
`DISCOVERY_MODE mode``
135+
``DISCOVERY_MODE mode``
135136
Provides control over when ``catch_discover_tests`` performs test discovery.
136137
By default, ``POST_BUILD`` sets up a post-build command to perform test discovery
137138
at build time. In certain scenarios, like cross-compiling, this ``POST_BUILD``
@@ -143,6 +144,9 @@ same as the Catch name; see also ``TEST_PREFIX`` and ``TEST_SUFFIX``.
143144
``CMAKE_CATCH_DISCOVER_TESTS_DISCOVERY_MODE`` variable if it is not passed when
144145
calling ``catch_discover_tests``. This provides a mechanism for globally selecting
145146
a preferred test discovery behavior without having to modify each call site.
147+
148+
``SKIP_IS_FAILURE``
149+
Disables skipped test detection.
146150
147151
#]=======================================================================]
148152

@@ -151,7 +155,7 @@ function(catch_discover_tests TARGET)
151155

152156
cmake_parse_arguments(
153157
""
154-
""
158+
"SKIP_IS_FAILURE"
155159
"TEST_PREFIX;TEST_SUFFIX;WORKING_DIRECTORY;TEST_LIST;REPORTER;OUTPUT_DIR;OUTPUT_PREFIX;OUTPUT_SUFFIX;DISCOVERY_MODE"
156160
"TEST_SPEC;EXTRA_ARGS;PROPERTIES;DL_PATHS;DL_FRAMEWORK_PATHS"
157161
${ARGN}
@@ -192,6 +196,9 @@ function(catch_discover_tests TARGET)
192196
TARGET ${TARGET}
193197
PROPERTY CROSSCOMPILING_EMULATOR
194198
)
199+
if (NOT _SKIP_IS_FAILURE)
200+
set(_PROPERTIES ${_PROPERTIES} SKIP_RETURN_CODE 4)
201+
endif()
195202

196203
if(_DISCOVERY_MODE STREQUAL "POST_BUILD")
197204
add_custom_command(

0 commit comments

Comments
 (0)