|
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> ...] ]
|
39 | 40 | # [ TEST_PROPERTIES <prop1> <val1> [<prop2> <val2> ...] ]
|
|
128 | 129 | # TEST_DEPENDS : optional
|
129 | 130 | # list of tests to be run before this one
|
130 | 131 | #
|
| 132 | +# TEST_REQUIRES : optional |
| 133 | +# list of tests that will automatically run before this one |
| 134 | +# |
131 | 135 | # CONDITION : optional
|
132 | 136 | # conditional expression which must evaluate to true for this target to be
|
133 | 137 | # built (must be valid in a CMake ``if`` statement)
|
@@ -187,7 +191,7 @@ function( ecbuild_add_test )
|
187 | 191 |
|
188 | 192 | set( options NO_AS_NEEDED )
|
189 | 193 | set( single_value_args TARGET ENABLED COMMAND TYPE LINKER_LANGUAGE MPI OMP WORKING_DIRECTORY )
|
190 |
| - 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 |
191 | 195 | PERSISTENT DEFINITIONS RESOURCES TEST_DATA CFLAGS
|
192 | 196 | CXXFLAGS FFLAGS GENERATED CONDITION TEST_PROPERTIES PROPERTIES ENVIRONMENT )
|
193 | 197 |
|
@@ -475,6 +479,15 @@ function( ecbuild_add_test )
|
475 | 479 | set_tests_properties( ${_PAR_TARGET} PROPERTIES ${_PAR_TEST_PROPERTIES} )
|
476 | 480 | endif()
|
477 | 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 | + |
478 | 491 | # get test data
|
479 | 492 |
|
480 | 493 | if( _PAR_TEST_DATA )
|
|
0 commit comments