• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2021-2023 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6#     http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14import("../../../core/common/dfx/dsoftbus_dfx.gni")
15if (defined(ohos_lite)) {
16  import("//build/lite/config/component/lite_component.gni")
17  import("//build/lite/config/test.gni")
18  import("../../../dsoftbus.gni")
19
20  dsoftbus_root_path = "../../.."
21
22  defines += [ "HAVE_PRO = 0" ]
23
24  if (ohos_build_type == "debug") {
25    unittest("AdapterTest") {
26      output_extension = "bin"
27      output_dir = "$root_out_dir/test/unittest/dsoftbus"
28      sources = [
29        "dsoftbus_crypto_test.cpp",
30        "dsoftbus_other_test.cpp",
31        "softbus_adapter_range_test.cpp",
32        "softbus_socket_test.cpp",
33      ]
34      include_dirs = [
35        "$dsoftbus_root_path/adapter/common/include",
36        "$dsoftbus_root_path/core/common/include/",
37        "$dsoftbus_root_path/core/common/dfx/interface/include",
38        "$dsoftbus_root_path/interfaces/kits/common",
39        "$hilog_lite_include_path",
40        "//third_party/bounds_checking_function/include",
41      ]
42      deps = [
43        "$dsoftbus_root_path/adapter:softbus_adapter",
44        "$dsoftbus_root_path/core/common/dfx/log:softbus_dfx_log",
45        "$hilog_lite_deps_path",
46        "//third_party/bounds_checking_function:libsec_static",
47      ]
48    }
49  }
50} else {
51  import("//build/test.gni")
52  import("../../../dsoftbus.gni")
53  defines += [ "HAVE_PRO = 0" ]
54  module_output_path = "dsoftbus/adapter"
55
56  ohos_unittest("AdaptorDsoftbusCryptTest") {
57    module_out_path = module_output_path
58    sources = [ "dsoftbus_crypto_test.cpp" ]
59    include_dirs = [
60      "$dsoftbus_root_path/adapter/common/include",
61      "$dsoftbus_root_path/core/common/include/",
62      "$dsoftbus_root_path/interfaces/kits/common",
63      "//third_party/bounds_checking_function/include",
64    ]
65    deps = [
66      "../../../adapter:softbus_adapter",
67      "//third_party/bounds_checking_function:libsec_static",
68      "//third_party/googletest:gtest_main",
69    ]
70    if (is_standard_system) {
71      external_deps = [
72        "c_utils:utils",
73        "hilog:libhilog",
74      ]
75    } else {
76      external_deps = [
77        "c_utils:utils",
78        "hilog:libhilog",
79      ]
80    }
81  }
82
83  ohos_unittest("AdapterDsoftbusAesCryptoTest") {
84    module_out_path = module_output_path
85    sources = [ "dsoftbus_aes_crypto_test.cpp" ]
86    include_dirs = [
87      "$dsoftbus_root_path/adapter/common/include",
88      "$dsoftbus_root_path/core/common/include/",
89      "$dsoftbus_root_path/interfaces/kits/common",
90      "//third_party/bounds_checking_function/include",
91    ]
92    deps = [
93      "../../../adapter:softbus_adapter",
94      "//third_party/bounds_checking_function:libsec_static",
95      "//third_party/googletest:gtest_main",
96    ]
97    if (is_standard_system) {
98      external_deps = [
99        "c_utils:utils",
100        "hilog:libhilog",
101      ]
102    } else {
103      external_deps = [
104        "c_utils:utils",
105        "hilog:libhilog",
106      ]
107    }
108  }
109
110  ohos_unittest("AdapterDsoftbusDfxTest") {
111    module_out_path = module_output_path
112    sources = [ "softbus_dfx_test.cpp" ]
113    include_dirs = [
114      "$dsoftbus_root_path/adapter/common/include",
115      "$dsoftbus_root_path/core/common/include/",
116      "$dsoftbus_root_path/interfaces/kits/common",
117      "//third_party/bounds_checking_function/include",
118    ]
119    deps = [
120      "../../../adapter:softbus_adapter",
121      "//third_party/bounds_checking_function:libsec_static",
122      "//third_party/googletest:gtest_main",
123    ]
124    if (is_standard_system) {
125      external_deps = [
126        "c_utils:utils",
127        "hilog:libhilog",
128      ]
129    } else {
130      external_deps = [
131        "c_utils:utils",
132        "hilog:libhilog",
133      ]
134    }
135  }
136
137  ohos_unittest("AdapterDsoftbusOtherTest") {
138    module_out_path = module_output_path
139    sources = [ "dsoftbus_other_test.cpp" ]
140    include_dirs = [
141      "$dsoftbus_root_path/adapter/common/include",
142      "$dsoftbus_root_path/core/common/include/",
143      "$dsoftbus_root_path/interfaces/kits/common",
144      "//third_party/bounds_checking_function/include",
145    ]
146    deps = [
147      "../../../adapter:softbus_adapter",
148      "//third_party/bounds_checking_function:libsec_static",
149      "//third_party/googletest:gtest_main",
150    ]
151    if (is_standard_system) {
152      external_deps = [
153        "c_utils:utils",
154        "hilog:libhilog",
155      ]
156    } else {
157      external_deps = [
158        "c_utils:utils",
159        "hilog:libhilog",
160      ]
161    }
162  }
163
164  ohos_unittest("AdapterDsoftbusRangeTest") {
165    module_out_path = module_output_path
166    sources = [ "softbus_adapter_range_test.cpp" ]
167    include_dirs = [
168      "$dsoftbus_root_path/adapter/common/include",
169      "$dsoftbus_root_path/core/common/include/",
170      "$dsoftbus_root_path/interfaces/kits/common",
171      "//third_party/bounds_checking_function/include",
172    ]
173    deps = [
174      "../../../adapter:softbus_adapter",
175      "//third_party/bounds_checking_function:libsec_static",
176      "//third_party/googletest:gtest_main",
177    ]
178    if (is_standard_system) {
179      external_deps = [
180        "c_utils:utils",
181        "hilog:libhilog",
182      ]
183    } else {
184      external_deps = [
185        "c_utils:utils",
186        "hilog:libhilog",
187      ]
188    }
189  }
190
191  ohos_unittest("AdapterDsoftbusSocketTest") {
192    module_out_path = module_output_path
193    sources = [ "softbus_socket_test.cpp" ]
194    include_dirs = [
195      "$dsoftbus_root_path/adapter/common/include",
196      "$dsoftbus_root_path/core/common/include/",
197      "$dsoftbus_root_path/interfaces/kits/common",
198      "//third_party/bounds_checking_function/include",
199    ]
200    deps = [
201      "../../../adapter:softbus_adapter",
202      "//third_party/bounds_checking_function:libsec_static",
203      "//third_party/googletest:gtest_main",
204    ]
205    if (is_standard_system) {
206      external_deps = [
207        "c_utils:utils",
208        "hilog:libhilog",
209      ]
210    } else {
211      external_deps = [
212        "c_utils:utils",
213        "hilog:libhilog",
214      ]
215    }
216  }
217
218  ohos_unittest("SoftbusThreadTest") {
219    module_out_path = module_output_path
220    sources = [ "softbus_thread_test.cpp" ]
221    include_dirs = [
222      "$dsoftbus_root_path/adapter/common/include",
223      "$dsoftbus_root_path/core/common/include/",
224      "$dsoftbus_root_path/interfaces/kits/common",
225      "//third_party/bounds_checking_function/include",
226    ]
227    deps = [
228      "../../../adapter:softbus_adapter",
229      "//third_party/bounds_checking_function:libsec_static",
230      "//third_party/googletest:gtest_main",
231    ]
232    if (is_standard_system) {
233      external_deps = [
234        "c_utils:utils",
235        "hilog:libhilog",
236      ]
237    } else {
238      external_deps = [
239        "c_utils:utils",
240        "hilog:libhilog",
241      ]
242    }
243  }
244
245  ohos_unittest("SoftbusTimeTest") {
246    module_out_path = module_output_path
247    sources = [ "softbus_time_test.cpp" ]
248    include_dirs = [
249      "$dsoftbus_root_path/adapter/common/include",
250      "$dsoftbus_root_path/interfaces/kits/common",
251      "$dsoftbus_root_path/core/common/include/",
252    ]
253    deps = [
254      "../../../adapter:softbus_adapter",
255      "//third_party/googletest:gtest_main",
256    ]
257    if (is_standard_system) {
258      external_deps = [
259        "c_utils:utils",
260        "hilog:libhilog",
261      ]
262    } else {
263      external_deps = [
264        "c_utils:utils",
265        "hilog:libhilog",
266      ]
267    }
268  }
269
270  ohos_unittest("AdaptorDsoftbusFileTest") {
271    module_out_path = module_output_path
272    sources = [ "softbus_file_test.cpp" ]
273    include_dirs = [
274      "$dsoftbus_root_path/adapter/common/include",
275      "$dsoftbus_root_path/interfaces/kits/common",
276      "$dsoftbus_root_path/core/common/include/",
277    ]
278    deps = [
279      "../../../adapter:softbus_adapter",
280      "//third_party/googletest:gtest_main",
281    ]
282    if (is_standard_system) {
283      external_deps = [
284        "c_utils:utils",
285        "hilog:libhilog",
286      ]
287    } else {
288      external_deps = [
289        "c_utils:utils",
290        "hilog:libhilog",
291      ]
292    }
293  }
294
295  ohos_unittest("AdapterDsoftbusWifiTest") {
296    module_out_path = module_output_path
297    sources = [
298      "$dsoftbus_root_path/adapter/common/net/wifi/common/softbus_wifi_api_adapter.c",
299      "$dsoftbus_root_path/tests/core/bus_center/mock_common/src/wifi_mock.cpp",
300      "softbus_wifi_api_test.cpp",
301    ]
302    include_dirs = [
303      "$dsoftbus_root_path/interfaces/kits/common",
304      "$dsoftbus_root_path/tests/core/bus_center/mock_common/src",
305      "$dsoftbus_root_path/tests/core/bus_center/mock_common/include",
306      "$dsoftbus_root_path/adapter/common/net/wifi/include",
307      "$dsoftbus_root_path/adapter/common/net/wifi/common",
308      "//foundation/communication/wifi/wifi/frameworks/native/interfaces",
309      "//foundation/communication/wifi/wifi/interfaces/kits/c",
310      "//foundation/communication/wifi/wifi/interfaces/inner_api",
311      "//foundation/communication/wifi/wifi/frameworks/native/include",
312      "//foundation/communication/ipc/interfaces/innerkits/ipc_core/include",
313      "//foundation/communication/wifi/wifi/services/wifi_standard/wifi_framework/wifi_toolkit/net_helper",
314      "//foundation/communication/samgr/interfaces/innerkits/samgr_proxy/include",
315      "//foundation/systemabilitymgr/samgr/interfaces/innerkits/samgr_proxy/include",
316      "//foundation/systemabilitymgr/samgr/adapter/interfaces/innerkits/include",
317      "$dsoftbus_root_path/core/common/include",
318      "$dsoftbus_root_path/core/common/dfx/interface/include",
319    ]
320    deps = [
321      "$dsoftbus_root_path/core/common:softbus_utils",
322      "$dsoftbus_root_path/core/common/dfx/log:softbus_dfx_log",
323      "../../../adapter:softbus_adapter",
324      "//third_party/googletest:gmock",
325      "//third_party/googletest:gtest_main",
326    ]
327    if (is_standard_system) {
328      external_deps = [
329        "c_utils:utils",
330        "hilog:libhilog",
331      ]
332    } else {
333      external_deps = [
334        "c_utils:utils",
335        "hilog:libhilog",
336      ]
337    }
338  }
339
340  ohos_unittest("AdapterDsoftbusNetworkTest") {
341    module_out_path = module_output_path
342    sources = [
343      "$dsoftbus_root_path/adapter/common/kernel/liteos_m/softbus_adapter_mem.c",
344      "$dsoftbus_root_path/core/common/message_handler/message_handler.c",
345      "$dsoftbus_root_path/core/common/utils/softbus_utils.c",
346      "$dsoftbus_root_path/tests/core/bus_center/mock_common/src/network_mock.cpp",
347      "softbus_network_test.cpp",
348    ]
349    include_dirs = [
350      "$dsoftbus_root_path/adapter/default_config/spec_config",
351      "$dsoftbus_root_path/core/connection/interface",
352      "$dsoftbus_root_path/core/bus_center/interface",
353      "$dsoftbus_root_path/interfaces/kits/bus_center",
354      "$dsoftbus_root_path/adapter/common/include/OS_adapter_define/linux",
355      "$dsoftbus_root_path/adapter/default_config/spec_config",
356      "$dsoftbus_root_path/adapter/common/bus_center/include",
357      "$dsoftbus_root_path/interfaces/kits/common",
358      "$dsoftbus_root_path/tests/core/bus_center/mock_common/include",
359      "$dsoftbus_root_path/adapter/common/bus_center/network",
360      "$dsoftbus_root_path/core/bus_center/service/include",
361      "$dsoftbus_root_path/core/bus_center/utils/include/lnn_async_callback_utils.h",
362      "$dsoftbus_root_path/adapter/common/net/bluetooth/include",
363      "$dsoftbus_root_path/adapter/common/include",
364      "$dsoftbus_root_path/core/bus_center/service/include",
365      "$dsoftbus_root_path/core/bus_center/utils/include",
366      "$dsoftbus_root_path/core/bus_center/lnn/net_buscenter/include",
367      "$dsoftbus_root_path/adapter/common/include",
368      "$dsoftbus_root_path/core/common/include",
369      "$dsoftbus_root_path/core/common/dfx/interface/include",
370    ]
371    deps = [
372      "//foundation/communication/dsoftbus/core/common/dfx/log:softbus_dfx_log",
373      "//third_party/googletest:gmock",
374      "//third_party/googletest:gtest_main",
375    ]
376    if (is_standard_system) {
377      external_deps = [
378        "c_utils:utils",
379        "hilog:libhilog",
380      ]
381    } else {
382      external_deps = [
383        "c_utils:utils",
384        "hilog:libhilog",
385      ]
386    }
387  }
388
389  ohos_unittest("AdapterWlanExtendTest") {
390    module_out_path = module_output_path
391    sources = [ "softbus_adapter_wlan_extend_test.cpp" ]
392    include_dirs = [
393      "$dsoftbus_root_path/adapter/common/include",
394      "$dsoftbus_root_path/interfaces/kits/common",
395      "$dsoftbus_root_path/core/common/include/",
396      "$dsoftbus_root_path/core/bus_center/utils/include/",
397      "$dsoftbus_root_path/adapter/common/net/hdi/include/",
398      "$dsoftbus_root_path/core/common/dfx/interface/include",
399    ]
400    deps = [
401      "$dsoftbus_root_path/core/common/dfx/log:softbus_dfx_log",
402      "$dsoftbus_root_path/core/frame:softbus_server",
403      "../../../adapter:softbus_adapter",
404      "//third_party/googletest:gtest_main",
405    ]
406    if (is_standard_system) {
407      external_deps = [
408        "c_utils:utils",
409        "hilog:libhilog",
410      ]
411    } else {
412      external_deps = [
413        "c_utils:utils",
414        "hilog:libhilog",
415      ]
416    }
417  }
418
419  group("unittest") {
420    testonly = true
421    deps = [
422      ":AdapterDsoftbusAesCryptoTest",
423      ":AdapterDsoftbusDfxTest",
424      ":AdapterDsoftbusOtherTest",
425      ":AdapterDsoftbusRangeTest",
426      ":AdapterDsoftbusSocketTest",
427      ":AdapterWlanExtendTest",
428      ":AdaptorDsoftbusCryptTest",
429      ":AdaptorDsoftbusFileTest",
430      ":SoftbusThreadTest",
431      ":SoftbusTimeTest",
432    ]
433    if (!defined(ohos_lite) && softbus_communication_wifi_feature == true) {
434      deps += [ ":AdapterDsoftbusWifiTest" ]
435    }
436    if (!defined(ohos_lite) && dsoftbus_feature_lnn_net == true &&
437        support_bluetooth && dsoftbus_feature_conn_ble) {
438      deps += [ ":AdapterDsoftbusNetworkTest" ]
439    }
440  }
441}
442