1# Copyright (c) 2022-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("//build/test.gni")
15import("../../../dsoftbus.gni")
16
17module_output_path = "dsoftbus/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 = [ "unittest/lnn_kv_adapter_wrapper_test.cpp" ]
38  include_dirs = [
39    "$dsoftbus_root_path/core/adapter/kv_store/include",
40    "$dsoftbus_root_path/core/adapter/bus_center/include",
41    "$dsoftbus_root_path/core/common/include",
42    "$dsoftbus_root_path/core/bus_center/lnn/net_builder/include",
43    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/common/include",
44    "$dsoftbus_root_path/core/bus_center/interface",
45  ]
46  deps = [
47    "$dsoftbus_root_path/core/common:softbus_utils",
48    "$dsoftbus_root_path/core/frame:softbus_server",
49  ]
50  external_deps = [ "kv_store:distributeddata_inner" ]
51}
52
53ohos_unittest("LnnKSettingDataEventMonitorTest") {
54  module_out_path = module_output_path
55  sources = [
56    "$dsoftbus_root_path/core/adapter/bus_center/src/lnn_settingdata_event_monitor.cpp",
57    "unittest/lnn_settingdata_event_monitor_deps_mock.cpp",
58    "unittest/lnn_settingdata_event_monitor_test.cpp",
59  ]
60  include_dirs = [
61    "$dsoftbus_root_path/core/adapter/kv_store/include",
62    "$dsoftbus_root_path/core/adapter/bus_center/include",
63    "$dsoftbus_root_path/core/adapter/bus_center/src",
64    "$dsoftbus_root_path/core/common/include",
65    "$dsoftbus_root_path/core/bus_center/lnn/net_builder/include",
66    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/common/include",
67    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/local_ledger/include",
68    "$dsoftbus_root_path/core/bus_center/interface",
69    "$dsoftbus_root_path/core/bus_center/utils/include",
70    "$dsoftbus_root_path/core/bus_center/service/include/",
71    "$dsoftbus_root_path/tests/core/bus_center/lnn/net_builder/include",
72    "$dsoftbus_root_path/tests/core/adapter/unittest/",
73    "$dsoftbus_root_path/interfaces/kits/bus_center",
74    "$dsoftbus_root_path/interfaces/kits/common",
75  ]
76  deps = [ "$dsoftbus_root_path/core/common:softbus_utils" ]
77  external_deps = [
78    "ability_base:want",
79    "ability_base:zuri",
80    "ability_runtime:dataobs_manager",
81    "data_share:datashare_consumer",
82    "googletest:gmock_main",
83    "googletest:gtest_main",
84    "hilog:libhilog",
85    "kv_store:distributeddata_inner",
86    "samgr:samgr_proxy",
87  ]
88}
89
90ohos_unittest("AdapterDsoftbusRsaCryptoTest") {
91  module_out_path = module_output_path
92  sources = [ "unittest/dsoftbus_rsa_crypto_test.cpp" ]
93
94  include_dirs = [
95    "$dsoftbus_root_path/adapter/common/include",
96    "$dsoftbus_root_path/core/adapter/huks/include",
97    "$dsoftbus_root_path/core/adapter/transmission/include",
98    "$dsoftbus_root_path/core/common/include",
99    "$dsoftbus_root_path/core/common/dfx/interface/include",
100    "$dsoftbus_root_path/interfaces/kits/common",
101  ]
102
103  deps = [
104    "$dsoftbus_root_path/adapter:softbus_adapter",
105    "$dsoftbus_root_path/core/common:softbus_utils",
106    "$dsoftbus_root_path/core/frame:softbus_server",
107  ]
108
109  if (is_standard_system) {
110    external_deps = [
111      "bounds_checking_function:libsec_static",
112      "googletest:gtest_main",
113      "hilog:libhilog",
114      "huks:libhukssdk",
115      "openssl:libcrypto_shared",
116    ]
117  } else {
118    external_deps = [
119      "c_utils:utils",
120      "hilog:libhilog",
121    ]
122  }
123}
124
125ohos_unittest("LNNOhosAccountTest") {
126  module_out_path = module_output_path
127  sources = [
128    "unittest/lnn_ohos_account_mock.cpp",
129    "unittest/lnn_ohos_account_test.cpp",
130  ]
131  include_dirs = [
132    "$dsoftbus_root_path/core/adapter/kv_store/include",
133    "$dsoftbus_root_path/core/adapter/bus_center/include",
134    "$dsoftbus_root_path/core/common/include",
135    "$dsoftbus_root_path/core/bus_center/lnn/net_builder/include",
136    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/common/include",
137    "$dsoftbus_root_path/core/bus_center/interface",
138    "$dsoftbus_root_path/interfaces/kits/common",
139  ]
140  deps = [
141    "$dsoftbus_root_path/core/common:softbus_utils",
142    "$dsoftbus_root_path/core/frame:softbus_server",
143  ]
144  external_deps = [
145    "bounds_checking_function:libsec_static",
146    "c_utils:utils",
147    "googletest:gmock_main",
148    "googletest:gtest_main",
149    "hilog:libhilog",
150  ]
151}
152
153ohos_unittest("LNNKvStoreLaunchListenerTest") {
154  module_out_path = module_output_path
155  sources = [
156    "$dsoftbus_root_path/core/adapter/subscribe_kv_store_sa/src/lnn_kv_store_launch_listener.cpp",
157    "unittest/lnn_kv_store_launch_listener_mock.cpp",
158    "unittest/lnn_kv_store_launch_listener_test.cpp",
159  ]
160  include_dirs = [
161    "$dsoftbus_root_path/core/adapter/kv_store/include",
162    "$dsoftbus_root_path/core/adapter/subscribe_kv_store_sa/include",
163    "$dsoftbus_root_path/core/adapter/bus_center/include",
164    "$dsoftbus_root_path/core/common/include",
165    "$dsoftbus_root_path/core/bus_center/lnn/net_builder/include",
166    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/common/include",
167    "$dsoftbus_root_path/core/bus_center/interface",
168    "$dsoftbus_root_path/interfaces/kits/common",
169  ]
170  deps = [ "$dsoftbus_root_path/core/common:softbus_utils" ]
171  external_deps = [
172    "bounds_checking_function:libsec_static",
173    "c_utils:utils",
174    "googletest:gmock_main",
175    "googletest:gtest_main",
176    "hilog:libhilog",
177    "ipc:ipc_core",
178    "safwk:system_ability_fwk",
179    "samgr:samgr_proxy",
180  ]
181}
182
183ohos_unittest("LnnOhosAccountAdapterTest") {
184  module_out_path = module_output_path
185  sources = [
186    "$dsoftbus_root_path/core/adapter/bus_center/src/lnn_ohos_account_adapter.cpp",
187    "unittest/lnn_ohos_account_adapter_mock.cpp",
188    "unittest/lnn_ohos_account_adapter_test.cpp",
189  ]
190
191  include_dirs = [
192    "unittest",
193    "$dsoftbus_root_path/core/adapter/bus_center/include",
194    "$dsoftbus_root_path/core/authentication/include",
195    "$dsoftbus_root_path/interfaces/kits/common",
196  ]
197
198  deps = [
199    "$dsoftbus_root_path/adapter:softbus_adapter",
200    "$dsoftbus_root_path/core/common:softbus_utils",
201    "$dsoftbus_root_path/core/frame:softbus_server",
202  ]
203
204  if (is_standard_system) {
205    external_deps = [
206      "ability_base:base",
207      "ability_base:want",
208      "ability_base:zuri",
209      "bounds_checking_function:libsec_static",
210      "c_utils:utils",
211      "device_auth:deviceauth_sdk",
212      "googletest:gmock_main",
213      "googletest:gtest_main",
214      "hilog:libhilog",
215      "ipc:ipc_single",
216      "os_account:os_account_innerkits",
217    ]
218  } else {
219    external_deps = [
220      "c_utils:utils",
221      "hilog:libhilog",
222    ]
223  }
224}
225
226group("unittest") {
227  testonly = true
228
229  deps = [
230    ":AdapterDsoftbusRsaCryptoTest",
231    ":LNNKvStoreLaunchListenerTest",
232    ":LNNOhosAccountTest",
233    ":LnnKSettingDataEventMonitorTest",
234    ":LnnOhosAccountAdapterTest",
235  ]
236  if (dsoftbus_feature_lnn_cloud_sync) {
237    deps += [
238      ":LnnKVAdapterTest",
239      ":LnnKVAdapterWrapperTest",
240    ]
241  }
242}
243
244group("fuzztest") {
245  testonly = true
246  deps = [ "fuzztest:fuzztest" ]
247}
248