summaryrefslogtreecommitdiff
path: root/tests/CMakeLists.txt
blob: cf924e1a068868f7df2cc51f0f693286b8c7277d (plain)
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
PKG_CHECK_MODULES(CERT_CHECKER_TESTS_DEP
    REQUIRED
    capi-appfw-application
    db-util
    dbus-1
    dbus-glib-1
    elementary
    glib-2.0
    gio-2.0
    icu-i18n
    key-manager
    libsystemd-journal
    sqlite3
    pkgmgr
    pkgmgr-info
    )

FIND_PACKAGE(Threads REQUIRED)
ADD_DEFINITIONS( "-DBOOST_TEST_DYN_LINK" )
ADD_DEFINITIONS("-DTEST_APP_SIGNATURES_DIR=\"${TEST_APP_SIGNATURES_DIR}\"")

SET(CERT_CHECKER_TESTS_SRC_PATH ${PROJECT_SOURCE_DIR}/tests)

SET(CERT_CHECKER_TESTS_SOURCES
    # tests
    ${CERT_CHECKER_TESTS_SRC_PATH}/main.cpp
    ${CERT_CHECKER_TESTS_SRC_PATH}/dbfixture.cpp
    ${CERT_CHECKER_TESTS_SRC_PATH}/colour_log_formatter.cpp
    ${CERT_CHECKER_TESTS_SRC_PATH}/app_event_operators.cpp
    ${CERT_CHECKER_TESTS_SRC_PATH}/test_app.cpp
    ${CERT_CHECKER_TESTS_SRC_PATH}/test_db.cpp
    ${CERT_CHECKER_TESTS_SRC_PATH}/test_queue.cpp
    ${CERT_CHECKER_TESTS_SRC_PATH}/queue_test_thread.cpp
    ${CERT_CHECKER_TESTS_SRC_PATH}/test_certs.cpp
    ${CERT_CHECKER_TESTS_SRC_PATH}/certs_.cpp
    # cert-checker
    ${CERT_CHECKER_SERVICE_PATH}/app.cpp
    ${CERT_CHECKER_SERVICE_PATH}/queue.cpp
    ${CERT_CHECKER_SERVICE_PATH}/certs.cpp
    # logs
    ${CERT_CHECKER_LOG_PATH}/log.cpp
    # dpl
    ${DPL_CORE_SRC_PATH}/assert.cpp
    ${DPL_CORE_SRC_PATH}/char_traits.cpp
    ${DPL_CORE_SRC_PATH}/colors.cpp
    ${DPL_CORE_SRC_PATH}/errno_string.cpp
    ${DPL_CORE_SRC_PATH}/exception.cpp
    ${DPL_CORE_SRC_PATH}/noncopyable.cpp
    ${DPL_CORE_SRC_PATH}/string.cpp
    # dpl DB
    ${DPL_DB_SRC_PATH}/sql_connection.cpp
    ${DPL_DB_SRC_PATH}/naive_synchronization_object.cpp
    # DB
    ${CERT_CHECKER_DB_PATH}/sql_query.cpp
    )

SET(CERT_CHECKER_TESTS_LOGIC_SOURCES
    # tests
    ${CERT_CHECKER_TESTS_SRC_PATH}/main.cpp
    ${CERT_CHECKER_TESTS_SRC_PATH}/colour_log_formatter.cpp
    ${CERT_CHECKER_TESTS_SRC_PATH}/test_logic.cpp
    ${CERT_CHECKER_TESTS_SRC_PATH}/logic_.cpp
    ${CERT_CHECKER_TESTS_SRC_PATH}/stubs_.cpp
    # cert-checker
    ${CERT_CHECKER_SERVICE_PATH}/logic.cpp
    ${CERT_CHECKER_SERVICE_PATH}/app.cpp
    ${CERT_CHECKER_SERVICE_PATH}/queue.cpp
    # logs
    ${CERT_CHECKER_LOG_PATH}/log.cpp
    # dpl
    ${DPL_CORE_SRC_PATH}/colors.cpp
)

SET(CERT_CHECKER_POPUP_TEST_SOURCES
    # tests
    ${CERT_CHECKER_TESTS_SRC_PATH}/popup_test.cpp
    # cert-checker
    ${CERT_CHECKER_SERVICE_PATH}/app.cpp
    ${CERT_CHECKER_UI_PATH}/popup-runner.cpp
    ${CERT_CHECKER_UI_PATH}/UIBackend.cpp
    # logs
    ${CERT_CHECKER_LOG_PATH}/log.cpp
    )

INCLUDE_DIRECTORIES(SYSTEM
    ${CERT_CHECKER_TESTS_DEP_INCLUDE_DIRS}
    ${CERT_CHECKER_SRC_PATH}/
    ${CERT_CHECKER_SRC_PATH}/include/
    ${DPL_CORE_PATH}/include/
    ${DPL_DB_PATH}/include/
    ${CERT_CHECKER_TESTS_SRC_PATH}/
    )

ADD_EXECUTABLE(${TARGET_CERT_CHECKER_TESTS} ${CERT_CHECKER_TESTS_SOURCES})
ADD_EXECUTABLE(${TARGET_CERT_CHECKER_TESTS_LOGIC} ${CERT_CHECKER_TESTS_LOGIC_SOURCES})
ADD_EXECUTABLE(${TARGET_CERT_CHECKER_POPUP_TEST} ${CERT_CHECKER_POPUP_TEST_SOURCES})

TARGET_LINK_LIBRARIES(${TARGET_CERT_CHECKER_TESTS}
    ${TARGET_CERT_CHECKER_COMMON}
    ${CERT_CHECKER_TESTS_DEP_LIBRARIES}
    ${CMAKE_THREAD_LIBS_INIT}
    boost_unit_test_framework
    -ldl
    )

TARGET_LINK_LIBRARIES(${TARGET_CERT_CHECKER_TESTS_LOGIC}
    ${TARGET_CERT_CHECKER_COMMON}
    ${CERT_CHECKER_TESTS_DEP_LIBRARIES}
    ${CMAKE_THREAD_LIBS_INIT}
    boost_unit_test_framework
    -ldl
    )

TARGET_LINK_LIBRARIES(${TARGET_CERT_CHECKER_POPUP_TEST}
    ${TARGET_CERT_CHECKER_COMMON}
    ${CERT_CHECKER_TESTS_DEP_LIBRARIES}
    -ldl
    )

#### Test files/signatures
INSTALL(FILES
    files/app1/author-signature.xml
    files/app1/signature1.xml
    DESTINATION ${TEST_APP_SIGNATURES_DIR}/app1/)
INSTALL(FILES
    files/app_2/signature1.xml
    DESTINATION ${TEST_APP_SIGNATURES_DIR}/app_2/)
INSTALL(FILES
    files/app3/signature1.xml
    DESTINATION ${TEST_APP_SIGNATURES_DIR}/app3/)
INSTALL(FILES
    files/app4/author-signature.xml
    files/app4/signature1.xml
    DESTINATION ${TEST_APP_SIGNATURES_DIR}/app4/)

INSTALL(TARGETS ${TARGET_CERT_CHECKER_TESTS} DESTINATION ${BIN_DIR})
INSTALL(TARGETS ${TARGET_CERT_CHECKER_TESTS_LOGIC} DESTINATION ${BIN_DIR})
INSTALL(TARGETS ${TARGET_CERT_CHECKER_POPUP_TEST} DESTINATION ${BIN_DIR})