Move test framework from wrt-commons to security-tests
[platform/core/test/security-tests.git] / tests / security-server-tests / CMakeLists.txt
1 #
2 #Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
3 #
4 #   Licensed under the Apache License, Version 2.0 (the "License");
5 #   you may not use this file except in compliance with the License.
6 #   You may obtain a copy of the License at
7 #
8 #       http://www.apache.org/licenses/LICENSE-2.0
9 #
10 #   Unless required by applicable law or agreed to in writing, software
11 #   distributed under the License is distributed on an "AS IS" BASIS,
12 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 #   See the License for the specific language governing permissions and
14 #   limitations under the License.
15 #
16 # @file        CMakeLists.txt
17 # @author      Tomasz Swierczek (t.swierczek@samsung.com)
18 # @author      Mariusz Domanski (m.domanski@samsung.com)
19 # @brief
20 #
21
22 INCLUDE(FindPkgConfig)
23
24 # Dependencies
25 PKG_CHECK_MODULES(SEC_SRV_TESTS_DEP
26     libsmack
27     libprivilege-control
28     security-server
29     dlog
30     dbus-1
31     dbus-glib-1
32     REQUIRED)
33
34 # Targets definition
35
36 SET(TARGET_SEC_SRV_COMMON "security-server-tests-common")
37 SET(TARGET_SEC_SRV_CLIENT_SMACK_TESTS "security-server-tests-client-smack")
38 SET(TARGET_SEC_SRV_TC_SERVER_TESTS "security-server-tests-server")
39 SET(TARGET_SEC_SRV_PWD_TESTS "security-server-tests-password")
40 SET(TARGET_SEC_SRV_PRIVILEGE_TESTS "security-server-tests-privilege")
41 SET(TARGET_SEC_SRV_STRESS_TESTS "security-server-tests-stress")
42 SET(TARGET_SEC_SRV_MT_TESTS "security-server-tests-mt")
43 SET(TARGET_SEC_SRV_DBUS_TESTS "security-server-tests-dbus")
44 SET(TARGET_SEC_SRV_MEASURER "security-server-tests-api-speed")
45
46
47 # Sources definition
48
49 SET(SEC_SRV_COMMON_SOURCES
50     ${PROJECT_SOURCE_DIR}/tests/security-server-tests/common/security_server_tests_common.cpp
51    )
52
53 SET(SEC_SRV_CLIENT_SMACK_SOURCES
54     ${PROJECT_SOURCE_DIR}/tests/security-server-tests/security_server_tests_client_smack.cpp
55     ${PROJECT_SOURCE_DIR}/tests/security-server-tests/security_server_mockup.cpp
56    )
57
58 SET(SEC_SRV_TC_SERVER_SOURCES
59     ${PROJECT_SOURCE_DIR}/tests/security-server-tests/server.cpp
60     ${PROJECT_SOURCE_DIR}/tests/security-server-tests/cookie_api.cpp
61     ${PROJECT_SOURCE_DIR}/tests/security-server-tests/weird_arguments.cpp
62     ${PROJECT_SOURCE_DIR}/tests/security-server-tests/security_server_clean_env.cpp
63    )
64
65 SET(SEC_SRV_PWD_SOURCES
66     ${PROJECT_SOURCE_DIR}/tests/security-server-tests/security_server_tests_password.cpp
67     ${PROJECT_SOURCE_DIR}/tests/security-server-tests/security_server_clean_env.cpp
68    )
69
70 SET(SEC_SRV_PRIVILEGE_SOURCES
71     ${PROJECT_SOURCE_DIR}/tests/security-server-tests/security_server_tests_privilege.cpp
72     ${PROJECT_SOURCE_DIR}/tests/libprivilege-control-tests/libprivilege-control_test_common.cpp
73    )
74
75 SET(SEC_SRV_STRESS_SOURCES
76     ${PROJECT_SOURCE_DIR}/tests/security-server-tests/security_server_tests_stress.cpp
77    )
78
79 SET(SEC_SRV_MT_SOURCES
80     ${PROJECT_SOURCE_DIR}/tests/security-server-tests/security_server_tests_mt.cpp
81    )
82
83 SET(SEC_SRV_DBUS_SOURCES
84     ${PROJECT_SOURCE_DIR}/tests/security-server-tests/security_server_tests_dbus.cpp
85    )
86
87 SET(SEC_SRV_MEASURER_SOURCES
88     ${PROJECT_SOURCE_DIR}/tests/security-server-tests/security_server_measurer_API_speed.cpp
89     ${PROJECT_SOURCE_DIR}/tests/security-server-tests/security_server_mockup.cpp
90    )
91
92 INCLUDE_DIRECTORIES(SYSTEM
93     ${SEC_SRV_TESTS_DEP_INCLUDE_DIRS}
94    )
95
96 INCLUDE_DIRECTORIES(
97     ${PROJECT_SOURCE_DIR}/tests/common/
98     ${PROJECT_SOURCE_DIR}/tests/security-server-tests/common/
99     ${PROJECT_SOURCE_DIR}/tests/libprivilege-control-tests/common/
100    )
101
102 ADD_DEFINITIONS("-I/usr/include/dbus-1.0/dbus")
103
104 #LINK_DIRECTORIES(${SEC_SRV_PKGS_LIBRARY_DIRS})
105
106 ADD_LIBRARY(${TARGET_SEC_SRV_COMMON} STATIC ${SEC_SRV_COMMON_SOURCES})
107 ADD_EXECUTABLE(${TARGET_SEC_SRV_CLIENT_SMACK_TESTS} ${SEC_SRV_CLIENT_SMACK_SOURCES})
108 ADD_EXECUTABLE(${TARGET_SEC_SRV_TC_SERVER_TESTS} ${SEC_SRV_TC_SERVER_SOURCES})
109 ADD_EXECUTABLE(${TARGET_SEC_SRV_PWD_TESTS} ${SEC_SRV_PWD_SOURCES})
110 ADD_EXECUTABLE(${TARGET_SEC_SRV_PRIVILEGE_TESTS} ${SEC_SRV_PRIVILEGE_SOURCES})
111 ADD_EXECUTABLE(${TARGET_SEC_SRV_STRESS_TESTS} ${SEC_SRV_STRESS_SOURCES})
112 ADD_EXECUTABLE(${TARGET_SEC_SRV_MT_TESTS} ${SEC_SRV_MT_SOURCES})
113 ADD_EXECUTABLE(${TARGET_SEC_SRV_DBUS_TESTS} ${SEC_SRV_DBUS_SOURCES})
114 ADD_EXECUTABLE(${TARGET_SEC_SRV_MEASURER} ${SEC_SRV_MEASURER_SOURCES})
115
116
117 TARGET_LINK_LIBRARIES(${TARGET_SEC_SRV_CLIENT_SMACK_TESTS}
118     ${SEC_SRV_TESTS_DEP_LIBRARIES}
119     dpl-test-framework
120     tests-common
121     )
122
123 TARGET_LINK_LIBRARIES(${TARGET_SEC_SRV_TC_SERVER_TESTS}
124     ${TARGET_SEC_SRV_COMMON}
125     ${SEC_SRV_TESTS_DEP_LIBRARIES}
126     dpl-test-framework
127     tests-common
128     )
129
130 TARGET_LINK_LIBRARIES(${TARGET_SEC_SRV_PWD_TESTS}
131     ${TARGET_SEC_SRV_COMMON}
132     ${SEC_SRV_TESTS_DEP_LIBRARIES}
133     dpl-test-framework
134     tests-common
135     )
136
137 TARGET_LINK_LIBRARIES(${TARGET_SEC_SRV_PRIVILEGE_TESTS}
138     ${SEC_SRV_TESTS_DEP_LIBRARIES}
139     dpl-test-framework
140     tests-common
141     )
142
143 TARGET_LINK_LIBRARIES(${TARGET_SEC_SRV_STRESS_TESTS}
144     ${SEC_SRV_TESTS_DEP_LIBRARIES}
145     dpl-test-framework
146     tests-common
147     )
148
149 TARGET_LINK_LIBRARIES(${TARGET_SEC_SRV_MT_TESTS}
150     ${SEC_SRV_TESTS_DEP_LIBRARIES}
151     dpl-test-framework
152     tests-common
153     )
154
155 TARGET_LINK_LIBRARIES(${TARGET_SEC_SRV_DBUS_TESTS}
156     ${SEC_SRV_TESTS_DEP_LIBRARIES}
157     dpl-test-framework
158     tests-common
159     )
160
161 TARGET_LINK_LIBRARIES(${TARGET_SEC_SRV_MEASURER}
162     ${TARGET_SEC_SRV_COMMON}
163     ${SEC_SRV_TESTS_DEP_LIBRARIES}
164     dpl-test-framework
165     tests-common
166     )
167
168 # Installation
169
170 INSTALL(TARGETS ${TARGET_SEC_SRV_CLIENT_SMACK_TESTS} DESTINATION /usr/bin)
171 INSTALL(TARGETS ${TARGET_SEC_SRV_TC_SERVER_TESTS} DESTINATION /usr/bin)
172 INSTALL(TARGETS ${TARGET_SEC_SRV_PWD_TESTS} DESTINATION /usr/bin)
173 INSTALL(TARGETS ${TARGET_SEC_SRV_PRIVILEGE_TESTS} DESTINATION /usr/bin)
174 INSTALL(TARGETS ${TARGET_SEC_SRV_STRESS_TESTS} DESTINATION /usr/bin)
175 INSTALL(TARGETS ${TARGET_SEC_SRV_MT_TESTS} DESTINATION /usr/bin)
176 INSTALL(TARGETS ${TARGET_SEC_SRV_DBUS_TESTS} DESTINATION /usr/bin)
177 INSTALL(TARGETS ${TARGET_SEC_SRV_MEASURER} DESTINATION /usr/bin)
178
179 INSTALL(FILES
180     ${PROJECT_SOURCE_DIR}/tests/security-server-tests/WRT_sstp_test_rules1.smack
181     DESTINATION /usr/share/privilege-control/
182 )
183
184 INSTALL(FILES
185     ${PROJECT_SOURCE_DIR}/tests/security-server-tests/WRT_sstp_test_rules2.smack
186     DESTINATION /usr/share/privilege-control/
187 )