Commit f1c8dda3 authored by David Faure's avatar David Faure
Browse files

akonadi: port to ecm_add_test

Summary:
This fixes some inconsistencies like
 - ecm_mark_as_test not called on all tests
 - ecm_mark_as_test called with the wrong prefix in the name
and it allows us to benefit from the automatic setting of
QT_PLUGIN_PATH, as done in ecm_add_test.

We could go further and use the LINK_LIBRARIES argument too, but
that doesn't really matter.

Test Plan: ctest

Reviewers: dvratil

Reviewed By: dvratil

Subscribers: kde-pim

Differential Revision: https://phabricator.kde.org/D21094
parent 66b24c88
......@@ -38,7 +38,7 @@ include(CheckSymbolExists)
include(KDEPackageAppTemplates)
include(ECMMarkNonGuiExecutable)
include(ECMAddTests)
include(AkonadiMacros)
......
......@@ -9,8 +9,7 @@ macro(add_unit_test _source)
${Akonadi_SOURCE_DIR}/src/akonadicontrol/agenttype.cpp
)
get_filename_component(_name ${_source} NAME_WE)
add_executable(${_name} ${_test})
add_test(NAME AkonadiControl-${_name} COMMAND ${_name})
ecm_add_test(TEST_NAME ${_name} NAME_PREFIX "AkonadiControl-" ${_test})
add_dependencies(${_name} akonadi_control)
if (ENABLE_ASAN)
set_tests_properties(AkonadiControl-${_name} PROPERTIES
......
set(QT_REQUIRED_VERSION "5.9.0")
find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED Test DBus)
include(ECMAddTests)
if(${EXECUTABLE_OUTPUT_PATH})
......@@ -27,9 +26,7 @@ include_directories(
macro(add_akonadi_test _source)
set(_test ${_source} ${CMAKE_BINARY_DIR}/src/core/akonadicore_debug.cpp)
get_filename_component(_name ${_source} NAME_WE)
add_executable( ${_name} ${_test} )
add_test(NAME ${_name} COMMAND ${_name} )
ecm_mark_as_test(akonadi-${_name})
ecm_add_test(TEST_NAME ${_name} ${_test})
set_tests_properties(${_name} PROPERTIES ENVIRONMENT "QT_HASH_SEED=1;QT_NO_CPU_FEATURE=sse4.2")
target_link_libraries(${_name} akonaditestfake Qt5::Test KF5::AkonadiPrivate KF5::DBusAddons KF5::I18n)
endmacro()
......@@ -42,9 +39,7 @@ macro(add_akonadi_test_widgets _source)
${CMAKE_BINARY_DIR}/src/core/akonadicore_debug.cpp
)
get_filename_component(_name ${_source} NAME_WE)
add_executable( ${_name} ${_test} )
add_test(NAME ${_name} COMMAND ${_name} )
ecm_mark_as_test(akonadi-${_name})
ecm_add_test(TEST_NAME ${_name} ${_test})
set_tests_properties(${_name} PROPERTIES ENVIRONMENT "QT_HASH_SEED=1;QT_NO_CPU_FEATURE=sse4.2")
target_link_libraries(${_name} akonaditestfake Qt5::Test KF5::AkonadiWidgets KF5::AkonadiPrivate KF5::DBusAddons)
endmacro()
......
......@@ -6,8 +6,7 @@ include_directories(${Akonadi_SOURCE_DIR}/src/private
macro(add_unit_test _source)
set(_test ${_source})
get_filename_component(_name ${_source} NAME_WE)
add_executable(${_name} ${_source})
add_test(NAME AkonadiPrivate-${_name} COMMAND ${_name})
ecm_add_test(TEST_NAME ${_name} NAME_PREFIX "AkonadiPrivate-" ${_source})
if (ENABLE_ASAN)
set_tests_properties(AkonadiPrivate-${_name} PROPERTIES
ENVIRONMENT ASAN_OPTIONS=symbolize=1
......
......@@ -51,8 +51,7 @@ macro(add_server_test _source)
set(_test ${_source} ../../src/server/akonadiserver_debug.cpp ../../src/server/akonadiserver_search_debug.cpp)
get_filename_component(_name ${_source} NAME_WE)
qt5_add_resources(_test dbtest_data/dbtest_data.qrc)
add_executable(${_name} ${_test})
add_test(NAME AkonadiServer-${_name} COMMAND ${_name})
ecm_add_test(TEST_NAME ${_name} NAME_PREFIX "AkonadiServer-" ${_test})
if (ENABLE_ASAN)
set_tests_properties(AkonadiServer-${_name} PROPERTIES
ENVIRONMENT ASAN_OPTIONS=symbolize=1
......
......@@ -5,8 +5,7 @@ include_directories(${Akonadi_SOURCE_DIR}/src/shared)
macro(add_unit_test _source)
set(_test ${_source})
get_filename_component(_name ${_source} NAME_WE)
add_executable(${_name} ${_source})
add_test(NAME AkonadiShared-${_name} COMMAND ${_name})
ecm_add_test(TEST_NAME ${_name} NAME_PREFIX "AkonadiShared-" ${_source})
if (ENABLE_ASAN)
set_tests_properties(AkonadiShared-${_name} PROPERTIES
ENVIRONMENT ASAN_OPTIONS=symbolize=1
......
......@@ -6,12 +6,10 @@ include(ECMMarkAsTest)
macro(add_libakonadixml_test _source)
set(_test ${_source})
get_filename_component(_name ${_source} NAME_WE)
add_executable( ${_name} ${_test} )
add_test(NAME ${_name} COMMAND ${_name} )
ecm_mark_as_test(akonadixml-${_name})
set_tests_properties(${_name} PROPERTIES ENVIRONMENT "QT_HASH_SEED=1;QT_NO_CPU_FEATURE=sse4.2")
ecm_add_test(TEST_NAME ${_name} NAME_PREFIX "akonadixml-" ${_test})
set_tests_properties(akonadixml-${_name} PROPERTIES ENVIRONMENT "QT_HASH_SEED=1;QT_NO_CPU_FEATURE=sse4.2")
set_target_properties(${_name} PROPERTIES COMPILE_FLAGS -DKDESRCDIR="\\"${CMAKE_CURRENT_SOURCE_DIR}/\\"")
target_link_libraries(${_name} KF5AkonadiCore KF5::AkonadiXml Qt5::Test Qt5::Xml)
target_link_libraries(${_name} KF5AkonadiCore KF5::AkonadiXml Qt5::Test Qt5::Xml)
endmacro()
add_libakonadixml_test(collectiontest.cpp)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment