1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
|
find_package(Qt5Core 5.4 REQUIRED)
find_package(Qt5Qml 5.4 REQUIRED)
find_package(Qt5Quick 5.4 REQUIRED)
find_package(Qt5QuickTest 5.4 REQUIRED)
configure_file(config.cpp.in config.cpp)
set(GMOCK_BUILD_SHARED_LIBS ON)
find_package(GMock)
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
${GMOCK_INCLUDE_DIRS}
)
# Ensure that we have a ready-made fixture maintaining a private bus instance
# readily available in unit- and integration tests.
add_definitions(-DCORE_DBUS_ENABLE_GOOGLE_TEST_FIXTURE)
macro(BIOMETRYD_ADD_TEST test_name src)
add_executable(
${test_name}
${src}
${CMAKE_CURRENT_SOURCE_DIR}/did_finish_successfully.h
${CMAKE_CURRENT_SOURCE_DIR}/echo_service.h
${CMAKE_CURRENT_SOURCE_DIR}/echo_service.cpp
${CMAKE_CURRENT_SOURCE_DIR}/config.h
${CMAKE_CURRENT_BINARY_DIR}/config.cpp)
target_link_libraries(
${test_name}
biometry
${Boost_LIBRARIES}
${DBUS_CPP_LIBRARIES}
${PROCESS_CPP_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
${ARGN}
${GMOCK_LIBRARIES})
add_test(${test_name} ${CMAKE_CURRENT_BINARY_DIR}/${test_name} --gtest_filter=*-*requires*)
set_tests_properties(${test_name} PROPERTIES ENVIRONMENT "BIOMETRYD_DBUS_SKELETON_IS_RUNNING_UNDER_TESTING=1")
endmacro(BIOMETRYD_ADD_TEST)
add_library(biometryd_devices_plugin_dl SHARED biometryd_devices_plugin_dl.cpp)
target_link_libraries(biometryd_devices_plugin_dl gtest gmock)
add_library(biometryd_devices_plugin_dl_version_mismatch SHARED biometryd_devices_plugin_dl_version_mismatch.cpp)
target_link_libraries(biometryd_devices_plugin_dl_version_mismatch gtest gmock)
BIOMETRYD_ADD_TEST(test_atomic_counter test_atomic_counter.cpp)
BIOMETRYD_ADD_TEST(test_configuration test_configuration.cpp)
BIOMETRYD_ADD_TEST(test_daemon test_daemon.cpp)
BIOMETRYD_ADD_TEST(test_device_registrar test_device_registrar.cpp)
BIOMETRYD_ADD_TEST(test_dispatching_device_and_service test_dispatching_service_and_device.cpp)
BIOMETRYD_ADD_TEST(test_dbus_codec test_dbus_codec.cpp)
BIOMETRYD_ADD_TEST(test_dbus_stub_skeleton test_dbus_stub_skeleton.cpp)
BIOMETRYD_ADD_TEST(test_dictionary test_dictionary.cpp)
BIOMETRYD_ADD_TEST(test_fingerprint_reader test_fingerprint_reader.cpp)
BIOMETRYD_ADD_TEST(test_forwarding test_forwarding.cpp)
BIOMETRYD_ADD_TEST(test_geometry test_geometry.cpp)
BIOMETRYD_ADD_TEST(test_operation test_operation.cpp)
BIOMETRYD_ADD_TEST(test_percent test_percent.cpp)
BIOMETRYD_ADD_TEST(test_plugin_device test_plugin_device.cpp)
BIOMETRYD_ADD_TEST(test_progress test_progress.cpp)
BIOMETRYD_ADD_TEST(test_user test_user.cpp)
# TODO implement verifier test, its currently empty
#BIOMETRYD_ADD_TEST(test_verifier test_verifier.cpp)
BIOMETRYD_ADD_TEST(test_cmds_config cmds/test_config.cpp)
BIOMETRYD_ADD_TEST(test_cmds_run cmds/test_run.cpp)
BIOMETRYD_ADD_TEST(test_cmds_test cmds/test_test.cpp)
if ("DEB_TARGET_ARCH" STREQUAL "powerpc")
else()
add_executable(test_qml_plugin test_qml_plugin.cpp)
target_link_libraries(test_qml_plugin Qt5::Core Qt5::Qml Qt5::Quick Qt5::QuickTest)
#add_test(test_qml_plugin test_qml_plugin)
#set_tests_properties(test_qml_plugin PROPERTIES ENVIRONMENT "QT_QPA_PLATFORM=minimal;QML2_IMPORT_PATH=${CMAKE_BINARY_DIR}/src/biometry/qml;BIOMETRYD_QML_ENABLE_TESTING=1")
file(GLOB BIOMETRYD_QML_TEST_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} tst_*.qml)
foreach (QML_FILE ${BIOMETRYD_QML_TEST_FILES})
message(INFO ${QML_FILE})
configure_file(${QML_FILE} ${QML_FILE} COPYONLY)
endforeach(QML_FILE)
endif()
|