# 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", "//third_party/bounds_checking_function/include", ] deps = [ "$dsoftbus_root_path/adapter:softbus_adapter", "$dsoftbus_root_path/core/common/dfx/log:softbus_dfx_log", "$hilog_lite_deps_path", "//third_party/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", "//third_party/bounds_checking_function/include", ] deps = [ "../../../adapter:softbus_adapter", "//third_party/bounds_checking_function:libsec_static", "//third_party/googletest:gtest_main", ] if (is_standard_system) { external_deps = [ "c_utils:utils", "hilog:libhilog", ] } else { external_deps = [ "c_utils:utils", "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", "//third_party/bounds_checking_function/include", ] deps = [ "../../../adapter:softbus_adapter", "//third_party/bounds_checking_function:libsec_static", "//third_party/googletest:gtest_main", ] if (is_standard_system) { external_deps = [ "c_utils:utils", "hilog:libhilog", ] } else { external_deps = [ "c_utils:utils", "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", "//third_party/bounds_checking_function/include", ] deps = [ "../../../adapter:softbus_adapter", "//third_party/bounds_checking_function:libsec_static", "//third_party/googletest:gtest_main", ] if (is_standard_system) { external_deps = [ "c_utils:utils", "hilog:libhilog", ] } else { external_deps = [ "c_utils:utils", "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", "//third_party/bounds_checking_function/include", ] deps = [ "../../../adapter:softbus_adapter", "//third_party/bounds_checking_function:libsec_static", "//third_party/googletest:gtest_main", ] if (is_standard_system) { external_deps = [ "c_utils:utils", "hilog:libhilog", ] } else { external_deps = [ "c_utils:utils", "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", "//third_party/bounds_checking_function/include", ] deps = [ "../../../adapter:softbus_adapter", "//third_party/bounds_checking_function:libsec_static", "//third_party/googletest:gtest_main", ] if (is_standard_system) { external_deps = [ "c_utils:utils", "hilog:libhilog", ] } else { external_deps = [ "c_utils:utils", "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", "//third_party/bounds_checking_function/include", ] deps = [ "../../../adapter:softbus_adapter", "//third_party/bounds_checking_function:libsec_static", "//third_party/googletest:gtest_main", ] if (is_standard_system) { external_deps = [ "c_utils:utils", "hilog:libhilog", ] } else { external_deps = [ "c_utils:utils", "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", "//third_party/bounds_checking_function/include", ] deps = [ "../../../adapter:softbus_adapter", "//third_party/bounds_checking_function:libsec_static", "//third_party/googletest:gtest_main", ] if (is_standard_system) { external_deps = [ "c_utils:utils", "hilog:libhilog", ] } else { external_deps = [ "c_utils:utils", "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 = [ "../../../adapter:softbus_adapter", "//third_party/googletest:gtest_main", ] if (is_standard_system) { external_deps = [ "c_utils:utils", "hilog:libhilog", ] } else { external_deps = [ "c_utils:utils", "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 = [ "../../../adapter:softbus_adapter", "//third_party/googletest:gtest_main", ] if (is_standard_system) { external_deps = [ "c_utils:utils", "hilog:libhilog", ] } else { external_deps = [ "c_utils:utils", "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", "//foundation/communication/wifi/wifi/frameworks/native/interfaces", "//foundation/communication/wifi/wifi/interfaces/kits/c", "//foundation/communication/wifi/wifi/interfaces/inner_api", "//foundation/communication/wifi/wifi/frameworks/native/include", "//foundation/communication/ipc/interfaces/innerkits/ipc_core/include", "//foundation/communication/wifi/wifi/services/wifi_standard/wifi_framework/wifi_toolkit/net_helper", "//foundation/communication/samgr/interfaces/innerkits/samgr_proxy/include", "//foundation/systemabilitymgr/samgr/interfaces/innerkits/samgr_proxy/include", "//foundation/systemabilitymgr/samgr/adapter/interfaces/innerkits/include", "$dsoftbus_root_path/core/common/include", "$dsoftbus_root_path/core/common/dfx/interface/include", ] deps = [ "$dsoftbus_root_path/core/common:softbus_utils", "$dsoftbus_root_path/core/common/dfx/log:softbus_dfx_log", "../../../adapter:softbus_adapter", "//third_party/googletest:gmock", "//third_party/googletest:gtest_main", ] if (is_standard_system) { external_deps = [ "c_utils:utils", "hilog:libhilog", ] } else { external_deps = [ "c_utils:utils", "hilog:libhilog", ] } } 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", "$dsoftbus_root_path/core/common/dfx/interface/include", ] deps = [ "//foundation/communication/dsoftbus/core/common/dfx/log:softbus_dfx_log", "//third_party/googletest:gmock", "//third_party/googletest:gtest_main", ] if (is_standard_system) { external_deps = [ "c_utils:utils", "hilog:libhilog", ] } else { external_deps = [ "c_utils:utils", "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/core/common/dfx/log:softbus_dfx_log", "$dsoftbus_root_path/core/frame:softbus_server", "../../../adapter:softbus_adapter", "//third_party/googletest:gtest_main", ] if (is_standard_system) { external_deps = [ "c_utils:utils", "hilog:libhilog", ] } else { external_deps = [ "c_utils:utils", "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" ] } } }