SET(common_dp "glib-2.0 lbs-dbus dlog gio-2.0 lbs-location libsyscommon hal-api-common hal-api-location")
SET(server_dp "${common_dp} tapi vconf vconf-internal-keys gthread-2.0 gio-unix-2.0 capi-network-connection capi-network-wifi-manager capi-system-info libtzplatform-config")
SET(module_dp "${common_dp} gmodule-2.0")
+SET(haltests_dp "${server_dp} capi-system-info vconf")
# Set required packages
INCLUDE(FindPkgConfig)
SET(MODULE_EXTRA_CFLAGS "${MODULE_EXTRA_CFLAGS} ${flag}")
ENDFOREACH(flag)
+## HALTESTS
+pkg_check_modules(haltests_pkgs REQUIRED ${haltests_dp})
+FOREACH(flag ${haltests_pkgs_CFLAGS})
+ SET(HALTESTS_EXTRA_CFLAGS "${HALTESTS_EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -Wl,-zdefs -fvisibility=hidden ")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
ADD_SUBDIRECTORY(module)
ADD_SUBDIRECTORY(lbs-server)
+ADD_SUBDIRECTORY(haltests)
--- /dev/null
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(location-haltests C CXX)
+
+ADD_DEFINITIONS("-DUSE_DLOG")
+
+SET(server_pkgs_LDFLAGS "${server_pkgs_LDFLAGS} -ldl -Wl,-z,noexecstack")
+
+SET(SRCS ${CMAKE_SOURCE_DIR}/lbs-server/src/server.c
+ ${CMAKE_SOURCE_DIR}/lbs-server/src/lbs_server.c
+ ${CMAKE_SOURCE_DIR}/lbs-server/src/data_connection.c
+ ${CMAKE_SOURCE_DIR}/lbs-server/src/nmea_logger.c
+ ${CMAKE_SOURCE_DIR}/lbs-server/src/gps_plugin_module.c
+ ${CMAKE_SOURCE_DIR}/lbs-server/src/last_position.c
+ ${CMAKE_SOURCE_DIR}/lbs-server/src/setting.c
+ ${CMAKE_SOURCE_DIR}/lbs-server/src/dump_log.c
+ ${CMAKE_SOURCE_DIR}/lbs-server/src/nps_plugin_module.c
+ ${CMAKE_SOURCE_DIR}/lbs-server/src/fused.c
+)
+
+FILE(GLOB_RECURSE FUSED_SRCS ${CMAKE_SOURCE_DIR}/lbs-server/src/fused/*.c)
+FILE(GLOB_RECURSE BM_SRCS ${CMAKE_SOURCE_DIR}/lbs-server/src/battery-monitor/*.c)
+
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR})
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/lbs-server/src)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/lbs-server/include)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/haltests)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/${INC_DIR})
+
+SET(HALTESTS_EXTRA_CFLAGS "${HALTESTS_EXTRA_CFLAGS} -D_GNU_SOURCE")
+
+SET(REQUIRES_LIST ${REQUIRES_LIST}
+ gmock
+)
+
+
+INCLUDE(FindPkgConfig)
+PKG_CHECK_MODULES(gtest_pkgs REQUIRED ${REQUIRES_LIST})
+
+FOREACH(flag ${gtest_pkgs_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(HALTESTS_EXTRA_CFLAGS "${HALTESTS_EXTRA_CFLAGS} ${EXTRA_CFLAGS} -Wall -fPIE -DHALTESTS -Wno-unused-function")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${HALTESTS_EXTRA_CFLAGS}")
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${HALTESTS_EXTRA_CFLAGS}")
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -pie")
+
+SET(src ${CMAKE_SOURCE_DIR}/haltests/location-haltests.cpp)
+
+ADD_EXECUTABLE(${PROJECT_NAME} ${src} ${SRCS} ${FUSED_SRCS} ${BM_SRCS} )
+SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS ${HALTESTS_EXTRA_CFLAGS})
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${server_pkgs_LDFLAGS} -lm ${gtest_LDFLAGS} ${gtest_pkgs_LDFLAGS} -ldl -L${LIBDIR}/hal)
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${BIN_DIR}/hal)
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __HALTEST_H__
+#define __HALTEST_H__
+
+#include <glib.h>
+
+#define FEATURE_LOCATION "http://tizen.org/feature/location"
+#define FEATURE_GPS "http://tizen.org/feature/location.gps"
+#define FEATURE_GPS_SATELLITE "http://tizen.org/feature/location.gps.satellite"
+
+bool supported;
+
+#endif /* __HALTEST_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <iostream>
+#include <gtest/gtest.h>
+#include <system_info.h>
+#include "haltest.h"
+#include "hal-location.h"
+
+extern "C" {
+#include "server.h"
+}
+
+class LocationHaltest : public testing::Test
+{
+ public:
+ virtual void SetUp()
+ {
+ int ret;
+
+ ret = system_info_get_platform_bool(FEATURE_LOCATION, &supported);
+ ASSERT_EQ(SYSTEM_INFO_ERROR_NONE, ret) << "system_info_get_platform_bool failed";
+
+ }
+
+ virtual void TearDown()
+ {
+
+ }
+};
+
+TEST_F(LocationHaltest, InitP)
+{
+ int ret = 0;
+ int argc = 0;
+ char **argv = NULL;
+ ret = initialize_server(argc,argv);
+ ASSERT_EQ(ret, 0) << "Fail to initialize_server (" << ret << ")";
+}
+
+TEST_F(LocationHaltest, StartSessionP)
+{
+ int ret = 0;
+ int argc = 0;
+ char **argv = NULL;
+ int interval = 10;
+ ret = initialize_server(argc,argv);
+ ASSERT_EQ(ret, 0) << "Fail to initialize_server (" << ret << ")";
+ ret = request_start_session(interval);
+ ASSERT_EQ(ret, 1) << "Fail to start_session (" << ret << ")";
+}
+
+TEST_F(LocationHaltest, StopSessionP)
+{
+ int ret = 0;
+ ret = request_stop_session();
+ ASSERT_EQ(ret, 1) << "Fail to stop_session (" << ret << ")";
+}
+
+TEST_F(LocationHaltest, DeInitP)
+{
+ int ret = 0;
+ ret = deinitialize_server();
+ ASSERT_EQ(ret, 0) << "Fail to deinitialize_server (" << ret << ")";
+}
+
+#ifdef HALTESTS
+int main(int argc, char **argv)
+{
+ int ret = -1;
+
+ try {
+ testing::InitGoogleTest(&argc, argv);
+ } catch(...) {
+ std::cout << "Exception occurred." << std::endl;
+ }
+
+ try {
+ ret = RUN_ALL_TESTS();
+ } catch (const ::testing::internal::GoogleTestFailureException& e) {
+ ret = -1;
+ std::cout << "GoogleTestFailureException was thrown:" << e.what() << std::endl;
+ }
+
+ return ret;
+}
+#endif
LOG_NPS(DBG_ERR, "GLIB[%d] : %s", log_level, msg);
}
+#ifndef HALTESTS
int main(int argc, char **argv)
{
lbs_server_s *lbs_server = NULL;
return 0;
}
-
+#endif
/* Tizen 3.0 */
Name: lbs-server
Summary: LBS Server for Tizen
-Version: 1.3.6
+Version: 1.3.7
Release: 1
Group: Location/Service
License: Apache-2.0
BuildRequires: pkgconfig(hal-api-common)
BuildRequires: pkgconfig(hal-api-location)
BuildRequires: pkgconfig(libsyscommon)
+BuildRequires: pkgconfig(gmock)
%description
LBS Server plugin for Tizen (Development)
This package provides header files and pkgconfig file for LBS Server plugin
+%package -n location-haltests
+Summary: Location HAL(Hardware Abstraction Layer) Test Cases
+Requires: %{name} = %{version}-%{release}
+
+%description -n location-haltests
+Location HAL(Hardware Abstraction Layer) Test Cases
+
%prep
%setup -q
cp %{SOURCE1} .
%files -n lbs-server-plugin-devel
%{_libdir}/pkgconfig/lbs-server-plugin.pc
%{_includedir}/lbs-server-plugin/*.h
+
+%files -n location-haltests
+%manifest %{name}.manifest
+%{_bindir}/hal/location-haltests