diff options
| author | Alex Merry <alex.merry@kde.org> | 2015-05-11 13:56:28 +0100 | 
|---|---|---|
| committer | Alex Merry <alex.merry@kde.org> | 2015-05-13 19:22:25 +0100 | 
| commit | 0c224194ea7f12eaed32af746fc9138537f1919c (patch) | |
| tree | acd667f840cc3db01152120505b351d84b496098 /tests/ECMAddTests/single_tests | |
| parent | 1b636b43d2bf4dca0332a2e2b36affa67fbe1e0b (diff) | |
| download | extra-cmake-modules-0c224194ea7f12eaed32af746fc9138537f1919c.tar.gz extra-cmake-modules-0c224194ea7f12eaed32af746fc9138537f1919c.tar.bz2 | |
Add PROPERTIES argument to ecm_add_test and ecm_add_tests.
This is particularly useful with ecm_add_tests, where you may want to
force a suite of tests to run in serial, or alter the timeout for
multiple tests at once.
BUG: 345797
REVIEW: 123722
Diffstat (limited to 'tests/ECMAddTests/single_tests')
| -rw-r--r-- | tests/ECMAddTests/single_tests/CMakeLists.txt | 39 | ||||
| -rw-r--r-- | tests/ECMAddTests/single_tests/test7.cpp | 8 | 
2 files changed, 39 insertions, 8 deletions
| diff --git a/tests/ECMAddTests/single_tests/CMakeLists.txt b/tests/ECMAddTests/single_tests/CMakeLists.txt index 6af3857b..de1ae6f6 100644 --- a/tests/ECMAddTests/single_tests/CMakeLists.txt +++ b/tests/ECMAddTests/single_tests/CMakeLists.txt @@ -19,13 +19,12 @@ file(REMOVE      "${CMAKE_CURRENT_BINARY_DIR}/test4.txt"      "${CMAKE_CURRENT_BINARY_DIR}/test5.txt"      "${CMAKE_CURRENT_BINARY_DIR}/test6.txt" +    "${CMAKE_CURRENT_BINARY_DIR}/test7.txt"      )  ecm_add_test(test1.cpp      LINK_LIBRARIES testhelper      ) -# check target exists -get_property(_dummy TARGET test1 PROPERTY TYPE)  # check test exists  get_property(_dummy TEST test1 PROPERTY TIMEOUT)  get_property(_is_win32 TARGET test1 PROPERTY WIN32_EXECUTABLE) @@ -42,7 +41,6 @@ ecm_add_test(test2.cpp      LINK_LIBRARIES testhelper      TEST_NAME named_test      ) -get_property(_dummy TARGET named_test PROPERTY TYPE)  get_property(_dummy TEST named_test PROPERTY TIMEOUT)  get_property(_is_win32 TARGET named_test PROPERTY WIN32_EXECUTABLE)  if (_is_win32) @@ -58,7 +56,6 @@ ecm_add_test(test3.cpp      LINK_LIBRARIES testhelper      NAME_PREFIX prefix_      ) -get_property(_dummy TARGET test3 PROPERTY TYPE)  get_property(_dummy TEST prefix_test3 PROPERTY TIMEOUT)  get_property(_is_win32 TARGET test3 PROPERTY WIN32_EXECUTABLE)  if (_is_win32) @@ -74,7 +71,6 @@ ecm_add_test(test4.cpp      LINK_LIBRARIES testhelper      GUI      ) -get_property(_dummy TARGET test4 PROPERTY TYPE)  get_property(_dummy TEST test4 PROPERTY TIMEOUT)  get_property(_is_win32 TARGET test4 PROPERTY WIN32_EXECUTABLE)  if (NOT _is_win32) @@ -91,9 +87,10 @@ ecm_add_test(test5.cpp      TEST_NAME combined_test      NAME_PREFIX another_prefix_      GUI +    PROPERTIES +        LABELS "lab" +        RUN_SERIAL TRUE      ) -get_property(_dummy TARGET combined_test PROPERTY TYPE) -get_property(_dummy TEST another_prefix_combined_test PROPERTY TIMEOUT)  get_property(_is_win32 TARGET combined_test PROPERTY WIN32_EXECUTABLE)  if (NOT _is_win32)      message(FATAL_ERROR "combined_test is not a WIN32 executable when it should be") @@ -102,13 +99,20 @@ get_property(_is_bundle TARGET combined_test PROPERTY MACOSX_BUNDLE)  if (NOT _is_bundle)      message(FATAL_ERROR "combined_test is not an OS/X bundle when it should be")  endif() +get_property(_labels TEST another_prefix_combined_test PROPERTY LABELS) +if (NOT _labels STREQUAL "lab") +    message(FATAL_ERROR "another_prefix_combined_test LABELS property was \"${_labels}\", expected \"lab\"") +endif() +get_property(_run_serial TEST another_prefix_combined_test PROPERTY RUN_SERIAL) +if (NOT _run_serial) +    message(FATAL_ERROR "another_prefix_combined_test LABELS property was \"${_run_serial}\", expected TRUE") +endif()  ecm_add_test(test6.cpp test6body.cpp      LINK_LIBRARIES testhelper      TEST_NAME multifile_test      ) -get_property(_dummy TARGET multifile_test PROPERTY TYPE)  get_property(_dummy TEST multifile_test PROPERTY TIMEOUT)  get_property(_is_win32 TARGET multifile_test PROPERTY WIN32_EXECUTABLE)  if (_is_win32) @@ -120,3 +124,22 @@ if (_is_bundle)  endif() +ecm_add_test(test7.cpp +    LINK_LIBRARIES testhelper +    PROPERTIES +        LABELS "somelabel" +    ) +get_property(_dummy TEST test7 PROPERTY TIMEOUT) +get_property(_is_win32 TARGET test7 PROPERTY WIN32_EXECUTABLE) +if (_is_win32) +    message(FATAL_ERROR "test7 is a WIN32 executable when it should not be") +endif() +get_property(_is_bundle TARGET test7 PROPERTY MACOSX_BUNDLE) +if (_is_bundle) +    message(FATAL_ERROR "test7 is an OS/X bundle when it should not be") +endif() +get_property(_labels TEST test7 PROPERTY LABELS) +if (NOT _labels STREQUAL "somelabel") +    message(FATAL_ERROR "test7 LABELS property was \"${_labels}\", expected \"somelabel\"") +endif() + diff --git a/tests/ECMAddTests/single_tests/test7.cpp b/tests/ECMAddTests/single_tests/test7.cpp new file mode 100644 index 00000000..069859e7 --- /dev/null +++ b/tests/ECMAddTests/single_tests/test7.cpp @@ -0,0 +1,8 @@ +#include "testhelper.h" + +int main() +{ +    make_test_file("test7.txt"); +    return 0; +} + | 
