• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2022-2025 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("//build/test.gni")
15import("../../../dsoftbus.gni")
16
17module_output_path = "dsoftbus/soft_bus/core"
18dsoftbus_root_path = "../../.."
19
20ohos_unittest("LnnKVAdapterTest") {
21  module_out_path = module_output_path
22  sources = [ "unittest/lnn_kv_adapter_test.cpp" ]
23  include_dirs = [
24    "$dsoftbus_root_path/core/adapter/kv_store/include",
25    "$dsoftbus_root_path/core/adapter/bus_center/include",
26    "$dsoftbus_root_path/core/common/include",
27  ]
28  deps = [
29    "$dsoftbus_root_path/core/common:softbus_utils",
30    "$dsoftbus_root_path/core/frame:softbus_server",
31  ]
32  external_deps = [ "kv_store:distributeddata_inner" ]
33}
34
35ohos_unittest("LnnKVAdapterWrapperTest") {
36  module_out_path = module_output_path
37  sources = [
38    "unittest/lnn_kv_adapter_wrapper_test.cpp",
39    "unittest/lnn_kv_adapter_wrapper_mock.cpp",
40    "$dsoftbus_root_path/core/frame/init/src/g_enhance_lnn_func.c",
41  ]
42  include_dirs = [
43    "$dsoftbus_dfx_path/interface/include/form",
44    "$dsoftbus_root_path/core/adapter/bus_center/include",
45    "$dsoftbus_root_path/core/adapter/kv_store/include",
46    "$dsoftbus_root_path/core/bus_center/interface",
47    "$dsoftbus_root_path/core/bus_center/lnn/net_builder/include",
48    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/common/include",
49    "$dsoftbus_root_path/core/common/include",
50    "$dsoftbus_root_path/core/frame/init/include",
51    "$dsoftbus_root_path/tests/core/adapter/unittest",
52    "$dsoftbus_root_path/tests/interface/enhance",
53  ]
54  deps = [
55    "$dsoftbus_root_path/core/common:softbus_utils",
56    "$dsoftbus_root_path/core/frame:softbus_server",
57    "$dsoftbus_root_path/adapter:softbus_adapter",
58  ]
59  external_deps = [
60    "googletest:gmock",
61    "dsoftbus:softbus_client",
62    "kv_store:distributeddata_inner",
63  ]
64}
65
66ohos_unittest("LnnSettingDataEventMonitorTest") {
67  module_out_path = module_output_path
68  sources = [ "unittest/lnn_settingdata_event_monitor_test.cpp" ]
69  include_dirs = [
70    "$dsoftbus_dfx_path/interface/include/form",
71    "$dsoftbus_root_path/core/adapter/bus_center/include",
72    "$dsoftbus_root_path/core/adapter/bus_center/src",
73    "$dsoftbus_root_path/core/adapter/kv_store/include",
74    "$dsoftbus_root_path/core/bus_center/interface",
75    "$dsoftbus_root_path/core/bus_center/lnn/net_builder/include",
76    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/common/include",
77    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/local_ledger/include",
78    "$dsoftbus_root_path/core/bus_center/service/include/",
79    "$dsoftbus_root_path/core/bus_center/utils/include",
80    "$dsoftbus_root_path/core/common/include",
81    "$dsoftbus_root_path/interfaces/kits/bus_center",
82    "$dsoftbus_root_path/interfaces/kits/common",
83    "$dsoftbus_root_path/tests/core/adapter/unittest/",
84    "$dsoftbus_root_path/tests/core/bus_center/lnn/net_builder/include",
85  ]
86  deps = [
87    "$dsoftbus_root_path/core/common:softbus_utils",
88    "$dsoftbus_root_path/core/frame:softbus_server",
89  ]
90  external_deps = [
91    "ability_base:want",
92    "ability_base:zuri",
93    "ability_runtime:dataobs_manager",
94    "data_share:datashare_consumer",
95    "googletest:gmock_main",
96    "googletest:gtest_main",
97    "hilog:libhilog",
98    "init:libbegetutil",
99    "kv_store:distributeddata_inner",
100    "samgr:samgr_proxy",
101  ]
102  if (is_standard_system && has_ces_part) {
103    external_deps += [ "common_event_service:cesfwk_innerkits" ]
104  }
105}
106
107ohos_unittest("AdapterDsoftbusRsaCryptoTest") {
108  module_out_path = module_output_path
109  sources = [ "unittest/dsoftbus_rsa_crypto_test.cpp" ]
110
111  include_dirs = [
112    "$dsoftbus_dfx_path/interface/include",
113    "$dsoftbus_root_path/adapter/common/include",
114    "$dsoftbus_root_path/core/adapter/huks/include",
115    "$dsoftbus_root_path/core/adapter/transmission/include",
116    "$dsoftbus_root_path/core/common/include",
117    "$dsoftbus_root_path/interfaces/kits/common",
118  ]
119
120  deps = [
121    "$dsoftbus_root_path/adapter:softbus_adapter",
122    "$dsoftbus_root_path/core/common:softbus_utils",
123    "$dsoftbus_root_path/core/frame:softbus_server",
124  ]
125
126  if (is_standard_system) {
127    external_deps = [
128      "bounds_checking_function:libsec_static",
129      "googletest:gtest_main",
130      "hilog:libhilog",
131      "huks:libhukssdk",
132      "openssl:libcrypto_shared",
133    ]
134  } else {
135    external_deps = [
136      "c_utils:utils",
137      "hilog:libhilog",
138    ]
139  }
140}
141
142ohos_unittest("LNNOhosAccountTest") {
143  module_out_path = module_output_path
144  sources = [
145    "unittest/lnn_ohos_account_mock.cpp",
146    "unittest/lnn_ohos_account_test.cpp",
147  ]
148  include_dirs = [
149    "$dsoftbus_root_path/core/adapter/bus_center/include",
150    "$dsoftbus_root_path/core/adapter/kv_store/include",
151    "$dsoftbus_root_path/core/authentication/interface",
152    "$dsoftbus_root_path/core/bus_center/interface",
153    "$dsoftbus_root_path/core/bus_center/lnn/lane_hub/heartbeat/include",
154    "$dsoftbus_root_path/core/bus_center/lnn/net_builder/include",
155    "$dsoftbus_root_path/core/bus_center/lnn/net_buscenter/include",
156    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/common/include",
157    "$dsoftbus_root_path/core/bus_center/service/include",
158    "$dsoftbus_root_path/core/bus_center/utils/include",
159    "$dsoftbus_root_path/core/common/include",
160    "$dsoftbus_root_path/core/discovery/interface",
161    "$dsoftbus_root_path/dfx/interface/include/form",
162    "$dsoftbus_root_path/interfaces/kits/bus_center",
163    "$dsoftbus_root_path/interfaces/kits/common",
164  ]
165  deps = [
166    "$dsoftbus_root_path/core/common:softbus_utils",
167    "$dsoftbus_root_path/core/frame:softbus_server",
168    "$dsoftbus_root_path/adapter:softbus_adapter",
169  ]
170  external_deps = [
171    "bounds_checking_function:libsec_static",
172    "cJSON:cjson",
173    "c_utils:utils",
174    "googletest:gmock_main",
175    "googletest:gtest_main",
176    "hilog:libhilog",
177  ]
178}
179
180ohos_unittest("LNNKvStoreLaunchListenerTest") {
181  module_out_path = module_output_path
182  sources = [
183    "$dsoftbus_root_path/core/adapter/subscribe_kv_store_sa/src/lnn_kv_store_launch_listener.cpp",
184    "unittest/lnn_kv_store_launch_listener_mock.cpp",
185    "unittest/lnn_kv_store_launch_listener_test.cpp",
186  ]
187  include_dirs = [
188    "$dsoftbus_dfx_path/interface/include/form",
189    "$dsoftbus_root_path/core/adapter/bus_center/include",
190    "$dsoftbus_root_path/core/adapter/kv_store/include",
191    "$dsoftbus_root_path/core/adapter/subscribe_kv_store_sa/include",
192    "$dsoftbus_root_path/core/bus_center/interface",
193    "$dsoftbus_root_path/core/bus_center/lnn/net_builder/include",
194    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/common/include",
195    "$dsoftbus_root_path/core/common/include",
196    "$dsoftbus_root_path/interfaces/kits/bus_center",
197    "$dsoftbus_root_path/interfaces/kits/common",
198  ]
199  deps = [ "$dsoftbus_root_path/core/common:softbus_utils" ]
200  external_deps = [
201    "bounds_checking_function:libsec_static",
202    "c_utils:utils",
203    "googletest:gmock_main",
204    "googletest:gtest_main",
205    "hilog:libhilog",
206    "ipc:ipc_core",
207    "safwk:system_ability_fwk",
208    "samgr:samgr_proxy",
209  ]
210}
211
212ohos_unittest("LnnOhosAccountAdapterTest") {
213  module_out_path = module_output_path
214  sources = [
215    "$dsoftbus_root_path/core/adapter/bus_center/src/lnn_ohos_account_adapter.cpp",
216    "unittest/lnn_ohos_account_adapter_mock.cpp",
217    "unittest/lnn_ohos_account_adapter_test.cpp",
218  ]
219
220  include_dirs = [
221    "$dsoftbus_root_path/core/adapter/bus_center/include",
222    "$dsoftbus_root_path/core/authentication/include",
223    "$dsoftbus_root_path/interfaces/kits/common",
224    "unittest",
225  ]
226
227  deps = [
228    "$dsoftbus_root_path/adapter:softbus_adapter",
229    "$dsoftbus_root_path/core/common:softbus_utils",
230    "$dsoftbus_root_path/core/frame:softbus_server",
231  ]
232
233  if (is_standard_system) {
234    external_deps = [
235      "ability_base:base",
236      "ability_base:want",
237      "ability_base:zuri",
238      "bounds_checking_function:libsec_static",
239      "c_utils:utils",
240      "device_auth:deviceauth_sdk",
241      "googletest:gmock_main",
242      "googletest:gtest_main",
243      "hilog:libhilog",
244      "ipc:ipc_single",
245      "os_account:os_account_innerkits",
246    ]
247  } else {
248    external_deps = [
249      "c_utils:utils",
250      "hilog:libhilog",
251    ]
252  }
253}
254
255ohos_unittest("LnnSaStatusMonitorTest") {
256  module_out_path = module_output_path
257  sources = [
258    "$dsoftbus_root_path/core/adapter/bus_center/src/lnn_sa_status_monitor.cpp",
259    "$dsoftbus_root_path/tests/core/adapter/unittest/lnn_sa_status_monitor_mock.cpp",
260    "$dsoftbus_root_path/tests/core/adapter/unittest/lnn_sa_status_monitor_test.cpp",
261  ]
262
263  include_dirs = [
264    "$dsoftbus_root_path/core/adapter/bus_center/include",
265    "$dsoftbus_root_path/core/adapter/bus_center/src",
266    "$dsoftbus_root_path/core/bus_center/interface",
267    "$dsoftbus_root_path/core/bus_center/lnn/net_builder/include",
268    "$dsoftbus_root_path/core/bus_center/service/include",
269    "$dsoftbus_root_path/core/bus_center/utils/include",
270    "$dsoftbus_root_path/interfaces/kits/bus_center",
271    "unittest",
272  ]
273
274  deps = [
275    "$dsoftbus_root_path/adapter:softbus_adapter",
276    "$dsoftbus_root_path/core/common:softbus_utils",
277    "$dsoftbus_root_path/core/frame:softbus_server",
278  ]
279
280  external_deps = [
281    "c_utils:utils",
282    "googletest:gmock_main",
283    "hilog:libhilog",
284  ]
285
286  if (dsoftbus_ipc_feature) {
287    external_deps += [ "ipc:ipc_single" ]
288  }
289
290  if (dsoftbus_feature_deps_samgr) {
291    external_deps += [ "samgr:samgr_proxy" ]
292  }
293}
294
295ohos_unittest("LnnUsbAdapterTest") {
296  module_out_path = module_output_path
297  sources = [
298    "$dsoftbus_root_path/tests/core/adapter/unittest/lnn_usb_adapter_test.cpp",
299  ]
300
301  include_dirs = [
302    "$dsoftbus_root_path/core/adapter/bus_center/include",
303    "$dsoftbus_root_path/core/adapter/bus_center/src",
304    "unittest",
305  ]
306
307  deps = [
308    "$dsoftbus_root_path/adapter:softbus_adapter",
309    "$dsoftbus_root_path/core/common:softbus_utils",
310    "$dsoftbus_root_path/core/frame:softbus_server",
311  ]
312
313  external_deps = [
314    "c_utils:utils",
315    "googletest:gmock_main",
316    "hilog:libhilog",
317  ]
318
319  if (dsoftbus_feature_lnn_usb_ncm && dsoftbus_feature_deps_usb_manager) {
320    external_deps += [ "usb_manager:usbsrv_client" ]
321  }
322}
323
324group("unittest") {
325  testonly = true
326
327  deps = [
328    ":AdapterDsoftbusRsaCryptoTest",
329    ":LNNKvStoreLaunchListenerTest",
330    ":LNNOhosAccountTest",
331    ":LnnOhosAccountAdapterTest",
332    ":LnnSaStatusMonitorTest",
333    ":LnnSettingDataEventMonitorTest",
334  ]
335  if (dsoftbus_feature_lnn_cloud_sync) {
336    deps += [
337      ":LnnKVAdapterTest",
338      ":LnnKVAdapterWrapperTest",
339    ]
340  }
341  if (dsoftbus_feature_lnn_usb_ncm && dsoftbus_feature_deps_usb_manager) {
342    deps += [ ":LnnUsbAdapterTest" ]
343  }
344}
345
346group("fuzztest") {
347  testonly = true
348  deps = [ "fuzztest:fuzztest" ]
349}
350