[extra-cmake-modules] /: Revert "Add PROPERTIES argument to ecm_add_test and ecm_add_tests."
Alex Merry
alex.merry at kde.org
Sat May 16 13:10:24 UTC 2015
Git commit 70b13693478b296b8a3cd1654baa8013434358c5 by Alex Merry.
Committed on 16/05/2015 at 13:09.
Pushed by alexmerry into branch 'master'.
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 at kde.org
CCBUG: 345797
M +4 -12 modules/ECMAddTests.cmake
M +0 -3 tests/ECMAddTests/CMakeLists.txt
M +20 -76 tests/ECMAddTests/multi_tests/CMakeLists.txt
D +0 -8 tests/ECMAddTests/multi_tests/test10.cpp
D +0 -8 tests/ECMAddTests/multi_tests/test11.cpp
M +8 -31 tests/ECMAddTests/single_tests/CMakeLists.txt
D +0 -8 tests/ECMAddTests/single_tests/test7.cpp
http://commits.kde.org/extra-cmake-modules/70b13693478b296b8a3cd1654baa8013434358c5
diff --git a/modules/ECMAddTests.cmake b/modules/ECMAddTests.cmake
index ee7e63e..bdb6069 100644
--- a/modules/ECMAddTests.cmake
+++ b/modules/ECMAddTests.cmake
@@ -9,8 +9,7 @@
# ecm_add_test(<sources> LINK_LIBRARIES <library> [<library> [...]]
# [TEST_NAME <name>]
# [NAME_PREFIX <prefix>]
-# [GUI]
-# [PROPERTIES <prop1> <value1> [<prop2> <value2> [...]]])
+# [GUI])
#
# Add a new unit test using the passed source files. The parameter TEST_NAME is
# used to set the name of the resulting test, and the target built for and run
@@ -28,8 +27,6 @@
# of CMAKE_WIN32_EXECUTABLE or CMAKE_MACOSX_BUNDLE). The test will be linked
# against the libraries and/or targets passed to LINK_LIBRARIES.
#
-# The PROPERTIES argument sets the given properties on the test.
-#
# The generated target executable will have the effects of ecm_mark_as_test()
# (from the :module:`ECMMarkAsTest` module) applied to it.
#
@@ -38,8 +35,7 @@
#
# ecm_add_tests(<sources> LINK_LIBRARIES <library> [<library> [...]]
# [NAME_PREFIX <prefix>]
-# [GUI]
-# [PROPERTIES <prop1> <value1> [<prop2> <value2> [...]]])
+# [GUI])
#
# This is a convenient version of ecm_add_test() for when you have many tests
# that consist of a single source file each. It behaves like calling
@@ -67,7 +63,7 @@ include(ECMMarkNonGuiExecutable)
function(ecm_add_test)
set(options GUI)
set(oneValueArgs TEST_NAME NAME_PREFIX)
- set(multiValueArgs LINK_LIBRARIES PROPERTIES)
+ set(multiValueArgs LINK_LIBRARIES)
cmake_parse_arguments(ECM_ADD_TEST "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
set(_sources ${ECM_ADD_TEST_UNPARSED_ARGUMENTS})
list(LENGTH _sources _sourceCount)
@@ -93,15 +89,12 @@ function(ecm_add_test)
add_test(NAME ${_testname} COMMAND ${_targetname})
target_link_libraries(${_targetname} ${ECM_ADD_TEST_LINK_LIBRARIES})
ecm_mark_as_test(${_targetname})
- if (ECM_ADD_TEST_PROPERTIES)
- set_tests_properties(${_testname} PROPERTIES ${ECM_ADD_TEST_PROPERTIES})
- endif()
endfunction()
function(ecm_add_tests)
set(options GUI)
set(oneValueArgs NAME_PREFIX)
- set(multiValueArgs LINK_LIBRARIES PROPERTIES)
+ set(multiValueArgs LINK_LIBRARIES)
cmake_parse_arguments(ECM_ADD_TESTS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
if(ECM_ADD_TESTS_GUI)
set(_exe_type GUI)
@@ -113,7 +106,6 @@ function(ecm_add_tests)
NAME_PREFIX ${ECM_ADD_TESTS_NAME_PREFIX}
LINK_LIBRARIES ${ECM_ADD_TESTS_LINK_LIBRARIES}
${_exe_type}
- PROPERTIES ${ECM_ADD_TESTS_PROPERTIES}
)
endforeach()
endfunction()
diff --git a/tests/ECMAddTests/CMakeLists.txt b/tests/ECMAddTests/CMakeLists.txt
index b31934d..e77b33f 100644
--- a/tests/ECMAddTests/CMakeLists.txt
+++ b/tests/ECMAddTests/CMakeLists.txt
@@ -34,7 +34,6 @@ add_check(single_tests
test4.txt
test5.txt
test6.txt
- test7.txt
)
add_check(multi_tests
test1.txt
@@ -46,7 +45,5 @@ add_check(multi_tests
test7.txt
test8.txt
test9.txt
- test10.txt
- test11.txt
)
diff --git a/tests/ECMAddTests/multi_tests/CMakeLists.txt b/tests/ECMAddTests/multi_tests/CMakeLists.txt
index bad625b..ca43477 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 a34a39d..0000000
--- 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 82641bb..0000000
--- 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;
-}
-
diff --git a/tests/ECMAddTests/single_tests/CMakeLists.txt b/tests/ECMAddTests/single_tests/CMakeLists.txt
index de1ae6f..6af3857 100644
--- a/tests/ECMAddTests/single_tests/CMakeLists.txt
+++ b/tests/ECMAddTests/single_tests/CMakeLists.txt
@@ -19,12 +19,13 @@ 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)
@@ -41,6 +42,7 @@ 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)
@@ -56,6 +58,7 @@ 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)
@@ -71,6 +74,7 @@ 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)
@@ -87,10 +91,9 @@ 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")
@@ -99,20 +102,13 @@ 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)
@@ -124,22 +120,3 @@ 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
deleted file mode 100644
index 069859e..0000000
--- a/tests/ECMAddTests/single_tests/test7.cpp
+++ /dev/null
@@ -1,8 +0,0 @@
-#include "testhelper.h"
-
-int main()
-{
- make_test_file("test7.txt");
- return 0;
-}
-
More information about the Kde-buildsystem
mailing list