| 1 |
tribits_add_test( c_util |
| 2 |
NOEXEPREFIX NOEXESUFFIX |
| 3 |
DIRECTORY ../ |
| 4 |
NAME test_of_c_util |
| 5 |
NUM_MPI_PROCS 1 |
| 6 |
PASS_REGULAR_EXPRESSION |
| 7 |
"Called c_util: B ${EXPECTED_B_DEPS} ${EXPECTED_A_AND_DEPS}" |
| 8 |
ADDED_TESTS_NAMES_OUT c_util_TEST_NAME |
| 9 |
) |
| 10 |
|
| 11 |
tribits_verbose_print_var(c_util_TEST_NAME) |
| 12 |
|
| 13 |
# Example of how to set properties on added test |
| 14 |
if (c_util_TEST_NAME) |
| 15 |
set_tests_properties( ${c_util_TEST_NAME} PROPERTIES TIMEOUT 15.0 ) |
| 16 |
# NOTE: You don't have to set the TIMEOUT separately. You can pass it into |
| 17 |
# tribits_add_tet(). |
| 18 |
endif() |
| 19 |
|
| 20 |
tribits_add_executable( c_test SOURCES c_test.cpp ) |
| 21 |
|
| 22 |
tribits_add_advanced_test( test_of_c |
| 23 |
OVERALL_NUM_MPI_PROCS 1 |
| 24 |
TEST_0 EXEC c_test |
| 25 |
PASS_REGULAR_EXPRESSION_ALL |
| 26 |
"A label is: A" |
| 27 |
"B label is: B" |
| 28 |
"C label is: C" |
| 29 |
"C deps are: B A" |
| 30 |
) |
| 31 |
|
| 32 |
|
| 33 |
# |
| 34 |
# Define a test-only lib and two tests that use it. |
| 35 |
# |
| 36 |
|
| 37 |
assert_defined(WithSubpackagesB_ENABLE_MixedLang) |
| 38 |
if (WithSubpackagesB_ENABLE_MixedLang AND |
| 39 |
(WithSubpackagesB_ENABLE_TESTS OR WithSubpackages_ENABLE_TESTS) |
| 40 |
) |
| 41 |
|
| 42 |
# Use a TESTONLY lib b_mixed_lang from WithSubpackagesB to define a TESTONLY |
| 43 |
# here! It is not recommended to share test libraries between package but |
| 44 |
# this example shows it can be done. |
| 45 |
|
| 46 |
tribits_add_library( c_b_mixed_lang |
| 47 |
TESTONLY |
| 48 |
SOURCES c_b_mixed_lang.cpp |
| 49 |
HEADERS c_b_mixed_lang.hpp |
| 50 |
DEPLIBS pws_c b_mixed_lang |
| 51 |
) |
| 52 |
|
| 53 |
tribits_add_executable_and_test( test_of_c_b_mixed_lang |
| 54 |
SOURCES test_of_c_b_mixed_lang.cpp |
| 55 |
TESTONLYLIBS c_b_mixed_lang |
| 56 |
NUM_MPI_PROCS 1 |
| 57 |
PASS_REGULAR_EXPRESSION |
| 58 |
"B ${EXPECTED_B_DEPS} ${EXPECTED_A_AND_DEPS} B Mixed Language" |
| 59 |
ADDED_EXE_TARGET_NAME_OUT test_of_c_b_mixed_lang_TARGET_NAME |
| 60 |
ADDED_TESTS_NAMES_OUT test_of_c_b_mixed_lang_TEST_NAME |
| 61 |
) |
| 62 |
|
| 63 |
tribits_verbose_print_var(test_of_c_b_mixed_lang_TARGET_NAME) |
| 64 |
tribits_verbose_print_var(test_of_c_b_mixed_lang_TEST_NAME) |
| 65 |
|
| 66 |
# Example on how to set exe target properties. |
| 67 |
set_target_properties( ${test_of_c_b_mixed_lang_TARGET_NAME} |
| 68 |
PROPERTIES LINKER_LANGUAGE CXX ) |
| 69 |
# NOTE: You don't have to set the LINKER_LANGUAGE |
| 70 |
|
| 71 |
if (test_of_c_b_mixed_lang_TEST_NAME) |
| 72 |
set_tests_properties( ${test_of_c_b_mixed_lang_TEST_NAME} |
| 73 |
PROPERTIES TIMEOUT 3.0 ) |
| 74 |
# NOTE: You don't have to set the TIMEOUT. |
| 75 |
endif() |
| 76 |
|
| 77 |
endif() |