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
|
find_package(Threads)
add_definitions(-DCORE_DBUS_ENABLE_GOOGLE_TEST_FIXTURE -DBOOST_ASIO_DISABLE_MOVE)
option(
LOCATION_SERVICE_ENABLE_DBUS_TEST_RUNNER
"Rely on dbus test runner to start a private session for testing purposes"
ON
)
if (LOCATION_SERVICE_ENABLE_DBUS_TEST_RUNNER)
find_program(DBUS_TEST_RUNNER_EXECUTABLE dbus-test-runner)
message(STATUS "Executing test suite under dbus-test-runner")
endif (LOCATION_SERVICE_ENABLE_DBUS_TEST_RUNNER)
# Build mongoose as static library to leverage in location reporter testing
add_library(mongoose mongoose.c)
# Explicitly select c99 when compiling mongoose
set_target_properties(
mongoose
PROPERTIES COMPILE_FLAGS "-std=c99")
# Build with system gmock and embedded gtest
set (GMOCK_INCLUDE_DIR "/usr/include/gmock/include" CACHE PATH "gmock source include directory")
set (GMOCK_SOURCE_DIR "/usr/src/gmock" CACHE PATH "gmock source directory")
set (GTEST_INCLUDE_DIR "${GMOCK_SOURCE_DIR}/gtest/include" CACHE PATH "gtest source include directory")
add_subdirectory(${GMOCK_SOURCE_DIR} "${CMAKE_CURRENT_BINARY_DIR}/gmock")
macro(LOCATION_SERVICE_ADD_TEST test_name src)
add_executable(
${test_name}
${src})
target_link_libraries(
${test_name}
ubuntu-location-service
ubuntu-location-service-connectivity
ubuntu-location-service-provider-daemon
ubuntu-location-service-daemon
mongoose
${Boost_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
${PROCESS_CPP_LIBRARIES}
${ARGN}
gmock
gtest
gtest_main)
add_test(${test_name} ${CMAKE_CURRENT_BINARY_DIR}/${test_name} --gtest_filter=*-*requires*)
# Address android's limit on cmdline length and distill ubuntu-location-service into uls
install(
TARGETS ${test_name}
DESTINATION ${CMAKE_INSTALL_BINDIR}/uls-tests
)
endmacro(LOCATION_SERVICE_ADD_TEST)
include_directories (
${CMAKE_SOURCE_DIR}/src/location_service
${GMOCK_INCLUDE_DIR}
${GTEST_INCLUDE_DIR}
)
LOCATION_SERVICE_ADD_TEST(acceptance_tests acceptance_tests.cpp)
LOCATION_SERVICE_ADD_TEST(boost_ptree_settings_test boost_ptree_settings_test.cpp)
LOCATION_SERVICE_ADD_TEST(connectivity_manager_test connectivity_manager_test.cpp)
LOCATION_SERVICE_ADD_TEST(controller_test controller_test.cpp)
LOCATION_SERVICE_ADD_TEST(criteria_test criteria_test.cpp)
LOCATION_SERVICE_ADD_TEST(daemon_and_cli_tests daemon_and_cli_tests.cpp)
LOCATION_SERVICE_ADD_TEST(default_permission_manager_test default_permission_manager_test.cpp)
LOCATION_SERVICE_ADD_TEST(engine_test engine_test.cpp)
LOCATION_SERVICE_ADD_TEST(harvester_test harvester_test.cpp)
LOCATION_SERVICE_ADD_TEST(demultiplexing_reporter_test demultiplexing_reporter_test.cpp)
LOCATION_SERVICE_ADD_TEST(time_based_update_policy_test time_based_update_policy_test.cpp)
if (NET_CPP_FOUND)
LOCATION_SERVICE_ADD_TEST(ichnaea_reporter_test ichnaea_reporter_test.cpp)
endif()
LOCATION_SERVICE_ADD_TEST(position_test position_test.cpp)
LOCATION_SERVICE_ADD_TEST(provider_selection_policy_test provider_selection_policy_test.cpp)
LOCATION_SERVICE_ADD_TEST(provider_factory_test provider_factory_test.cpp)
LOCATION_SERVICE_ADD_TEST(provider_test provider_test.cpp)
LOCATION_SERVICE_ADD_TEST(wgs84_test wgs84_test.cpp)
LOCATION_SERVICE_ADD_TEST(trust_store_permission_manager_test trust_store_permission_manager_test.cpp)
LOCATION_SERVICE_ADD_TEST(runtime_test runtime_test.cpp)
# Provider-specific test-cases go here.
if (LOCATION_SERVICE_ENABLE_GPS_PROVIDER)
include_directories(${CMAKE_SOURCE_DIR}/src/location_service)
LOCATION_SERVICE_ADD_TEST(gps_provider_test gps_provider_test.cpp)
endif(LOCATION_SERVICE_ENABLE_GPS_PROVIDER)
if (LOCATION_SERVICE_ENABLE_GEOCLUE_PROVIDERS)
add_executable(geoclue_provider_test geoclue_provider_test.cpp)
target_link_libraries(
geoclue_provider_test
ubuntu-location-service
${CMAKE_THREAD_LIBS_INIT}
${Boost_LIBRARIES}
${PROCESS_CPP_LIBRARIES}
gtest
gtest_main
)
if (LOCATION_SERVICE_ENABLE_DBUS_TEST_RUNNER)
add_test(geoclue_provider_test ${DBUS_TEST_RUNNER_EXECUTABLE} --task=${CMAKE_CURRENT_BINARY_DIR}/geoclue_provider_test)
else (LOCATION_SERVICE_ENABLE_DBUS_TEST_RUNNER)
add_test(geoclue_provider_test ${CMAKE_CURRENT_BINARY_DIR}/geoclue_provider_test)
endif (LOCATION_SERVICE_ENABLE_DBUS_TEST_RUNNER)
endif (LOCATION_SERVICE_ENABLE_GEOCLUE_PROVIDERS)
LOCATION_SERVICE_ADD_TEST(remote_providerd_test remote_providerd_test.cpp)
LOCATION_SERVICE_ADD_TEST(remote_provider_test remote_provider_test.cpp)
LOCATION_SERVICE_ADD_TEST(espoo_provider_test espoo_provider_test.cpp)
LOCATION_SERVICE_ADD_TEST(delayed_service_test delayed_service_test.cpp)
|