From 1b636b43d2bf4dca0332a2e2b36affa67fbe1e0b Mon Sep 17 00:00:00 2001 From: Alex Merry Date: Mon, 11 May 2015 13:56:28 +0100 Subject: Add unit tests for ECMAddTests module. REVIEW: 123722 --- tests/ECMAddTests/multi_tests/CMakeLists.txt | 142 +++++++++++++++++++++++++++ tests/ECMAddTests/multi_tests/test1.cpp | 8 ++ tests/ECMAddTests/multi_tests/test2.cpp | 8 ++ tests/ECMAddTests/multi_tests/test3.cpp | 8 ++ tests/ECMAddTests/multi_tests/test4.cpp | 8 ++ tests/ECMAddTests/multi_tests/test5.cpp | 8 ++ tests/ECMAddTests/multi_tests/test6.cpp | 8 ++ tests/ECMAddTests/multi_tests/test7.cpp | 8 ++ tests/ECMAddTests/multi_tests/test8.cpp | 8 ++ tests/ECMAddTests/multi_tests/test9.cpp | 8 ++ 10 files changed, 214 insertions(+) create mode 100644 tests/ECMAddTests/multi_tests/CMakeLists.txt create mode 100644 tests/ECMAddTests/multi_tests/test1.cpp create mode 100644 tests/ECMAddTests/multi_tests/test2.cpp create mode 100644 tests/ECMAddTests/multi_tests/test3.cpp create mode 100644 tests/ECMAddTests/multi_tests/test4.cpp create mode 100644 tests/ECMAddTests/multi_tests/test5.cpp create mode 100644 tests/ECMAddTests/multi_tests/test6.cpp create mode 100644 tests/ECMAddTests/multi_tests/test7.cpp create mode 100644 tests/ECMAddTests/multi_tests/test8.cpp create mode 100644 tests/ECMAddTests/multi_tests/test9.cpp (limited to 'tests/ECMAddTests/multi_tests') diff --git a/tests/ECMAddTests/multi_tests/CMakeLists.txt b/tests/ECMAddTests/multi_tests/CMakeLists.txt new file mode 100644 index 00000000..ca434773 --- /dev/null +++ b/tests/ECMAddTests/multi_tests/CMakeLists.txt @@ -0,0 +1,142 @@ +project(ECMAddTests) +cmake_minimum_required(VERSION 2.8.12) + +set(ECM_MODULE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../../modules) +set(CMAKE_MODULE_PATH "${ECM_MODULE_DIR}") + +add_library(testhelper STATIC ../testhelper.cpp) +target_include_directories(testhelper PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/..") + +enable_testing() + +include(ECMAddTests) + +# clean up to avoid false-positives from check_files.cmake +file(REMOVE + "${CMAKE_CURRENT_BINARY_DIR}/test1.txt" + "${CMAKE_CURRENT_BINARY_DIR}/test2.txt" + "${CMAKE_CURRENT_BINARY_DIR}/test3.txt" + "${CMAKE_CURRENT_BINARY_DIR}/test4.txt" + "${CMAKE_CURRENT_BINARY_DIR}/test5.txt" + "${CMAKE_CURRENT_BINARY_DIR}/test6.txt" + "${CMAKE_CURRENT_BINARY_DIR}/test7.txt" + "${CMAKE_CURRENT_BINARY_DIR}/test8.txt" + "${CMAKE_CURRENT_BINARY_DIR}/test9.txt" + ) + +ecm_add_tests( + test1.cpp + test2.cpp + test3.cpp + LINK_LIBRARIES testhelper + ) +# check targets exist +get_property(_dummy TARGET test1 PROPERTY TYPE) +get_property(_dummy TARGET test2 PROPERTY TYPE) +get_property(_dummy TARGET test3 PROPERTY TYPE) +# check tests exists +get_property(_dummy TEST test1 PROPERTY TIMEOUT) +get_property(_dummy TEST test2 PROPERTY TIMEOUT) +get_property(_dummy TEST test3 PROPERTY TIMEOUT) +get_property(_is_win32 TARGET test1 PROPERTY WIN32_EXECUTABLE) +if (_is_win32) + message(FATAL_ERROR "test1 is a WIN32 executable when it should not be") +endif() +get_property(_is_bundle TARGET test1 PROPERTY MACOSX_BUNDLE) +if (_is_bundle) + message(FATAL_ERROR "test1 is an OS/X bundle when it should not be") +endif() +get_property(_is_win32 TARGET test2 PROPERTY WIN32_EXECUTABLE) +if (_is_win32) + message(FATAL_ERROR "test2 is a WIN32 executable when it should not be") +endif() +get_property(_is_bundle TARGET test2 PROPERTY MACOSX_BUNDLE) +if (_is_bundle) + message(FATAL_ERROR "test2 is an OS/X bundle when it should not be") +endif() + + +ecm_add_tests( + test4.cpp + test5.cpp + LINK_LIBRARIES testhelper + NAME_PREFIX pref_ + ) +get_property(_dummy TARGET test4 PROPERTY TYPE) +get_property(_dummy TARGET test5 PROPERTY TYPE) +get_property(_dummy TEST pref_test4 PROPERTY TIMEOUT) +get_property(_dummy TEST pref_test5 PROPERTY TIMEOUT) +get_property(_is_win32 TARGET test4 PROPERTY WIN32_EXECUTABLE) +if (_is_win32) + message(FATAL_ERROR "test4 is a WIN32 executable when it should not be") +endif() +get_property(_is_bundle TARGET test4 PROPERTY MACOSX_BUNDLE) +if (_is_bundle) + message(FATAL_ERROR "test4 is an OS/X bundle when it should not be") +endif() +get_property(_is_win32 TARGET test5 PROPERTY WIN32_EXECUTABLE) +if (_is_win32) + message(FATAL_ERROR "test5 is a WIN32 executable when it should not be") +endif() +get_property(_is_bundle TARGET test5 PROPERTY MACOSX_BUNDLE) +if (_is_bundle) + message(FATAL_ERROR "test5 is an OS/X bundle when it should not be") +endif() + + +ecm_add_tests( + test6.cpp + test7.cpp + LINK_LIBRARIES testhelper + GUI + ) +get_property(_dummy TARGET test6 PROPERTY TYPE) +get_property(_dummy TARGET test7 PROPERTY TYPE) +get_property(_dummy TEST test6 PROPERTY TIMEOUT) +get_property(_dummy TEST test7 PROPERTY TIMEOUT) +get_property(_is_win32 TARGET test6 PROPERTY WIN32_EXECUTABLE) +if (NOT _is_win32) + message(FATAL_ERROR "test6 is not a WIN32 executable when it should be") +endif() +get_property(_is_bundle TARGET test6 PROPERTY MACOSX_BUNDLE) +if (NOT _is_bundle) + message(FATAL_ERROR "test6 is not an OS/X bundle when it should be") +endif() +get_property(_is_win32 TARGET test7 PROPERTY WIN32_EXECUTABLE) +if (NOT _is_win32) + message(FATAL_ERROR "test7 is not a WIN32 executable when it should be") +endif() +get_property(_is_bundle TARGET test7 PROPERTY MACOSX_BUNDLE) +if (NOT _is_bundle) + message(FATAL_ERROR "test7 is not an OS/X bundle when it should be") +endif() + + +ecm_add_tests( + test8.cpp + test9.cpp + LINK_LIBRARIES testhelper + NAME_PREFIX p_ + GUI + ) +get_property(_dummy TARGET test8 PROPERTY TYPE) +get_property(_dummy TARGET test9 PROPERTY TYPE) +get_property(_dummy TEST p_test8 PROPERTY TIMEOUT) +get_property(_dummy TEST p_test9 PROPERTY TIMEOUT) +get_property(_is_win32 TARGET test8 PROPERTY WIN32_EXECUTABLE) +if (NOT _is_win32) + message(FATAL_ERROR "test8 is not a WIN32 executable when it should be") +endif() +get_property(_is_bundle TARGET test8 PROPERTY MACOSX_BUNDLE) +if (NOT _is_bundle) + message(FATAL_ERROR "test8 is not an OS/X bundle when it should be") +endif() +get_property(_is_win32 TARGET test9 PROPERTY WIN32_EXECUTABLE) +if (NOT _is_win32) + message(FATAL_ERROR "test9 is not a WIN32 executable when it should be") +endif() +get_property(_is_bundle TARGET test9 PROPERTY MACOSX_BUNDLE) +if (NOT _is_bundle) + message(FATAL_ERROR "test9 is not an OS/X bundle when it should be") +endif() + diff --git a/tests/ECMAddTests/multi_tests/test1.cpp b/tests/ECMAddTests/multi_tests/test1.cpp new file mode 100644 index 00000000..e5482865 --- /dev/null +++ b/tests/ECMAddTests/multi_tests/test1.cpp @@ -0,0 +1,8 @@ +#include "testhelper.h" + +int main() +{ + make_test_file("test1.txt"); + return 0; +} + diff --git a/tests/ECMAddTests/multi_tests/test2.cpp b/tests/ECMAddTests/multi_tests/test2.cpp new file mode 100644 index 00000000..7f45bb56 --- /dev/null +++ b/tests/ECMAddTests/multi_tests/test2.cpp @@ -0,0 +1,8 @@ +#include "testhelper.h" + +int main() +{ + make_test_file("test2.txt"); + return 0; +} + diff --git a/tests/ECMAddTests/multi_tests/test3.cpp b/tests/ECMAddTests/multi_tests/test3.cpp new file mode 100644 index 00000000..142b2765 --- /dev/null +++ b/tests/ECMAddTests/multi_tests/test3.cpp @@ -0,0 +1,8 @@ +#include "testhelper.h" + +int main() +{ + make_test_file("test3.txt"); + return 0; +} + diff --git a/tests/ECMAddTests/multi_tests/test4.cpp b/tests/ECMAddTests/multi_tests/test4.cpp new file mode 100644 index 00000000..1ba9b148 --- /dev/null +++ b/tests/ECMAddTests/multi_tests/test4.cpp @@ -0,0 +1,8 @@ +#include "testhelper.h" + +int main() +{ + make_test_file("test4.txt"); + return 0; +} + diff --git a/tests/ECMAddTests/multi_tests/test5.cpp b/tests/ECMAddTests/multi_tests/test5.cpp new file mode 100644 index 00000000..987af36b --- /dev/null +++ b/tests/ECMAddTests/multi_tests/test5.cpp @@ -0,0 +1,8 @@ +#include "testhelper.h" + +int main() +{ + make_test_file("test5.txt"); + return 0; +} + diff --git a/tests/ECMAddTests/multi_tests/test6.cpp b/tests/ECMAddTests/multi_tests/test6.cpp new file mode 100644 index 00000000..6bda9f0d --- /dev/null +++ b/tests/ECMAddTests/multi_tests/test6.cpp @@ -0,0 +1,8 @@ +#include "testhelper.h" + +int main() +{ + make_test_file("test6.txt"); + return 0; +} + diff --git a/tests/ECMAddTests/multi_tests/test7.cpp b/tests/ECMAddTests/multi_tests/test7.cpp new file mode 100644 index 00000000..069859e7 --- /dev/null +++ b/tests/ECMAddTests/multi_tests/test7.cpp @@ -0,0 +1,8 @@ +#include "testhelper.h" + +int main() +{ + make_test_file("test7.txt"); + return 0; +} + diff --git a/tests/ECMAddTests/multi_tests/test8.cpp b/tests/ECMAddTests/multi_tests/test8.cpp new file mode 100644 index 00000000..ce762c8d --- /dev/null +++ b/tests/ECMAddTests/multi_tests/test8.cpp @@ -0,0 +1,8 @@ +#include "testhelper.h" + +int main() +{ + make_test_file("test8.txt"); + return 0; +} + diff --git a/tests/ECMAddTests/multi_tests/test9.cpp b/tests/ECMAddTests/multi_tests/test9.cpp new file mode 100644 index 00000000..e432aeba --- /dev/null +++ b/tests/ECMAddTests/multi_tests/test9.cpp @@ -0,0 +1,8 @@ +#include "testhelper.h" + +int main() +{ + make_test_file("test9.txt"); + return 0; +} + -- cgit v1.2.1 From 0c224194ea7f12eaed32af746fc9138537f1919c Mon Sep 17 00:00:00 2001 From: Alex Merry Date: Mon, 11 May 2015 13:56:28 +0100 Subject: 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 --- tests/ECMAddTests/multi_tests/CMakeLists.txt | 96 ++++++++++++++++++++++------ tests/ECMAddTests/multi_tests/test10.cpp | 8 +++ tests/ECMAddTests/multi_tests/test11.cpp | 8 +++ 3 files changed, 92 insertions(+), 20 deletions(-) create mode 100644 tests/ECMAddTests/multi_tests/test10.cpp create mode 100644 tests/ECMAddTests/multi_tests/test11.cpp (limited to 'tests/ECMAddTests/multi_tests') diff --git a/tests/ECMAddTests/multi_tests/CMakeLists.txt b/tests/ECMAddTests/multi_tests/CMakeLists.txt index ca434773..bad625b5 100644 --- a/tests/ECMAddTests/multi_tests/CMakeLists.txt +++ b/tests/ECMAddTests/multi_tests/CMakeLists.txt @@ -22,6 +22,8 @@ file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/test7.txt" "${CMAKE_CURRENT_BINARY_DIR}/test8.txt" "${CMAKE_CURRENT_BINARY_DIR}/test9.txt" + "${CMAKE_CURRENT_BINARY_DIR}/test10.txt" + "${CMAKE_CURRENT_BINARY_DIR}/test11.txt" ) ecm_add_tests( @@ -30,14 +32,6 @@ ecm_add_tests( test3.cpp LINK_LIBRARIES testhelper ) -# check targets exist -get_property(_dummy TARGET test1 PROPERTY TYPE) -get_property(_dummy TARGET test2 PROPERTY TYPE) -get_property(_dummy TARGET test3 PROPERTY TYPE) -# check tests exists -get_property(_dummy TEST test1 PROPERTY TIMEOUT) -get_property(_dummy TEST test2 PROPERTY TIMEOUT) -get_property(_dummy TEST test3 PROPERTY TIMEOUT) get_property(_is_win32 TARGET test1 PROPERTY WIN32_EXECUTABLE) if (_is_win32) message(FATAL_ERROR "test1 is a WIN32 executable when it should not be") @@ -46,6 +40,9 @@ get_property(_is_bundle TARGET test1 PROPERTY MACOSX_BUNDLE) if (_is_bundle) message(FATAL_ERROR "test1 is an OS/X bundle when it should not be") endif() +# existence check +get_property(_dummy TEST test1 PROPERTY TIMEOUT) + get_property(_is_win32 TARGET test2 PROPERTY WIN32_EXECUTABLE) if (_is_win32) message(FATAL_ERROR "test2 is a WIN32 executable when it should not be") @@ -54,6 +51,17 @@ get_property(_is_bundle TARGET test2 PROPERTY MACOSX_BUNDLE) if (_is_bundle) message(FATAL_ERROR "test2 is an OS/X bundle when it should not be") endif() +get_property(_dummy TEST test2 PROPERTY TIMEOUT) + +get_property(_is_win32 TARGET test3 PROPERTY WIN32_EXECUTABLE) +if (_is_win32) + message(FATAL_ERROR "test3 is a WIN32 executable when it should not be") +endif() +get_property(_is_bundle TARGET test3 PROPERTY MACOSX_BUNDLE) +if (_is_bundle) + message(FATAL_ERROR "test3 is an OS/X bundle when it should not be") +endif() +get_property(_dummy TEST test3 PROPERTY TIMEOUT) ecm_add_tests( @@ -62,10 +70,6 @@ ecm_add_tests( LINK_LIBRARIES testhelper NAME_PREFIX pref_ ) -get_property(_dummy TARGET test4 PROPERTY TYPE) -get_property(_dummy TARGET test5 PROPERTY TYPE) -get_property(_dummy TEST pref_test4 PROPERTY TIMEOUT) -get_property(_dummy TEST pref_test5 PROPERTY TIMEOUT) get_property(_is_win32 TARGET test4 PROPERTY WIN32_EXECUTABLE) if (_is_win32) message(FATAL_ERROR "test4 is a WIN32 executable when it should not be") @@ -74,6 +78,8 @@ get_property(_is_bundle TARGET test4 PROPERTY MACOSX_BUNDLE) if (_is_bundle) message(FATAL_ERROR "test4 is an OS/X bundle when it should not be") endif() +get_property(_dummy TEST pref_test4 PROPERTY TIMEOUT) + get_property(_is_win32 TARGET test5 PROPERTY WIN32_EXECUTABLE) if (_is_win32) message(FATAL_ERROR "test5 is a WIN32 executable when it should not be") @@ -82,6 +88,7 @@ get_property(_is_bundle TARGET test5 PROPERTY MACOSX_BUNDLE) if (_is_bundle) message(FATAL_ERROR "test5 is an OS/X bundle when it should not be") endif() +get_property(_dummy TEST pref_test5 PROPERTY TIMEOUT) ecm_add_tests( @@ -90,10 +97,6 @@ ecm_add_tests( LINK_LIBRARIES testhelper GUI ) -get_property(_dummy TARGET test6 PROPERTY TYPE) -get_property(_dummy TARGET test7 PROPERTY TYPE) -get_property(_dummy TEST test6 PROPERTY TIMEOUT) -get_property(_dummy TEST test7 PROPERTY TIMEOUT) get_property(_is_win32 TARGET test6 PROPERTY WIN32_EXECUTABLE) if (NOT _is_win32) message(FATAL_ERROR "test6 is not a WIN32 executable when it should be") @@ -102,6 +105,8 @@ get_property(_is_bundle TARGET test6 PROPERTY MACOSX_BUNDLE) if (NOT _is_bundle) message(FATAL_ERROR "test6 is not an OS/X bundle when it should be") endif() +get_property(_dummy TEST test6 PROPERTY TIMEOUT) + get_property(_is_win32 TARGET test7 PROPERTY WIN32_EXECUTABLE) if (NOT _is_win32) message(FATAL_ERROR "test7 is not a WIN32 executable when it should be") @@ -110,6 +115,7 @@ get_property(_is_bundle TARGET test7 PROPERTY MACOSX_BUNDLE) if (NOT _is_bundle) message(FATAL_ERROR "test7 is not an OS/X bundle when it should be") endif() +get_property(_dummy TEST test7 PROPERTY TIMEOUT) ecm_add_tests( @@ -118,11 +124,9 @@ ecm_add_tests( LINK_LIBRARIES testhelper NAME_PREFIX p_ GUI + PROPERTIES + LABELS "somelabel" ) -get_property(_dummy TARGET test8 PROPERTY TYPE) -get_property(_dummy TARGET test9 PROPERTY TYPE) -get_property(_dummy TEST p_test8 PROPERTY TIMEOUT) -get_property(_dummy TEST p_test9 PROPERTY TIMEOUT) get_property(_is_win32 TARGET test8 PROPERTY WIN32_EXECUTABLE) if (NOT _is_win32) message(FATAL_ERROR "test8 is not a WIN32 executable when it should be") @@ -131,6 +135,11 @@ get_property(_is_bundle TARGET test8 PROPERTY MACOSX_BUNDLE) if (NOT _is_bundle) message(FATAL_ERROR "test8 is not an OS/X bundle when it should be") endif() +get_property(_labels TEST p_test8 PROPERTY LABELS) +if (NOT _labels STREQUAL "somelabel") + message(FATAL_ERROR "p_test8 LABELS property was \"${_labels}\", expected \"somelabel\"") +endif() + get_property(_is_win32 TARGET test9 PROPERTY WIN32_EXECUTABLE) if (NOT _is_win32) message(FATAL_ERROR "test9 is not a WIN32 executable when it should be") @@ -139,4 +148,51 @@ get_property(_is_bundle TARGET test9 PROPERTY MACOSX_BUNDLE) if (NOT _is_bundle) message(FATAL_ERROR "test9 is not an OS/X bundle when it should be") endif() +get_property(_labels TEST p_test9 PROPERTY LABELS) +if (NOT _labels STREQUAL "somelabel") + message(FATAL_ERROR "p_test9 LABELS property was \"${_labels}\", expected \"somelabel\"") +endif() + + +ecm_add_tests( + test10.cpp + test11.cpp + LINK_LIBRARIES testhelper + PROPERTIES + LABELS "somelabel" + RUN_SERIAL TRUE + ) +get_property(_is_win32 TARGET test10 PROPERTY WIN32_EXECUTABLE) +if (_is_win32) + message(FATAL_ERROR "test10 is a WIN32 executable when it should not be") +endif() +get_property(_is_bundle TARGET test10 PROPERTY MACOSX_BUNDLE) +if (_is_bundle) + message(FATAL_ERROR "test10 is an OS/X bundle when it should not be") +endif() +get_property(_labels TEST test10 PROPERTY LABELS) +if (NOT _labels STREQUAL "somelabel") + message(FATAL_ERROR "test10 LABELS property was \"${_labels}\", expected \"somelabel\"") +endif() +get_property(_run_serial TEST test10 PROPERTY RUN_SERIAL) +if (NOT _run_serial) + message(FATAL_ERROR "test10 LABELS property was \"${_run_serial}\", expected TRUE") +endif() + +get_property(_is_win32 TARGET test11 PROPERTY WIN32_EXECUTABLE) +if (_is_win32) + message(FATAL_ERROR "test11 is a WIN32 executable when it should not be") +endif() +get_property(_is_bundle TARGET test11 PROPERTY MACOSX_BUNDLE) +if (_is_bundle) + message(FATAL_ERROR "test11 is an OS/X bundle when it should not be") +endif() +get_property(_labels TEST test11 PROPERTY LABELS) +if (NOT _labels STREQUAL "somelabel") + message(FATAL_ERROR "test11 LABELS property was \"${_labels}\", expected \"somelabel\"") +endif() +get_property(_run_serial TEST test11 PROPERTY RUN_SERIAL) +if (NOT _run_serial) + message(FATAL_ERROR "test11 LABELS property was \"${_run_serial}\", expected TRUE") +endif() diff --git a/tests/ECMAddTests/multi_tests/test10.cpp b/tests/ECMAddTests/multi_tests/test10.cpp new file mode 100644 index 00000000..a34a39df --- /dev/null +++ b/tests/ECMAddTests/multi_tests/test10.cpp @@ -0,0 +1,8 @@ +#include "testhelper.h" + +int main() +{ + make_test_file("test10.txt"); + return 0; +} + diff --git a/tests/ECMAddTests/multi_tests/test11.cpp b/tests/ECMAddTests/multi_tests/test11.cpp new file mode 100644 index 00000000..82641bbc --- /dev/null +++ b/tests/ECMAddTests/multi_tests/test11.cpp @@ -0,0 +1,8 @@ +#include "testhelper.h" + +int main() +{ + make_test_file("test11.txt"); + return 0; +} + -- cgit v1.2.1 From 70b13693478b296b8a3cd1654baa8013434358c5 Mon Sep 17 00:00:00 2001 From: Alex Merry Date: Sat, 16 May 2015 14:06:34 +0100 Subject: Revert "Add PROPERTIES argument to ecm_add_test and ecm_add_tests." This reverts commit 0c224194ea7f12eaed32af746fc9138537f1919c. Stephen Kelly pointed out that this is probably not the best approach to the problem, and runs counter to the direction KDE's CMake code has been going (splitting functions up and using CMake built-ins where possible). I have a better solution in mind, which I'll post a review for later. CCMAIL: kde-buildsystem@kde.org CCBUG: 345797 --- tests/ECMAddTests/multi_tests/CMakeLists.txt | 96 ++++++---------------------- tests/ECMAddTests/multi_tests/test10.cpp | 8 --- tests/ECMAddTests/multi_tests/test11.cpp | 8 --- 3 files changed, 20 insertions(+), 92 deletions(-) delete mode 100644 tests/ECMAddTests/multi_tests/test10.cpp delete mode 100644 tests/ECMAddTests/multi_tests/test11.cpp (limited to 'tests/ECMAddTests/multi_tests') diff --git a/tests/ECMAddTests/multi_tests/CMakeLists.txt b/tests/ECMAddTests/multi_tests/CMakeLists.txt index bad625b5..ca434773 100644 --- a/tests/ECMAddTests/multi_tests/CMakeLists.txt +++ b/tests/ECMAddTests/multi_tests/CMakeLists.txt @@ -22,8 +22,6 @@ file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/test7.txt" "${CMAKE_CURRENT_BINARY_DIR}/test8.txt" "${CMAKE_CURRENT_BINARY_DIR}/test9.txt" - "${CMAKE_CURRENT_BINARY_DIR}/test10.txt" - "${CMAKE_CURRENT_BINARY_DIR}/test11.txt" ) ecm_add_tests( @@ -32,6 +30,14 @@ ecm_add_tests( test3.cpp LINK_LIBRARIES testhelper ) +# check targets exist +get_property(_dummy TARGET test1 PROPERTY TYPE) +get_property(_dummy TARGET test2 PROPERTY TYPE) +get_property(_dummy TARGET test3 PROPERTY TYPE) +# check tests exists +get_property(_dummy TEST test1 PROPERTY TIMEOUT) +get_property(_dummy TEST test2 PROPERTY TIMEOUT) +get_property(_dummy TEST test3 PROPERTY TIMEOUT) get_property(_is_win32 TARGET test1 PROPERTY WIN32_EXECUTABLE) if (_is_win32) message(FATAL_ERROR "test1 is a WIN32 executable when it should not be") @@ -40,9 +46,6 @@ get_property(_is_bundle TARGET test1 PROPERTY MACOSX_BUNDLE) if (_is_bundle) message(FATAL_ERROR "test1 is an OS/X bundle when it should not be") endif() -# existence check -get_property(_dummy TEST test1 PROPERTY TIMEOUT) - get_property(_is_win32 TARGET test2 PROPERTY WIN32_EXECUTABLE) if (_is_win32) message(FATAL_ERROR "test2 is a WIN32 executable when it should not be") @@ -51,17 +54,6 @@ get_property(_is_bundle TARGET test2 PROPERTY MACOSX_BUNDLE) if (_is_bundle) message(FATAL_ERROR "test2 is an OS/X bundle when it should not be") endif() -get_property(_dummy TEST test2 PROPERTY TIMEOUT) - -get_property(_is_win32 TARGET test3 PROPERTY WIN32_EXECUTABLE) -if (_is_win32) - message(FATAL_ERROR "test3 is a WIN32 executable when it should not be") -endif() -get_property(_is_bundle TARGET test3 PROPERTY MACOSX_BUNDLE) -if (_is_bundle) - message(FATAL_ERROR "test3 is an OS/X bundle when it should not be") -endif() -get_property(_dummy TEST test3 PROPERTY TIMEOUT) ecm_add_tests( @@ -70,6 +62,10 @@ ecm_add_tests( LINK_LIBRARIES testhelper NAME_PREFIX pref_ ) +get_property(_dummy TARGET test4 PROPERTY TYPE) +get_property(_dummy TARGET test5 PROPERTY TYPE) +get_property(_dummy TEST pref_test4 PROPERTY TIMEOUT) +get_property(_dummy TEST pref_test5 PROPERTY TIMEOUT) get_property(_is_win32 TARGET test4 PROPERTY WIN32_EXECUTABLE) if (_is_win32) message(FATAL_ERROR "test4 is a WIN32 executable when it should not be") @@ -78,8 +74,6 @@ get_property(_is_bundle TARGET test4 PROPERTY MACOSX_BUNDLE) if (_is_bundle) message(FATAL_ERROR "test4 is an OS/X bundle when it should not be") endif() -get_property(_dummy TEST pref_test4 PROPERTY TIMEOUT) - get_property(_is_win32 TARGET test5 PROPERTY WIN32_EXECUTABLE) if (_is_win32) message(FATAL_ERROR "test5 is a WIN32 executable when it should not be") @@ -88,7 +82,6 @@ get_property(_is_bundle TARGET test5 PROPERTY MACOSX_BUNDLE) if (_is_bundle) message(FATAL_ERROR "test5 is an OS/X bundle when it should not be") endif() -get_property(_dummy TEST pref_test5 PROPERTY TIMEOUT) ecm_add_tests( @@ -97,6 +90,10 @@ ecm_add_tests( LINK_LIBRARIES testhelper GUI ) +get_property(_dummy TARGET test6 PROPERTY TYPE) +get_property(_dummy TARGET test7 PROPERTY TYPE) +get_property(_dummy TEST test6 PROPERTY TIMEOUT) +get_property(_dummy TEST test7 PROPERTY TIMEOUT) get_property(_is_win32 TARGET test6 PROPERTY WIN32_EXECUTABLE) if (NOT _is_win32) message(FATAL_ERROR "test6 is not a WIN32 executable when it should be") @@ -105,8 +102,6 @@ get_property(_is_bundle TARGET test6 PROPERTY MACOSX_BUNDLE) if (NOT _is_bundle) message(FATAL_ERROR "test6 is not an OS/X bundle when it should be") endif() -get_property(_dummy TEST test6 PROPERTY TIMEOUT) - get_property(_is_win32 TARGET test7 PROPERTY WIN32_EXECUTABLE) if (NOT _is_win32) message(FATAL_ERROR "test7 is not a WIN32 executable when it should be") @@ -115,7 +110,6 @@ get_property(_is_bundle TARGET test7 PROPERTY MACOSX_BUNDLE) if (NOT _is_bundle) message(FATAL_ERROR "test7 is not an OS/X bundle when it should be") endif() -get_property(_dummy TEST test7 PROPERTY TIMEOUT) ecm_add_tests( @@ -124,9 +118,11 @@ ecm_add_tests( LINK_LIBRARIES testhelper NAME_PREFIX p_ GUI - PROPERTIES - LABELS "somelabel" ) +get_property(_dummy TARGET test8 PROPERTY TYPE) +get_property(_dummy TARGET test9 PROPERTY TYPE) +get_property(_dummy TEST p_test8 PROPERTY TIMEOUT) +get_property(_dummy TEST p_test9 PROPERTY TIMEOUT) get_property(_is_win32 TARGET test8 PROPERTY WIN32_EXECUTABLE) if (NOT _is_win32) message(FATAL_ERROR "test8 is not a WIN32 executable when it should be") @@ -135,11 +131,6 @@ get_property(_is_bundle TARGET test8 PROPERTY MACOSX_BUNDLE) if (NOT _is_bundle) message(FATAL_ERROR "test8 is not an OS/X bundle when it should be") endif() -get_property(_labels TEST p_test8 PROPERTY LABELS) -if (NOT _labels STREQUAL "somelabel") - message(FATAL_ERROR "p_test8 LABELS property was \"${_labels}\", expected \"somelabel\"") -endif() - get_property(_is_win32 TARGET test9 PROPERTY WIN32_EXECUTABLE) if (NOT _is_win32) message(FATAL_ERROR "test9 is not a WIN32 executable when it should be") @@ -148,51 +139,4 @@ get_property(_is_bundle TARGET test9 PROPERTY MACOSX_BUNDLE) if (NOT _is_bundle) message(FATAL_ERROR "test9 is not an OS/X bundle when it should be") endif() -get_property(_labels TEST p_test9 PROPERTY LABELS) -if (NOT _labels STREQUAL "somelabel") - message(FATAL_ERROR "p_test9 LABELS property was \"${_labels}\", expected \"somelabel\"") -endif() - - -ecm_add_tests( - test10.cpp - test11.cpp - LINK_LIBRARIES testhelper - PROPERTIES - LABELS "somelabel" - RUN_SERIAL TRUE - ) -get_property(_is_win32 TARGET test10 PROPERTY WIN32_EXECUTABLE) -if (_is_win32) - message(FATAL_ERROR "test10 is a WIN32 executable when it should not be") -endif() -get_property(_is_bundle TARGET test10 PROPERTY MACOSX_BUNDLE) -if (_is_bundle) - message(FATAL_ERROR "test10 is an OS/X bundle when it should not be") -endif() -get_property(_labels TEST test10 PROPERTY LABELS) -if (NOT _labels STREQUAL "somelabel") - message(FATAL_ERROR "test10 LABELS property was \"${_labels}\", expected \"somelabel\"") -endif() -get_property(_run_serial TEST test10 PROPERTY RUN_SERIAL) -if (NOT _run_serial) - message(FATAL_ERROR "test10 LABELS property was \"${_run_serial}\", expected TRUE") -endif() - -get_property(_is_win32 TARGET test11 PROPERTY WIN32_EXECUTABLE) -if (_is_win32) - message(FATAL_ERROR "test11 is a WIN32 executable when it should not be") -endif() -get_property(_is_bundle TARGET test11 PROPERTY MACOSX_BUNDLE) -if (_is_bundle) - message(FATAL_ERROR "test11 is an OS/X bundle when it should not be") -endif() -get_property(_labels TEST test11 PROPERTY LABELS) -if (NOT _labels STREQUAL "somelabel") - message(FATAL_ERROR "test11 LABELS property was \"${_labels}\", expected \"somelabel\"") -endif() -get_property(_run_serial TEST test11 PROPERTY RUN_SERIAL) -if (NOT _run_serial) - message(FATAL_ERROR "test11 LABELS property was \"${_run_serial}\", expected TRUE") -endif() diff --git a/tests/ECMAddTests/multi_tests/test10.cpp b/tests/ECMAddTests/multi_tests/test10.cpp deleted file mode 100644 index a34a39df..00000000 --- a/tests/ECMAddTests/multi_tests/test10.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include "testhelper.h" - -int main() -{ - make_test_file("test10.txt"); - return 0; -} - diff --git a/tests/ECMAddTests/multi_tests/test11.cpp b/tests/ECMAddTests/multi_tests/test11.cpp deleted file mode 100644 index 82641bbc..00000000 --- a/tests/ECMAddTests/multi_tests/test11.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include "testhelper.h" - -int main() -{ - make_test_file("test11.txt"); - return 0; -} - -- cgit v1.2.1 From be390dcc4d77d7faa95d040b1a346ac3c0405eac Mon Sep 17 00:00:00 2001 From: Alex Merry Date: Mon, 18 May 2015 19:12:06 +0100 Subject: Add arguments to ecm_add_tests for listing added tests. This makes it convenient to make further modifications to the tests, such as setting properties on either the tests or the targets. CHANGELOG: New arguments for ecm_add_tests(). BUG: 345797 REVIEW: 123841 --- tests/ECMAddTests/multi_tests/CMakeLists.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'tests/ECMAddTests/multi_tests') diff --git a/tests/ECMAddTests/multi_tests/CMakeLists.txt b/tests/ECMAddTests/multi_tests/CMakeLists.txt index ca434773..0133c7d6 100644 --- a/tests/ECMAddTests/multi_tests/CMakeLists.txt +++ b/tests/ECMAddTests/multi_tests/CMakeLists.txt @@ -10,6 +10,7 @@ target_include_directories(testhelper PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/..") enable_testing() include(ECMAddTests) +include(../../test_helpers.cmake) # clean up to avoid false-positives from check_files.cmake file(REMOVE @@ -24,12 +25,18 @@ file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/test9.txt" ) +set(exp_target_names "test1;test2;test3") +set(exp_test_names "test1;test2;test3") ecm_add_tests( test1.cpp test2.cpp test3.cpp LINK_LIBRARIES testhelper + TARGET_NAMES_VAR target_names + TEST_NAMES_VAR test_names ) +assert_vars_setequal(target_names exp_target_names) +assert_vars_setequal(test_names exp_test_names) # check targets exist get_property(_dummy TARGET test1 PROPERTY TYPE) get_property(_dummy TARGET test2 PROPERTY TYPE) @@ -112,13 +119,19 @@ if (NOT _is_bundle) endif() +set(exp_target_names "test8;test9") +set(exp_test_names "p_test8;p_test9") ecm_add_tests( test8.cpp test9.cpp LINK_LIBRARIES testhelper NAME_PREFIX p_ GUI + TARGET_NAMES_VAR target_names + TEST_NAMES_VAR test_names ) +assert_vars_setequal(target_names exp_target_names) +assert_vars_setequal(test_names exp_test_names) get_property(_dummy TARGET test8 PROPERTY TYPE) get_property(_dummy TARGET test9 PROPERTY TYPE) get_property(_dummy TEST p_test8 PROPERTY TIMEOUT) -- cgit v1.2.1