# Copyright (c) 2021-2023 Huawei Device Co., Ltd. # 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. import("../../../core/common/dfx/dsoftbus_dfx.gni") if (defined(ohos_lite)) { import("//build/lite/config/component/lite_component.gni") import("//build/lite/config/test.gni") import("../../../dsoftbus.gni") dsoftbus_root_path = "../../.." defines += [ "HAVE_PRO = 0" ] if (ohos_build_type == "debug") { unittest("AdapterTest") { output_extension = "bin" output_dir = "$root_out_dir/test/unittest/dsoftbus" sources = [ "dsoftbus_crypto_test.cpp", "dsoftbus_other_test.cpp", "softbus_adapter_range_test.cpp", "softbus_socket_test.cpp", ] include_dirs = [ "$dsoftbus_root_path/adapter/common/include", "$dsoftbus_root_path/core/common/include/", "$dsoftbus_root_path/core/common/dfx/interface/include", "$dsoftbus_root_path/interfaces/kits/common", "$hilog_lite_include_path", ] deps = [ "$dsoftbus_root_path/adapter:softbus_adapter", "$dsoftbus_root_path/core/common/dfx/log:softbus_dfx_log", "$hilog_lite_deps_path", ] external_deps = [ "bounds_checking_function:libsec_static" ] } } } else { import("//build/test.gni") import("../../../dsoftbus.gni") defines += [ "HAVE_PRO = 0" ] module_output_path = "dsoftbus/adapter" ohos_unittest("AdaptorDsoftbusCryptTest") { module_out_path = module_output_path sources = [ "dsoftbus_crypto_test.cpp" ] include_dirs = [ "$dsoftbus_root_path/adapter/common/include", "$dsoftbus_root_path/core/common/include/", "$dsoftbus_root_path/interfaces/kits/common", ] deps = [ "../../../adapter:softbus_adapter" ] external_deps = [ "bounds_checking_function:libsec_static", "hilog:libhilog", ] } ohos_unittest("AdapterDsoftbusAesCryptoTest") { module_out_path = module_output_path sources = [ "dsoftbus_aes_crypto_test.cpp" ] include_dirs = [ "$dsoftbus_root_path/adapter/common/include", "$dsoftbus_root_path/core/common/include/", "$dsoftbus_root_path/interfaces/kits/common", ] deps = [ "$dsoftbus_root_path/adapter:softbus_adapter" ] external_deps = [ "bounds_checking_function:libsec_static", "googletest:gtest_main", "hilog:libhilog", ] } ohos_unittest("AdapterDsoftbusDfxTest") { module_out_path = module_output_path sources = [ "softbus_dfx_test.cpp" ] include_dirs = [ "$dsoftbus_root_path/adapter/common/include", "$dsoftbus_root_path/core/common/include/", "$dsoftbus_root_path/interfaces/kits/common", ] deps = [ "$dsoftbus_root_path/adapter:softbus_adapter" ] external_deps = [ "bounds_checking_function:libsec_static", "googletest:gtest_main", "hilog:libhilog", ] } ohos_unittest("AdapterDsoftbusOtherTest") { module_out_path = module_output_path sources = [ "dsoftbus_other_test.cpp" ] include_dirs = [ "$dsoftbus_root_path/adapter/common/include", "$dsoftbus_root_path/core/common/include/", "$dsoftbus_root_path/interfaces/kits/common", ] deps = [ "$dsoftbus_root_path/adapter:softbus_adapter" ] external_deps = [ "bounds_checking_function:libsec_static", "googletest:gtest_main", "hilog:libhilog", ] } ohos_unittest("AdapterDsoftbusRangeTest") { module_out_path = module_output_path sources = [ "softbus_adapter_range_test.cpp" ] include_dirs = [ "$dsoftbus_root_path/adapter/common/include", "$dsoftbus_root_path/core/common/include/", "$dsoftbus_root_path/interfaces/kits/common", ] deps = [ "$dsoftbus_root_path/adapter:softbus_adapter" ] external_deps = [ "bounds_checking_function:libsec_static", "googletest:gtest_main", "hilog:libhilog", ] } ohos_unittest("AdapterDsoftbusSocketTest") { module_out_path = module_output_path sources = [ "softbus_socket_test.cpp" ] include_dirs = [ "$dsoftbus_root_path/adapter/common/include", "$dsoftbus_root_path/core/common/include/", "$dsoftbus_root_path/interfaces/kits/common", ] deps = [ "$dsoftbus_root_path/adapter:softbus_adapter" ] external_deps = [ "bounds_checking_function:libsec_static", "googletest:gtest_main", "hilog:libhilog", ] } ohos_unittest("SoftbusThreadTest") { module_out_path = module_output_path sources = [ "softbus_thread_test.cpp" ] include_dirs = [ "$dsoftbus_root_path/adapter/common/include", "$dsoftbus_root_path/core/common/include/", "$dsoftbus_root_path/interfaces/kits/common", ] deps = [ "../../../adapter:softbus_adapter" ] external_deps = [ "bounds_checking_function:libsec_static", "googletest:gtest_main", "hilog:libhilog", ] } ohos_unittest("SoftbusTimeTest") { module_out_path = module_output_path sources = [ "softbus_time_test.cpp" ] include_dirs = [ "$dsoftbus_root_path/adapter/common/include", "$dsoftbus_root_path/interfaces/kits/common", "$dsoftbus_root_path/core/common/include/", ] deps = [ "$dsoftbus_root_path/adapter:softbus_adapter" ] external_deps = [ "googletest:gtest_main", "hilog:libhilog", ] } ohos_unittest("AdaptorDsoftbusFileTest") { module_out_path = module_output_path sources = [ "softbus_file_test.cpp" ] include_dirs = [ "$dsoftbus_root_path/adapter/common/include", "$dsoftbus_root_path/interfaces/kits/common", "$dsoftbus_root_path/core/common/include/", ] deps = [ "$dsoftbus_root_path/adapter:softbus_adapter" ] external_deps = [ "hilog:libhilog" ] } ohos_unittest("AdapterDsoftbusWifiTest") { module_out_path = module_output_path sources = [ "$dsoftbus_root_path/adapter/common/net/wifi/common/softbus_wifi_api_adapter.c", "$dsoftbus_root_path/tests/core/bus_center/mock_common/src/wifi_mock.cpp", "softbus_wifi_api_test.cpp", ] include_dirs = [ "$dsoftbus_root_path/interfaces/kits/common", "$dsoftbus_root_path/tests/core/bus_center/mock_common/src", "$dsoftbus_root_path/tests/core/bus_center/mock_common/include", "$dsoftbus_root_path/adapter/common/net/wifi/include", "$dsoftbus_root_path/adapter/common/net/wifi/common", "$dsoftbus_root_path/core/common/include", "$dsoftbus_root_path/core/common/dfx/interface/include", ] deps = [ "$dsoftbus_root_path/adapter:softbus_adapter", "$dsoftbus_root_path/core/common:softbus_utils", "$dsoftbus_root_path/core/common/dfx/log:softbus_dfx_log", ] external_deps = [ "c_utils:utils", "googletest:gmock", "googletest:gtest_main", "hilog:libhilog", "ipc:ipc_core", "samgr:samgr_proxy", ] if (!defined(ohos_lite) && softbus_communication_wifi_feature == true) { external_deps += [ "wifi:wifi_sdk" ] } } ohos_unittest("AdapterDsoftbusNetworkTest") { module_out_path = module_output_path sources = [ "$dsoftbus_root_path/adapter/common/kernel/liteos_m/softbus_adapter_mem.c", "$dsoftbus_root_path/core/common/message_handler/message_handler.c", "$dsoftbus_root_path/core/common/utils/softbus_utils.c", "$dsoftbus_root_path/tests/core/bus_center/mock_common/src/network_mock.cpp", "softbus_network_test.cpp", ] include_dirs = [ "$dsoftbus_root_path/adapter/default_config/spec_config", "$dsoftbus_root_path/core/connection/interface", "$dsoftbus_root_path/core/bus_center/interface", "$dsoftbus_root_path/interfaces/kits/bus_center", "$dsoftbus_root_path/adapter/common/include/OS_adapter_define/linux", "$dsoftbus_root_path/adapter/default_config/spec_config", "$dsoftbus_root_path/adapter/common/bus_center/include", "$dsoftbus_root_path/interfaces/kits/common", "$dsoftbus_root_path/tests/core/bus_center/mock_common/include", "$dsoftbus_root_path/adapter/common/bus_center/network", "$dsoftbus_root_path/core/bus_center/service/include", "$dsoftbus_root_path/core/bus_center/utils/include/lnn_async_callback_utils.h", "$dsoftbus_root_path/adapter/common/net/bluetooth/include", "$dsoftbus_root_path/adapter/common/include", "$dsoftbus_root_path/core/bus_center/service/include", "$dsoftbus_root_path/core/bus_center/utils/include", "$dsoftbus_root_path/core/bus_center/lnn/net_buscenter/include", "$dsoftbus_root_path/adapter/common/include", "$dsoftbus_root_path/core/common/include", ] deps = [ "$dsoftbus_root_path/core/common:softbus_utils" ] external_deps = [ "googletest:gmock", "googletest:gtest_main", "hilog:libhilog", ] } ohos_unittest("AdapterWlanExtendTest") { module_out_path = module_output_path sources = [ "softbus_adapter_wlan_extend_test.cpp" ] include_dirs = [ "$dsoftbus_root_path/adapter/common/include", "$dsoftbus_root_path/interfaces/kits/common", "$dsoftbus_root_path/core/common/include/", "$dsoftbus_root_path/core/bus_center/utils/include/", "$dsoftbus_root_path/adapter/common/net/hdi/include/", "$dsoftbus_root_path/core/common/dfx/interface/include", ] deps = [ "$dsoftbus_root_path/adapter:softbus_adapter", "$dsoftbus_root_path/core/common/dfx/log:softbus_dfx_log", "$dsoftbus_root_path/core/frame:softbus_server", ] external_deps = [ "googletest:gtest_main", "hilog:libhilog", ] } group("unittest") { testonly = true deps = [ ":AdapterDsoftbusAesCryptoTest", ":AdapterDsoftbusDfxTest", ":AdapterDsoftbusOtherTest", ":AdapterDsoftbusRangeTest", ":AdapterDsoftbusSocketTest", ":AdapterWlanExtendTest", ":AdaptorDsoftbusCryptTest", ":AdaptorDsoftbusFileTest", ":SoftbusThreadTest", ":SoftbusTimeTest", ] if (!defined(ohos_lite) && softbus_communication_wifi_feature == true) { deps += [ ":AdapterDsoftbusWifiTest" ] } if (!defined(ohos_lite) && dsoftbus_feature_lnn_net == true && support_bluetooth && dsoftbus_feature_conn_ble) { deps += [ ":AdapterDsoftbusNetworkTest" ] } } }