CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-PROJECT(bt-oal C)
+PROJECT(bt-oal C CXX)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/hardware/)
LINK_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/bt-oal)
INCLUDE(FindPkgConfig)
-pkg_check_modules(oal_pkgs REQUIRED vconf aul vconf alarm-service gio-unix-2.0 dlog gio-2.0 glib-2.0 libtzplatform-config)
+pkg_check_modules(oal_pkgs REQUIRED vconf aul vconf alarm-service gio-unix-2.0 dlog
+gio-2.0 glib-2.0 libtzplatform-config gmock)
#pkg_check_modules(oal_pkgs REQUIRED vconf aul vconf libudev dbus-glib-1
#alarm-service gio-unix-2.0 systemd dlog gio-2.0 glib-2.0 libtzplatform-config)
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -g ")
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -fprofile-arcs -ftest-coverage")
FIND_PROGRAM(UNAME NAMES uname)
EXEC_PROGRAM("${UNAME}" ARGS "-m" OUTPUT_VARIABLE "ARCH")
INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIBDIR})
-TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${packages_LDFLAGS} -ldl)
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${packages_LDFLAGS} -ldl -lgcov)
FOREACH(hfile ${HEADERS})
INSTALL(FILES ${CMAKE_SOURCE_DIR}/include/${hfile} DESTINATION include/bt-oal)
ENDFOREACH(hfile)
+
+ADD_SUBDIRECTORY(haltest)
--- /dev/null
+# Copyright (c) 2014-2017 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.
+#
+# @file CMakeLists.txt
+# @author
+# @brief Cmake for tests
+#
+SET(TARGET_GTEST_TESTS "bluetooth_hal_tc")
+
+INCLUDE_DIRECTORIES(/usr/include)
+INCLUDE_DIRECTORIES(/usr/include/db-util)
+INCLUDE_DIRECTORIES(/usr/include/glib-2.0)
+INCLUDE_DIRECTORIES(/usr/lib/glib-2.0/include/)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/hardware)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/common)
+
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+SET(EXEC_PREFIX "\${prefix}")
+SET(INCLUDEDIR "/usr/include")
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(testpkgs REQUIRED glib-2.0 gmock)
+
+SET(GTEST_TESTS_SOURCES
+bluetooth_hal_tc.cpp
+)
+
+ADD_EXECUTABLE(${TARGET_GTEST_TESTS}
+ ${GTEST_TESTS_SOURCES}
+)
+
+TARGET_LINK_LIBRARIES(${TARGET_GTEST_TESTS}
+ ${oal_pkgs_LDFLAGS}
+ ${oal_pkgs_LIBRARIES}
+ gmock
+ -L${CMAKE_SOURCE_DIR}/bt-oal
+ -lbt-oal
+)
+
+INSTALL(TARGETS ${TARGET_GTEST_TESTS} DESTINATION /usr/bin)
--- /dev/null
+/*
+ * Copyright (c) 2014 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.
+ */
+/**
+ * @file bluetooth-share_test.cpp
+ * @author abc
+ * @version 1.0
+ * @brief Unit-tests setup
+ */
+
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+#include <unistd.h>
+#include <glib.h>
+
+using ::testing::EmptyTestEventListener;
+using ::testing::InitGoogleTest;
+using ::testing::Test;
+using ::testing::TestCase;
+using ::testing::TestEventListeners;
+using ::testing::TestInfo;
+using ::testing::TestPartResult;
+using ::testing::UnitTest;
+
+int main(int argc, char **argv) {
+ InitGoogleTest(&argc, argv);
+
+ return RUN_ALL_TESTS();
+}
BuildRequires: pkgconfig(storage)
BuildRequires: pkgconfig(capi-system-info)
BuildRequires: pkgconfig(capi-appfw-app-control)
+BuildRequires: pkgconfig(gmock)
Requires(post): /usr/bin/vconftool
Requires(post): /sbin/ldconfig
%description oal
This package is BT stack common interface.
+%package oal-haltests
+Summary: HAL Test package for bluetooth OAL
+Group: TO_BE/FILLED
+Requires: %{name} = %{version}-%{release}
+
+%description oal-haltests
+This package is C-API test application.
+
%package plugin-headed
Summary: Bluetooth plugin Headed
Group: Network & Connectivity/Bluetooth
%if %{bt_bluez_hal} == ENABLED
%{_libdir}/libbluetooth.default.so*
%endif
+
+%files oal-haltests
+%manifest %{name}.manifest
+%{_bindir}/bluetooth_hal_tc