1060ff233Sopenharmony_ci# Copyright (c) 2021-2023 Huawei Device Co., Ltd.
2060ff233Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
3060ff233Sopenharmony_ci# you may not use this file except in compliance with the License.
4060ff233Sopenharmony_ci# You may obtain a copy of the License at
5060ff233Sopenharmony_ci#
6060ff233Sopenharmony_ci#     http://www.apache.org/licenses/LICENSE-2.0
7060ff233Sopenharmony_ci#
8060ff233Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software
9060ff233Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
10060ff233Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11060ff233Sopenharmony_ci# See the License for the specific language governing permissions and
12060ff233Sopenharmony_ci# limitations under the License.
13060ff233Sopenharmony_ci
14060ff233Sopenharmony_ciimport("../../../core/common/dfx/dsoftbus_dfx.gni")
15060ff233Sopenharmony_ciif (defined(ohos_lite)) {
16060ff233Sopenharmony_ci  import("//build/lite/config/component/lite_component.gni")
17060ff233Sopenharmony_ci  import("//build/lite/config/test.gni")
18060ff233Sopenharmony_ci  import("../../../dsoftbus.gni")
19060ff233Sopenharmony_ci
20060ff233Sopenharmony_ci  dsoftbus_root_path = "../../.."
21060ff233Sopenharmony_ci
22060ff233Sopenharmony_ci  defines += [ "HAVE_PRO = 0" ]
23060ff233Sopenharmony_ci
24060ff233Sopenharmony_ci  if (ohos_build_type == "debug") {
25060ff233Sopenharmony_ci    unittest("AdapterTest") {
26060ff233Sopenharmony_ci      output_extension = "bin"
27060ff233Sopenharmony_ci      output_dir = "$root_out_dir/test/unittest/dsoftbus"
28060ff233Sopenharmony_ci      sources = [
29060ff233Sopenharmony_ci        "dsoftbus_crypto_test.cpp",
30060ff233Sopenharmony_ci        "dsoftbus_other_test.cpp",
31060ff233Sopenharmony_ci        "softbus_adapter_range_test.cpp",
32060ff233Sopenharmony_ci        "softbus_socket_test.cpp",
33060ff233Sopenharmony_ci      ]
34060ff233Sopenharmony_ci      include_dirs = [
35060ff233Sopenharmony_ci        "$dsoftbus_root_path/adapter/common/include",
36060ff233Sopenharmony_ci        "$dsoftbus_root_path/core/common/include/",
37060ff233Sopenharmony_ci        "$dsoftbus_root_path/core/common/dfx/interface/include",
38060ff233Sopenharmony_ci        "$dsoftbus_root_path/interfaces/kits/common",
39060ff233Sopenharmony_ci        "$hilog_lite_include_path",
40060ff233Sopenharmony_ci      ]
41060ff233Sopenharmony_ci      deps = [
42060ff233Sopenharmony_ci        "$dsoftbus_root_path/adapter:softbus_adapter",
43060ff233Sopenharmony_ci        "$dsoftbus_root_path/core/common/dfx/log:softbus_dfx_log",
44060ff233Sopenharmony_ci        "$hilog_lite_deps_path",
45060ff233Sopenharmony_ci      ]
46060ff233Sopenharmony_ci
47060ff233Sopenharmony_ci      external_deps = [ "bounds_checking_function:libsec_static" ]
48060ff233Sopenharmony_ci    }
49060ff233Sopenharmony_ci  }
50060ff233Sopenharmony_ci} else {
51060ff233Sopenharmony_ci  import("//build/test.gni")
52060ff233Sopenharmony_ci  import("../../../dsoftbus.gni")
53060ff233Sopenharmony_ci  defines += [ "HAVE_PRO = 0" ]
54060ff233Sopenharmony_ci  module_output_path = "dsoftbus/adapter"
55060ff233Sopenharmony_ci
56060ff233Sopenharmony_ci  ohos_unittest("AdaptorDsoftbusCryptTest") {
57060ff233Sopenharmony_ci    module_out_path = module_output_path
58060ff233Sopenharmony_ci    sources = [ "dsoftbus_crypto_test.cpp" ]
59060ff233Sopenharmony_ci    include_dirs = [
60060ff233Sopenharmony_ci      "$dsoftbus_root_path/adapter/common/include",
61060ff233Sopenharmony_ci      "$dsoftbus_root_path/core/common/include/",
62060ff233Sopenharmony_ci      "$dsoftbus_root_path/interfaces/kits/common",
63060ff233Sopenharmony_ci    ]
64060ff233Sopenharmony_ci    deps = [ "../../../adapter:softbus_adapter" ]
65060ff233Sopenharmony_ci    external_deps = [
66060ff233Sopenharmony_ci      "bounds_checking_function:libsec_static",
67060ff233Sopenharmony_ci      "hilog:libhilog",
68060ff233Sopenharmony_ci    ]
69060ff233Sopenharmony_ci  }
70060ff233Sopenharmony_ci
71060ff233Sopenharmony_ci  ohos_unittest("AdapterDsoftbusAesCryptoTest") {
72060ff233Sopenharmony_ci    module_out_path = module_output_path
73060ff233Sopenharmony_ci    sources = [ "dsoftbus_aes_crypto_test.cpp" ]
74060ff233Sopenharmony_ci    include_dirs = [
75060ff233Sopenharmony_ci      "$dsoftbus_root_path/adapter/common/include",
76060ff233Sopenharmony_ci      "$dsoftbus_root_path/core/common/include/",
77060ff233Sopenharmony_ci      "$dsoftbus_root_path/interfaces/kits/common",
78060ff233Sopenharmony_ci    ]
79060ff233Sopenharmony_ci    deps = [ "$dsoftbus_root_path/adapter:softbus_adapter" ]
80060ff233Sopenharmony_ci
81060ff233Sopenharmony_ci    external_deps = [
82060ff233Sopenharmony_ci      "bounds_checking_function:libsec_static",
83060ff233Sopenharmony_ci      "googletest:gtest_main",
84060ff233Sopenharmony_ci      "hilog:libhilog",
85060ff233Sopenharmony_ci    ]
86060ff233Sopenharmony_ci  }
87060ff233Sopenharmony_ci
88060ff233Sopenharmony_ci  ohos_unittest("AdapterDsoftbusDfxTest") {
89060ff233Sopenharmony_ci    module_out_path = module_output_path
90060ff233Sopenharmony_ci    sources = [ "softbus_dfx_test.cpp" ]
91060ff233Sopenharmony_ci    include_dirs = [
92060ff233Sopenharmony_ci      "$dsoftbus_root_path/adapter/common/include",
93060ff233Sopenharmony_ci      "$dsoftbus_root_path/core/common/include/",
94060ff233Sopenharmony_ci      "$dsoftbus_root_path/interfaces/kits/common",
95060ff233Sopenharmony_ci    ]
96060ff233Sopenharmony_ci    deps = [ "$dsoftbus_root_path/adapter:softbus_adapter" ]
97060ff233Sopenharmony_ci
98060ff233Sopenharmony_ci    external_deps = [
99060ff233Sopenharmony_ci      "bounds_checking_function:libsec_static",
100060ff233Sopenharmony_ci      "googletest:gtest_main",
101060ff233Sopenharmony_ci      "hilog:libhilog",
102060ff233Sopenharmony_ci    ]
103060ff233Sopenharmony_ci  }
104060ff233Sopenharmony_ci
105060ff233Sopenharmony_ci  ohos_unittest("AdapterDsoftbusOtherTest") {
106060ff233Sopenharmony_ci    module_out_path = module_output_path
107060ff233Sopenharmony_ci    sources = [ "dsoftbus_other_test.cpp" ]
108060ff233Sopenharmony_ci    include_dirs = [
109060ff233Sopenharmony_ci      "$dsoftbus_root_path/adapter/common/include",
110060ff233Sopenharmony_ci      "$dsoftbus_root_path/core/common/include/",
111060ff233Sopenharmony_ci      "$dsoftbus_root_path/interfaces/kits/common",
112060ff233Sopenharmony_ci    ]
113060ff233Sopenharmony_ci    deps = [ "$dsoftbus_root_path/adapter:softbus_adapter" ]
114060ff233Sopenharmony_ci
115060ff233Sopenharmony_ci    external_deps = [
116060ff233Sopenharmony_ci      "bounds_checking_function:libsec_static",
117060ff233Sopenharmony_ci      "googletest:gtest_main",
118060ff233Sopenharmony_ci      "hilog:libhilog",
119060ff233Sopenharmony_ci    ]
120060ff233Sopenharmony_ci  }
121060ff233Sopenharmony_ci
122060ff233Sopenharmony_ci  ohos_unittest("AdapterDsoftbusRangeTest") {
123060ff233Sopenharmony_ci    module_out_path = module_output_path
124060ff233Sopenharmony_ci    sources = [ "softbus_adapter_range_test.cpp" ]
125060ff233Sopenharmony_ci    include_dirs = [
126060ff233Sopenharmony_ci      "$dsoftbus_root_path/adapter/common/include",
127060ff233Sopenharmony_ci      "$dsoftbus_root_path/core/common/include/",
128060ff233Sopenharmony_ci      "$dsoftbus_root_path/interfaces/kits/common",
129060ff233Sopenharmony_ci    ]
130060ff233Sopenharmony_ci    deps = [ "$dsoftbus_root_path/adapter:softbus_adapter" ]
131060ff233Sopenharmony_ci    external_deps = [
132060ff233Sopenharmony_ci      "bounds_checking_function:libsec_static",
133060ff233Sopenharmony_ci      "googletest:gtest_main",
134060ff233Sopenharmony_ci      "hilog:libhilog",
135060ff233Sopenharmony_ci    ]
136060ff233Sopenharmony_ci  }
137060ff233Sopenharmony_ci
138060ff233Sopenharmony_ci  ohos_unittest("AdapterDsoftbusSocketTest") {
139060ff233Sopenharmony_ci    module_out_path = module_output_path
140060ff233Sopenharmony_ci    sources = [ "softbus_socket_test.cpp" ]
141060ff233Sopenharmony_ci    include_dirs = [
142060ff233Sopenharmony_ci      "$dsoftbus_root_path/adapter/common/include",
143060ff233Sopenharmony_ci      "$dsoftbus_root_path/core/common/include/",
144060ff233Sopenharmony_ci      "$dsoftbus_root_path/interfaces/kits/common",
145060ff233Sopenharmony_ci    ]
146060ff233Sopenharmony_ci    deps = [ "$dsoftbus_root_path/adapter:softbus_adapter" ]
147060ff233Sopenharmony_ci
148060ff233Sopenharmony_ci    external_deps = [
149060ff233Sopenharmony_ci      "bounds_checking_function:libsec_static",
150060ff233Sopenharmony_ci      "googletest:gtest_main",
151060ff233Sopenharmony_ci      "hilog:libhilog",
152060ff233Sopenharmony_ci    ]
153060ff233Sopenharmony_ci  }
154060ff233Sopenharmony_ci
155060ff233Sopenharmony_ci  ohos_unittest("SoftbusThreadTest") {
156060ff233Sopenharmony_ci    module_out_path = module_output_path
157060ff233Sopenharmony_ci    sources = [ "softbus_thread_test.cpp" ]
158060ff233Sopenharmony_ci    include_dirs = [
159060ff233Sopenharmony_ci      "$dsoftbus_root_path/adapter/common/include",
160060ff233Sopenharmony_ci      "$dsoftbus_root_path/core/common/include/",
161060ff233Sopenharmony_ci      "$dsoftbus_root_path/interfaces/kits/common",
162060ff233Sopenharmony_ci    ]
163060ff233Sopenharmony_ci    deps = [ "../../../adapter:softbus_adapter" ]
164060ff233Sopenharmony_ci    external_deps = [
165060ff233Sopenharmony_ci      "bounds_checking_function:libsec_static",
166060ff233Sopenharmony_ci      "googletest:gtest_main",
167060ff233Sopenharmony_ci      "hilog:libhilog",
168060ff233Sopenharmony_ci    ]
169060ff233Sopenharmony_ci  }
170060ff233Sopenharmony_ci
171060ff233Sopenharmony_ci  ohos_unittest("SoftbusTimeTest") {
172060ff233Sopenharmony_ci    module_out_path = module_output_path
173060ff233Sopenharmony_ci    sources = [ "softbus_time_test.cpp" ]
174060ff233Sopenharmony_ci    include_dirs = [
175060ff233Sopenharmony_ci      "$dsoftbus_root_path/adapter/common/include",
176060ff233Sopenharmony_ci      "$dsoftbus_root_path/interfaces/kits/common",
177060ff233Sopenharmony_ci      "$dsoftbus_root_path/core/common/include/",
178060ff233Sopenharmony_ci    ]
179060ff233Sopenharmony_ci    deps = [ "$dsoftbus_root_path/adapter:softbus_adapter" ]
180060ff233Sopenharmony_ci
181060ff233Sopenharmony_ci    external_deps = [
182060ff233Sopenharmony_ci      "googletest:gtest_main",
183060ff233Sopenharmony_ci      "hilog:libhilog",
184060ff233Sopenharmony_ci    ]
185060ff233Sopenharmony_ci  }
186060ff233Sopenharmony_ci
187060ff233Sopenharmony_ci  ohos_unittest("AdaptorDsoftbusFileTest") {
188060ff233Sopenharmony_ci    module_out_path = module_output_path
189060ff233Sopenharmony_ci    sources = [ "softbus_file_test.cpp" ]
190060ff233Sopenharmony_ci    include_dirs = [
191060ff233Sopenharmony_ci      "$dsoftbus_root_path/adapter/common/include",
192060ff233Sopenharmony_ci      "$dsoftbus_root_path/interfaces/kits/common",
193060ff233Sopenharmony_ci      "$dsoftbus_root_path/core/common/include/",
194060ff233Sopenharmony_ci    ]
195060ff233Sopenharmony_ci    deps = [ "$dsoftbus_root_path/adapter:softbus_adapter" ]
196060ff233Sopenharmony_ci    external_deps = [ "hilog:libhilog" ]
197060ff233Sopenharmony_ci  }
198060ff233Sopenharmony_ci
199060ff233Sopenharmony_ci  ohos_unittest("AdapterDsoftbusWifiTest") {
200060ff233Sopenharmony_ci    module_out_path = module_output_path
201060ff233Sopenharmony_ci    sources = [
202060ff233Sopenharmony_ci      "$dsoftbus_root_path/adapter/common/net/wifi/common/softbus_wifi_api_adapter.c",
203060ff233Sopenharmony_ci      "$dsoftbus_root_path/tests/core/bus_center/mock_common/src/wifi_mock.cpp",
204060ff233Sopenharmony_ci      "softbus_wifi_api_test.cpp",
205060ff233Sopenharmony_ci    ]
206060ff233Sopenharmony_ci    include_dirs = [
207060ff233Sopenharmony_ci      "$dsoftbus_root_path/interfaces/kits/common",
208060ff233Sopenharmony_ci      "$dsoftbus_root_path/tests/core/bus_center/mock_common/src",
209060ff233Sopenharmony_ci      "$dsoftbus_root_path/tests/core/bus_center/mock_common/include",
210060ff233Sopenharmony_ci      "$dsoftbus_root_path/adapter/common/net/wifi/include",
211060ff233Sopenharmony_ci      "$dsoftbus_root_path/adapter/common/net/wifi/common",
212060ff233Sopenharmony_ci      "$dsoftbus_root_path/core/common/include",
213060ff233Sopenharmony_ci      "$dsoftbus_root_path/core/common/dfx/interface/include",
214060ff233Sopenharmony_ci    ]
215060ff233Sopenharmony_ci    deps = [
216060ff233Sopenharmony_ci      "$dsoftbus_root_path/adapter:softbus_adapter",
217060ff233Sopenharmony_ci      "$dsoftbus_root_path/core/common:softbus_utils",
218060ff233Sopenharmony_ci      "$dsoftbus_root_path/core/common/dfx/log:softbus_dfx_log",
219060ff233Sopenharmony_ci    ]
220060ff233Sopenharmony_ci    external_deps = [
221060ff233Sopenharmony_ci      "c_utils:utils",
222060ff233Sopenharmony_ci      "googletest:gmock",
223060ff233Sopenharmony_ci      "googletest:gtest_main",
224060ff233Sopenharmony_ci      "hilog:libhilog",
225060ff233Sopenharmony_ci      "ipc:ipc_single",
226060ff233Sopenharmony_ci      "samgr:samgr_proxy",
227060ff233Sopenharmony_ci    ]
228060ff233Sopenharmony_ci    if (!defined(ohos_lite) && softbus_communication_wifi_feature == true) {
229060ff233Sopenharmony_ci      external_deps += [ "wifi:wifi_sdk" ]
230060ff233Sopenharmony_ci    }
231060ff233Sopenharmony_ci  }
232060ff233Sopenharmony_ci
233060ff233Sopenharmony_ci  ohos_unittest("AdapterDsoftbusNetworkTest") {
234060ff233Sopenharmony_ci    module_out_path = module_output_path
235060ff233Sopenharmony_ci    sources = [
236060ff233Sopenharmony_ci      "$dsoftbus_root_path/adapter/common/kernel/liteos_m/softbus_adapter_mem.c",
237060ff233Sopenharmony_ci      "$dsoftbus_root_path/core/common/message_handler/message_handler.c",
238060ff233Sopenharmony_ci      "$dsoftbus_root_path/core/common/utils/softbus_utils.c",
239060ff233Sopenharmony_ci      "$dsoftbus_root_path/tests/core/bus_center/mock_common/src/network_mock.cpp",
240060ff233Sopenharmony_ci      "softbus_network_test.cpp",
241060ff233Sopenharmony_ci    ]
242060ff233Sopenharmony_ci    include_dirs = [
243060ff233Sopenharmony_ci      "$dsoftbus_root_path/adapter/default_config/spec_config",
244060ff233Sopenharmony_ci      "$dsoftbus_root_path/core/connection/interface",
245060ff233Sopenharmony_ci      "$dsoftbus_root_path/core/bus_center/interface",
246060ff233Sopenharmony_ci      "$dsoftbus_root_path/interfaces/kits/bus_center",
247060ff233Sopenharmony_ci      "$dsoftbus_root_path/adapter/common/include/OS_adapter_define/linux",
248060ff233Sopenharmony_ci      "$dsoftbus_root_path/adapter/default_config/spec_config",
249060ff233Sopenharmony_ci      "$dsoftbus_root_path/adapter/common/bus_center/include",
250060ff233Sopenharmony_ci      "$dsoftbus_root_path/interfaces/kits/common",
251060ff233Sopenharmony_ci      "$dsoftbus_root_path/tests/core/bus_center/mock_common/include",
252060ff233Sopenharmony_ci      "$dsoftbus_root_path/adapter/common/bus_center/network",
253060ff233Sopenharmony_ci      "$dsoftbus_root_path/core/bus_center/service/include",
254060ff233Sopenharmony_ci      "$dsoftbus_root_path/core/bus_center/utils/include/lnn_async_callback_utils.h",
255060ff233Sopenharmony_ci      "$dsoftbus_root_path/adapter/common/net/bluetooth/include",
256060ff233Sopenharmony_ci      "$dsoftbus_root_path/adapter/common/include",
257060ff233Sopenharmony_ci      "$dsoftbus_root_path/core/bus_center/service/include",
258060ff233Sopenharmony_ci      "$dsoftbus_root_path/core/bus_center/utils/include",
259060ff233Sopenharmony_ci      "$dsoftbus_root_path/core/bus_center/lnn/net_buscenter/include",
260060ff233Sopenharmony_ci      "$dsoftbus_root_path/adapter/common/include",
261060ff233Sopenharmony_ci      "$dsoftbus_root_path/core/common/include",
262060ff233Sopenharmony_ci      "$dsoftbus_root_path/core/common/dfx/interface/include",
263060ff233Sopenharmony_ci    ]
264060ff233Sopenharmony_ci    deps = [ "$dsoftbus_root_path/core/common:softbus_utils" ]
265060ff233Sopenharmony_ci    external_deps = [
266060ff233Sopenharmony_ci      "googletest:gmock",
267060ff233Sopenharmony_ci      "googletest:gtest_main",
268060ff233Sopenharmony_ci      "hilog:libhilog",
269060ff233Sopenharmony_ci    ]
270060ff233Sopenharmony_ci  }
271060ff233Sopenharmony_ci
272060ff233Sopenharmony_ci  ohos_unittest("AdapterWlanExtendTest") {
273060ff233Sopenharmony_ci    module_out_path = module_output_path
274060ff233Sopenharmony_ci    sources = [ "softbus_adapter_wlan_extend_test.cpp" ]
275060ff233Sopenharmony_ci    include_dirs = [
276060ff233Sopenharmony_ci      "$dsoftbus_root_path/adapter/common/include",
277060ff233Sopenharmony_ci      "$dsoftbus_root_path/interfaces/kits/common",
278060ff233Sopenharmony_ci      "$dsoftbus_root_path/core/common/include/",
279060ff233Sopenharmony_ci      "$dsoftbus_root_path/core/bus_center/utils/include/",
280060ff233Sopenharmony_ci      "$dsoftbus_root_path/adapter/common/net/hdi/include/",
281060ff233Sopenharmony_ci      "$dsoftbus_root_path/core/common/dfx/interface/include",
282060ff233Sopenharmony_ci    ]
283060ff233Sopenharmony_ci    deps = [
284060ff233Sopenharmony_ci      "$dsoftbus_root_path/adapter:softbus_adapter",
285060ff233Sopenharmony_ci      "$dsoftbus_root_path/core/common/dfx/log:softbus_dfx_log",
286060ff233Sopenharmony_ci      "$dsoftbus_root_path/core/frame:softbus_server",
287060ff233Sopenharmony_ci    ]
288060ff233Sopenharmony_ci    external_deps = [
289060ff233Sopenharmony_ci      "googletest:gtest_main",
290060ff233Sopenharmony_ci      "hilog:libhilog",
291060ff233Sopenharmony_ci    ]
292060ff233Sopenharmony_ci  }
293060ff233Sopenharmony_ci
294060ff233Sopenharmony_ci  group("unittest") {
295060ff233Sopenharmony_ci    testonly = true
296060ff233Sopenharmony_ci    deps = [
297060ff233Sopenharmony_ci      ":AdapterDsoftbusAesCryptoTest",
298060ff233Sopenharmony_ci      ":AdapterDsoftbusDfxTest",
299060ff233Sopenharmony_ci      ":AdapterDsoftbusOtherTest",
300060ff233Sopenharmony_ci      ":AdapterDsoftbusRangeTest",
301060ff233Sopenharmony_ci      ":AdapterDsoftbusSocketTest",
302060ff233Sopenharmony_ci      ":AdapterWlanExtendTest",
303060ff233Sopenharmony_ci      ":AdaptorDsoftbusCryptTest",
304060ff233Sopenharmony_ci      ":AdaptorDsoftbusFileTest",
305060ff233Sopenharmony_ci      ":SoftbusThreadTest",
306060ff233Sopenharmony_ci      ":SoftbusTimeTest",
307060ff233Sopenharmony_ci    ]
308060ff233Sopenharmony_ci    if (!defined(ohos_lite) && softbus_communication_wifi_feature == true) {
309060ff233Sopenharmony_ci      deps += [ ":AdapterDsoftbusWifiTest" ]
310060ff233Sopenharmony_ci    }
311060ff233Sopenharmony_ci    if (!defined(ohos_lite) && dsoftbus_feature_lnn_net == true &&
312060ff233Sopenharmony_ci        support_bluetooth && dsoftbus_feature_conn_ble) {
313060ff233Sopenharmony_ci      deps += [ ":AdapterDsoftbusNetworkTest" ]
314060ff233Sopenharmony_ci    }
315060ff233Sopenharmony_ci  }
316060ff233Sopenharmony_ci}
317