|
34 | 34 | # [ GENERATED <file1> [<file2> ...] ]
|
35 | 35 | # [ DEPENDS <target1> [<target2> ...] ]
|
36 | 36 | # [ TEST_DEPENDS <target1> [<target2> ...] ]
|
| 37 | +# [ TEST_REQUIRES <target1> [<target2> ...] ] |
37 | 38 | # [ CONDITION <condition> ]
|
38 | 39 | # [ PROPERTIES <prop1> <val1> [<prop2> <val2> ...] ]
|
| 40 | +# [ TEST_PROPERTIES <prop1> <val1> [<prop2> <val2> ...] ] |
39 | 41 | # [ ENVIRONMENT <variable1> [<variable2> ...] ]
|
40 | 42 | # [ WORKING_DIRECTORY <path> ]
|
41 | 43 | # [ CFLAGS <flag1> [<flag2> ...] ]
|
|
127 | 129 | # TEST_DEPENDS : optional
|
128 | 130 | # list of tests to be run before this one
|
129 | 131 | #
|
| 132 | +# TEST_REQUIRES : optional |
| 133 | +# list of tests that will automatically run before this one |
| 134 | +# |
130 | 135 | # CONDITION : optional
|
131 | 136 | # conditional expression which must evaluate to true for this target to be
|
132 | 137 | # built (must be valid in a CMake ``if`` statement)
|
133 | 138 | #
|
134 | 139 | # PROPERTIES : optional
|
135 | 140 | # custom properties to set on the target
|
136 | 141 | #
|
| 142 | +# TEST_PROPERTIES : optional |
| 143 | +# custom properties to set on the test |
| 144 | +# |
137 | 145 | # ENVIRONMENT : optional
|
138 | 146 | # list of environment variables to set in the test environment
|
139 | 147 | #
|
@@ -183,9 +191,9 @@ function( ecbuild_add_test )
|
183 | 191 |
|
184 | 192 | set( options NO_AS_NEEDED )
|
185 | 193 | set( single_value_args TARGET ENABLED COMMAND TYPE LINKER_LANGUAGE MPI OMP WORKING_DIRECTORY )
|
186 |
| - set( multi_value_args SOURCES OBJECTS LIBS INCLUDES TEST_DEPENDS DEPENDS LABELS ARGS |
| 194 | + set( multi_value_args SOURCES OBJECTS LIBS INCLUDES TEST_DEPENDS DEPENDS TEST_REQUIRES LABELS ARGS |
187 | 195 | PERSISTENT DEFINITIONS RESOURCES TEST_DATA CFLAGS
|
188 |
| - CXXFLAGS FFLAGS GENERATED CONDITION PROPERTIES ENVIRONMENT ) |
| 196 | + CXXFLAGS FFLAGS GENERATED CONDITION TEST_PROPERTIES PROPERTIES ENVIRONMENT ) |
189 | 197 |
|
190 | 198 | cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} )
|
191 | 199 |
|
@@ -467,6 +475,19 @@ function( ecbuild_add_test )
|
467 | 475 | set_target_properties( ${_PAR_TARGET} PROPERTIES ${_PAR_PROPERTIES} )
|
468 | 476 | endif()
|
469 | 477 |
|
| 478 | + if( DEFINED _PAR_TEST_PROPERTIES ) |
| 479 | + set_tests_properties( ${_PAR_TARGET} PROPERTIES ${_PAR_TEST_PROPERTIES} ) |
| 480 | + endif() |
| 481 | + |
| 482 | + # Set the fictures properties if test requires another test to run before |
| 483 | + if ( DEFINED _PAR_TEST_REQUIRES ) |
| 484 | + ecbuild_debug("ecbuild_add_test(${_PAR_TARGET}): set test requirements to ${_PAR_TEST_REQUIRES}") |
| 485 | + foreach(_requirement ${_PAR_TEST_REQUIRES} ) |
| 486 | + set_tests_properties( ${_requirement} PROPERTIES FIXTURES_SETUP ${_requirement} ) |
| 487 | + endforeach() |
| 488 | + set_tests_properties( ${_PAR_TARGET} PROPERTIES FIXTURES_REQUIRED "${_PAR_TEST_REQUIRES}" ) |
| 489 | + endif() |
| 490 | + |
470 | 491 | # get test data
|
471 | 492 |
|
472 | 493 | if( _PAR_TEST_DATA )
|
|
0 commit comments