From: DoHyun Pyun Date: Mon, 8 Feb 2021 23:34:07 +0000 (+0900) Subject: Move haltest package to hal-api-bluetooth X-Git-Tag: accepted/tizen/unified/20210218.042134^0 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fconnectivity%2Fbluetooth-frwk.git;a=commitdiff_plain;h=8780f45461413ccce6aaf9155d737a2cab6f9d61 Move haltest package to hal-api-bluetooth Change-Id: I07ffaf4219c460fd5c3d053733b333efdee51669 Signed-off-by: DoHyun Pyun --- diff --git a/bt-oal/CMakeLists.txt b/bt-oal/CMakeLists.txt index c77b19a..415232b 100755 --- a/bt-oal/CMakeLists.txt +++ b/bt-oal/CMakeLists.txt @@ -55,7 +55,7 @@ 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 gmock) +gio-2.0 glib-2.0) #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) @@ -84,10 +84,8 @@ SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${VERSION}) INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIBDIR}) -TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${packages_LDFLAGS} -ldl -lgcov) +TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${packages_LDFLAGS} -ldl) FOREACH(hfile ${HEADERS}) INSTALL(FILES ${CMAKE_SOURCE_DIR}/include/${hfile} DESTINATION include/bt-oal) ENDFOREACH(hfile) - -ADD_SUBDIRECTORY(haltest) diff --git a/bt-oal/haltest/CMakeLists.txt b/bt-oal/haltest/CMakeLists.txt deleted file mode 100644 index a725fa7..0000000 --- a/bt-oal/haltest/CMakeLists.txt +++ /dev/null @@ -1,54 +0,0 @@ -# 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-haltests") - -INCLUDE_DIRECTORIES(/usr/include) -INCLUDE_DIRECTORIES(/usr/include/db-util) -INCLUDE_DIRECTORIES(/usr/include/glib-2.0) -INCLUDE_DIRECTORIES(/usr/include/system) -INCLUDE_DIRECTORIES(/usr/lib/glib-2.0/include/) -INCLUDE_DIRECTORIES(/usr/lib64/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 - capi-system-info - bt-oal -) - -INSTALL(TARGETS ${TARGET_GTEST_TESTS} DESTINATION /usr/bin) diff --git a/bt-oal/haltest/bluetooth_hal_tc.cpp b/bt-oal/haltest/bluetooth_hal_tc.cpp deleted file mode 100644 index ac1ddc9..0000000 --- a/bt-oal/haltest/bluetooth_hal_tc.cpp +++ /dev/null @@ -1,309 +0,0 @@ -/* - * 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_hal_tc.cpp - * @author abc - * @version 1.0 - * @brief BT hal tests - */ - -#include -#include -#include -#include -#include - -#include "bluetooth.h" -#include "oal-manager.h" -#include "oal-adapter-mgr.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; - -#define TIMEOUT_6SECONDS 6000 -#define TIMEOUT_2SECONDS 2000 -#define TIMEOUT_500MILISECONDS 500 - -#define FEATURE_BT "http://tizen.org/feature/network.bluetooth" - -#define SKIP_NOT_SUPPORTED(bFeature) {\ - if (!bFeature) {\ - printf("Feature is not support\n");\ - return;\ - } \ -} - -static bool g_bFeatureBT; - -static GMainLoop *mainloop = NULL; - -static gboolean timeout_func(gpointer data) -{ - g_main_loop_quit((GMainLoop *)data); - return FALSE; -} - -static void wait_for_async(int timeout) -{ - int timeout_id = 0; - - mainloop = g_main_loop_new(NULL, FALSE); - - timeout_id = g_timeout_add(timeout, timeout_func, mainloop); - if (timeout_id < 0) - return; - - g_main_loop_run(mainloop); -} - -static void __bt_oal_event_receiver(int event_type, gpointer event_data, gsize len) -{ -/* - printf("event_type: [%d], data size: [%d]\n", event_type, len); -*/ -} - -static bool __check_feature_supported(char *key) -{ - bool value = false; - int ret = system_info_get_platform_bool(key, &value); - - EXPECT_EQ(SYSTEM_INFO_ERROR_NONE, ret) << "system_info_get_platform_bool failed"; - - return value; -} - -TEST(BluetoothHAL_test, oal_bt_init_deinit_p) { - g_bFeatureBT = __check_feature_supported((char*)FEATURE_BT); - SKIP_NOT_SUPPORTED(g_bFeatureBT); - - int ret = OAL_STATUS_SUCCESS; - - ret = oal_bt_init(__bt_oal_event_receiver); - ASSERT_TRUE(ret == OAL_STATUS_PENDING); - - wait_for_async(TIMEOUT_500MILISECONDS); - - oal_bt_deinit(); - - wait_for_async(TIMEOUT_500MILISECONDS); -} - -TEST(BluetoothHAL_test, adapter_enable_p) { - SKIP_NOT_SUPPORTED(g_bFeatureBT); - - int ret = OAL_STATUS_SUCCESS; - gboolean powered = FALSE; - - ret = oal_bt_init(__bt_oal_event_receiver); - ASSERT_TRUE(ret == OAL_STATUS_PENDING); - - wait_for_async(TIMEOUT_500MILISECONDS); - - ret = adapter_get_powered_status(&powered); - - /* Already enabled */ - if (powered == TRUE) - return; - - ret = adapter_enable(); - ASSERT_TRUE(ret == OAL_STATUS_SUCCESS); - - wait_for_async(TIMEOUT_6SECONDS); /* Wait for 6 seconds */ -} - -TEST(BluetoothHAL_test, adapter_disable_p) { - SKIP_NOT_SUPPORTED(g_bFeatureBT); - - int ret = OAL_STATUS_SUCCESS; - - ret = adapter_disable(); - ASSERT_TRUE(ret == OAL_STATUS_SUCCESS); - - wait_for_async(TIMEOUT_6SECONDS); -} - -TEST(BluetoothHAL_test, adapter_get_powered_status_p) { - SKIP_NOT_SUPPORTED(g_bFeatureBT); - - int ret = OAL_STATUS_SUCCESS; - gboolean powered = FALSE; - - /* Precondition : BT enable */ - ret = adapter_enable(); - ASSERT_TRUE(ret == OAL_STATUS_SUCCESS); - - wait_for_async(TIMEOUT_6SECONDS); - - ret = adapter_get_powered_status(&powered); - ASSERT_TRUE(ret == OAL_STATUS_SUCCESS); -} - -TEST(BluetoothHAL_test, adapter_start_stop_inquiry_p) { - SKIP_NOT_SUPPORTED(g_bFeatureBT); - - int ret = OAL_STATUS_SUCCESS; - - ret = adapter_start_inquiry(0); - ASSERT_TRUE(ret == OAL_STATUS_SUCCESS); - - wait_for_async(TIMEOUT_2SECONDS); - - ret = adapter_stop_inquiry(); - ASSERT_TRUE(ret == OAL_STATUS_SUCCESS); - wait_for_async(TIMEOUT_2SECONDS); -} - -TEST(BluetoothHAL_test, adapter_get_properties_p) { - SKIP_NOT_SUPPORTED(g_bFeatureBT); - - int ret = OAL_STATUS_SUCCESS; - - ret = adapter_get_properties(); - ASSERT_TRUE(ret == OAL_STATUS_SUCCESS); - - wait_for_async(TIMEOUT_500MILISECONDS); -} - -TEST(BluetoothHAL_test, adapter_get_address_p) { - SKIP_NOT_SUPPORTED(g_bFeatureBT); - - int ret = OAL_STATUS_SUCCESS; - - ret = adapter_get_address(); - ASSERT_TRUE(ret == OAL_STATUS_SUCCESS); - - wait_for_async(TIMEOUT_500MILISECONDS); -} - -TEST(BluetoothHAL_test, adapter_get_version_p) { - SKIP_NOT_SUPPORTED(g_bFeatureBT); - - int ret = OAL_STATUS_SUCCESS; - - ret = adapter_get_version(); - ASSERT_TRUE(ret == OAL_STATUS_SUCCESS); - - wait_for_async(TIMEOUT_500MILISECONDS); -} - -TEST(BluetoothHAL_test, adapter_get_name_p) { - SKIP_NOT_SUPPORTED(g_bFeatureBT); - - int ret = OAL_STATUS_SUCCESS; - - ret = adapter_get_name(); - ASSERT_TRUE(ret == OAL_STATUS_SUCCESS); - - wait_for_async(TIMEOUT_500MILISECONDS); -} - -TEST(BluetoothHAL_test, adapter_set_name_p) { - SKIP_NOT_SUPPORTED(g_bFeatureBT); - - int ret = OAL_STATUS_SUCCESS; - - ret = adapter_set_name((char *)"TizenHAL"); - ASSERT_TRUE(ret == OAL_STATUS_SUCCESS); - - wait_for_async(TIMEOUT_500MILISECONDS); -} - -TEST(BluetoothHAL_test, adapter_is_discoverable_p) { - SKIP_NOT_SUPPORTED(g_bFeatureBT); - - int ret = OAL_STATUS_SUCCESS; - int scan_mode = 0; - - ret = adapter_is_discoverable(&scan_mode); - ASSERT_TRUE(ret == OAL_STATUS_SUCCESS); -} - -TEST(BluetoothHAL_test, adapter_is_connectable_p) { - SKIP_NOT_SUPPORTED(g_bFeatureBT); - - int ret = OAL_STATUS_SUCCESS; - int connectable = 0; - - ret = adapter_is_connectable(&connectable); - ASSERT_TRUE(ret == OAL_STATUS_SUCCESS); -} - -TEST(BluetoothHAL_test, adapter_get_discoverable_timeout_p) { - SKIP_NOT_SUPPORTED(g_bFeatureBT); - - int ret = OAL_STATUS_SUCCESS; - int timeout = 0; - - ret = adapter_get_discoverable_timeout(&timeout); - ASSERT_TRUE(ret == OAL_STATUS_SUCCESS); -} - -TEST(BluetoothHAL_test, adapter_get_service_uuids_p) { - SKIP_NOT_SUPPORTED(g_bFeatureBT); - - int ret = OAL_STATUS_SUCCESS; - - ret = adapter_get_service_uuids(); - ASSERT_TRUE(ret == OAL_STATUS_SUCCESS); - - wait_for_async(TIMEOUT_500MILISECONDS); -} - -TEST(BluetoothHAL_test, adapter_set_connectable_p) { - SKIP_NOT_SUPPORTED(g_bFeatureBT); - - int ret = OAL_STATUS_SUCCESS; - - ret = adapter_set_connectable(BT_SCAN_MODE_CONNECTABLE); - ASSERT_TRUE(ret == OAL_STATUS_SUCCESS); - - wait_for_async(TIMEOUT_500MILISECONDS); -} - -TEST(BluetoothHAL_test, adapter_set_discoverable_timeout_p) { - SKIP_NOT_SUPPORTED(g_bFeatureBT); - - int ret = OAL_STATUS_SUCCESS; - - ret = adapter_set_discoverable_timeout(0); - ASSERT_TRUE(ret == OAL_STATUS_SUCCESS); - - wait_for_async(TIMEOUT_500MILISECONDS); - - /* Post condition : Disable BT */ - ret = adapter_disable(); - ASSERT_TRUE(ret == OAL_STATUS_SUCCESS); - - wait_for_async(TIMEOUT_6SECONDS); - - oal_bt_deinit(); - - wait_for_async(TIMEOUT_500MILISECONDS); -} - - -int main(int argc, char **argv) { - InitGoogleTest(&argc, argv); - - return RUN_ALL_TESTS(); -} diff --git a/packaging/bluetooth-frwk.spec b/packaging/bluetooth-frwk.spec index 77696e6..8920fd5 100644 --- a/packaging/bluetooth-frwk.spec +++ b/packaging/bluetooth-frwk.spec @@ -53,7 +53,6 @@ BuildRequires: pkgconfig(ell) BuildRequires: pkgconfig(storage) BuildRequires: pkgconfig(capi-system-info) BuildRequires: pkgconfig(capi-appfw-app-control) -BuildRequires: pkgconfig(gmock) BuildRequires: pkgconfig(libactd) BuildRequires: pkgconfig(libsystemd) BuildRequires: pkgconfig(hal-api-bluetooth) @@ -200,14 +199,6 @@ Requires: %{name} = %{version}-%{release} %description plugin-headed This package is Bluetooth plugin to manage UI and syspopup -%package -n bluetooth-haltests -Summary: HAL Test package for bluetooth OAL -Group: TO_BE/FILLED -Requires: %{name} = %{version}-%{release} - -%description -n bluetooth-haltests -This package is C-API test application. - %prep %setup -q cp %{SOURCE1001} . @@ -626,7 +617,3 @@ popd %if %{bt_bluez_hal} == ENABLED %{_libdir}/libbluetooth.default.so* %endif - -%files -n bluetooth-haltests -%manifest %{name}.manifest -%{_bindir}/bluetooth-haltests