1# Copyright (c) 2021-2024 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") 15import("../../../../dsoftbus.gni") 16 17dsoftbus_root_path = "../../../.." 18 19bus_center_sdk_test_inc = [ 20 "$dsoftbus_root_path/adapter/default_config/spec_config", 21 "$dsoftbus_root_path/sdk/bus_center/manager/src", 22 "$dsoftbus_root_path/sdk/bus_center/manager/include", 23 "$dsoftbus_root_path/sdk/bus_center/ipc/include", 24 "$dsoftbus_root_path/sdk/bus_center/ipc/standard/include", 25 "$dsoftbus_root_path/sdk/bus_center/ipc/include", 26 "$dsoftbus_root_path/adapter/common/include", 27 "$dsoftbus_root_path/core/bus_center/interface", 28 "$dsoftbus_root_path/core/bus_center/lnn/lane_hub/heartbeat/include", 29 "$dsoftbus_root_path/core/bus_center/lnn/lane_hub/lane_manager/include", 30 "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/local_ledger/include", 31 "$dsoftbus_root_path/core/common/include", 32 "$dsoftbus_root_path/core/discovery/interface", 33 "$dsoftbus_root_path/core/discovery/manager/include", 34 "$dsoftbus_root_path/interfaces/kits/bus_center", 35 "$dsoftbus_root_path/interfaces/kits/common", 36 "$dsoftbus_root_path/tests/sdk/common/include", 37 "$dsoftbus_root_path/sdk/bus_center/manager/include", 38 "$dsoftbus_root_path/sdk/bus_center/ipc/standard/include", 39 "$dsoftbus_root_path/sdk/bus_center/ipc/include", 40 "$dsoftbus_root_path/core/frame/common/include", 41 "$dsoftbus_root_path/core/frame/standard/init/include", 42 "$dsoftbus_root_path/core/transmission/common/include", 43] 44bus_center_sdk_test_deps = [ 45 "$dsoftbus_root_path/adapter:softbus_adapter", 46 "$dsoftbus_root_path/core/common:softbus_utils", 47 "$dsoftbus_root_path/core/frame:softbus_server", 48] 49 50if (dsoftbus_feature_lnn_meta_node) { 51 bus_center_meta_node_sdk_test_src = [ "bus_center_meta_node_sdk_test.cpp" ] 52} 53 54if (dsoftbus_feature_lnn_heartbeat) { 55 bus_center_heartbeat_sdk_test_src = [ 56 "$dsoftbus_root_path/core/bus_center/service/src/bus_center_manager.c", 57 "bus_center_heartbeat_sdk_test.cpp", 58 ] 59 bus_center_sdk_test_inc += [ 60 "$dsoftbus_root_path/core/authentication/interface", 61 "$dsoftbus_root_path/core/adapter/bus_center/include", 62 "$dsoftbus_root_path/core/bus_center/interface", 63 "$dsoftbus_root_path/core/bus_center/lnn/decision_center/include", 64 "$dsoftbus_root_path/core/bus_center/lnn/disc_mgr/include", 65 "$dsoftbus_root_path/core/bus_center/lnn/lane_hub/common/include", 66 "$dsoftbus_root_path/core/bus_center/lnn/lane_hub/heartbeat/include", 67 "$dsoftbus_root_path/core/bus_center/lnn/meta_node/include", 68 "$dsoftbus_root_path/core/bus_center/lnn/net_builder/include", 69 "$dsoftbus_root_path/core/bus_center/lnn/net_buscenter/include", 70 "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/common/include", 71 "$dsoftbus_root_path/core/bus_center/monitor/include", 72 "$dsoftbus_root_path/core/bus_center/service/include", 73 "$dsoftbus_root_path/core/bus_center/utils/include", 74 "$dsoftbus_root_path/core/common/include", 75 ] 76} 77 78if (defined(ohos_lite)) { 79 import("//build/lite/config/component/lite_component.gni") 80 import("//build/lite/config/test.gni") 81 82 if (ohos_build_type == "debug") { 83 unittest("BusCenterSdkRefreshSmall") { 84 output_extension = "bin" 85 output_dir = "$root_out_dir/test/unittest/dsoftbus" 86 sources = [ 87 "$dsoftbus_root_path/adapter/common/bus_center/network/lnn_netmanager_listener_virtual.cpp", 88 "$dsoftbus_root_path/core/bus_center/lnn/lane_hub/heartbeat/src/lnn_heartbeat_strategy_virtual.c", 89 "bus_center_sdk_refresh_small_test.cpp", 90 ] 91 include_dirs = bus_center_sdk_test_inc 92 include_dirs += [ 93 "$dsoftbus_root_path/adapter/common/bus_center/include", 94 "$dsoftbus_root_path/core/bus_center/service/include", 95 "$dsoftbus_root_path/core/bus_center/utils/include", 96 "$dsoftbus_root_path/sdk/frame/small/include", 97 "unittest/common/", 98 ] 99 deps = bus_center_sdk_test_deps 100 deps += [ 101 "$dsoftbus_root_path/core/frame:softbus_server_frame", 102 "$dsoftbus_root_path/sdk:softbus_client", 103 "$dsoftbus_root_path/tests/sdk/common:softbus_access_token_test", 104 "$hilog_lite_deps_path", 105 ] 106 } 107 } 108} else { 109 import("//build/test.gni") 110 111 module_output_path = "dsoftbus/bus_center" 112 ohos_unittest("BusCenterSdkTest") { 113 module_out_path = module_output_path 114 sources = [ "bus_center_sdk_test.cpp" ] 115 include_dirs = bus_center_sdk_test_inc 116 include_dirs += [ "unittest/common/" ] 117 deps = bus_center_sdk_test_deps 118 deps += [ 119 "$dsoftbus_root_path/tests/sdk:softbus_client_static", 120 "$dsoftbus_root_path/tests/sdk/common:softbus_access_token_test", 121 ] 122 if (is_standard_system) { 123 external_deps = [ "hilog:libhilog" ] 124 } else { 125 external_deps = [ "hilog:libhilog" ] 126 } 127 external_deps += [ 128 "access_token:libnativetoken", 129 "access_token:libtoken_setproc", 130 "c_utils:utils", 131 "ipc:ipc_core", 132 ] 133 } 134 135 ohos_unittest("ClientBusCenterSdkTest") { 136 module_out_path = module_output_path 137 sources = [ "softbus_center_sdk_test.cpp" ] 138 include_dirs = bus_center_sdk_test_inc 139 include_dirs += [ "unittest/common/" ] 140 deps = bus_center_sdk_test_deps 141 deps += [ 142 "$dsoftbus_root_path/tests/sdk:softbus_client_static", 143 "$dsoftbus_root_path/tests/sdk/common:softbus_access_token_test", 144 ] 145 if (is_standard_system) { 146 external_deps = [ "hilog:libhilog" ] 147 } else { 148 external_deps = [ "hilog:libhilog" ] 149 } 150 external_deps += [ 151 "access_token:libnativetoken", 152 "access_token:libtoken_setproc", 153 "c_utils:utils", 154 "ipc:ipc_core", 155 ] 156 } 157 158 ohos_unittest("ClientBusMangerTest") { 159 module_out_path = module_output_path 160 sources = [ "client_bus_center_test.cpp" ] 161 include_dirs = bus_center_sdk_test_inc 162 include_dirs += [ "unittest/common/" ] 163 deps = bus_center_sdk_test_deps 164 deps += [ 165 "$dsoftbus_root_path/tests/sdk:softbus_client_static", 166 "$dsoftbus_root_path/tests/sdk/common:softbus_access_token_test", 167 ] 168 if (is_standard_system) { 169 external_deps = [ "hilog:libhilog" ] 170 } else { 171 external_deps = [ "hilog:libhilog" ] 172 } 173 external_deps += [ 174 "access_token:libnativetoken", 175 "access_token:libtoken_setproc", 176 "c_utils:utils", 177 "ipc:ipc_core", 178 ] 179 } 180 181 ohos_unittest("BusCenterHeartbeatSdkTest") { 182 module_out_path = module_output_path 183 sources = bus_center_heartbeat_sdk_test_src 184 include_dirs = bus_center_sdk_test_inc 185 include_dirs += [ "unittest/common/" ] 186 deps = bus_center_sdk_test_deps 187 deps += [ 188 "$dsoftbus_root_path/tests/sdk:softbus_client_static", 189 "$dsoftbus_root_path/tests/sdk/common:softbus_access_token_test", 190 ] 191 if (is_standard_system) { 192 external_deps = [ "hilog:libhilog" ] 193 } else { 194 external_deps = [ "hilog:libhilog" ] 195 } 196 external_deps += [ 197 "access_token:libnativetoken", 198 "access_token:libtoken_setproc", 199 "c_utils:utils", 200 "ipc:ipc_core", 201 ] 202 } 203 204 ohos_unittest("BusCenterMetaNodeSdkTest") { 205 module_out_path = module_output_path 206 sources = bus_center_meta_node_sdk_test_src 207 include_dirs = bus_center_sdk_test_inc 208 include_dirs += [ "unittest/common/" ] 209 deps = bus_center_sdk_test_deps 210 deps += [ 211 "$dsoftbus_root_path/tests/sdk:softbus_client_static", 212 "$dsoftbus_root_path/tests/sdk/common:softbus_access_token_test", 213 ] 214 if (is_standard_system) { 215 external_deps = [ "hilog:libhilog" ] 216 } else { 217 external_deps = [ "hilog:libhilog" ] 218 } 219 external_deps += [ 220 "access_token:libnativetoken", 221 "access_token:libtoken_setproc", 222 "c_utils:utils", 223 "ipc:ipc_core", 224 ] 225 } 226 227 ohos_unittest("ClientBusCentManagerTest") { 228 module_out_path = module_output_path 229 sources = [ 230 "$dsoftbus_root_path/sdk/bus_center/manager/src/client_bus_center_manager.c", 231 "client_bus_center_manager_mock.cpp", 232 "client_bus_center_manager_test.cpp", 233 ] 234 include_dirs = [ 235 "$dsoftbus_root_path/adapter/default_config/spec_config", 236 "$dsoftbus_root_path/sdk/bus_center/manager/src", 237 "$dsoftbus_root_path/sdk/bus_center/manager/include", 238 "$dsoftbus_root_path/sdk/bus_center/ipc/include", 239 "$dsoftbus_root_path/sdk/bus_center/ipc/standard/include", 240 "$dsoftbus_root_path/sdk/bus_center/ipc/include", 241 "$dsoftbus_root_path/adapter/common/include", 242 "$dsoftbus_root_path/core/bus_center/interface", 243 "$dsoftbus_root_path/core/bus_center/lnn/lane_hub/heartbeat/include", 244 "$dsoftbus_root_path/core/bus_center/lnn/lane_hub/lane_manager/include", 245 "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/local_ledger/include", 246 "$dsoftbus_root_path/core/common/include", 247 "$dsoftbus_root_path/core/discovery/interface", 248 "$dsoftbus_root_path/core/discovery/manager/include", 249 "$dsoftbus_root_path/interfaces/inner_kits/lnn", 250 "$dsoftbus_root_path/interfaces/kits/bus_center", 251 "$dsoftbus_root_path/interfaces/kits/common", 252 "$dsoftbus_root_path/tests/sdk/common/include", 253 "$dsoftbus_root_path/sdk/bus_center/manager/include", 254 "$dsoftbus_root_path/sdk/bus_center/ipc/standard/include", 255 "$dsoftbus_root_path/sdk/bus_center/ipc/include", 256 "$dsoftbus_root_path/core/frame/standard/init/include", 257 "$dsoftbus_root_path/core/frame/common/include", 258 "$dsoftbus_root_path/core/transmission/common/include", 259 ] 260 deps = [ 261 "$dsoftbus_root_path/adapter:softbus_adapter", 262 "$dsoftbus_root_path/core/common:softbus_utils", 263 "$dsoftbus_root_path/core/frame:softbus_server", 264 "$dsoftbus_root_path/tests/sdk/common:softbus_access_token_test", 265 ] 266 if (is_standard_system) { 267 external_deps = [ 268 "access_token:libnativetoken", 269 "access_token:libtoken_setproc", 270 "bounds_checking_function:libsec_shared", 271 "c_utils:utils", 272 "googletest:gmock", 273 "googletest:gtest_main", 274 "hilog:libhilog", 275 ] 276 } else { 277 external_deps = [ 278 "bounds_checking_function:libsec_shared", 279 "c_utils:utils", 280 "googletest:gtest_main", 281 "hilog:libhilog", 282 ] 283 } 284 } 285 286 ohos_unittest("BusCenterServerTest") { 287 module_out_path = module_output_path 288 sources = [ "bus_center_server_test.cpp" ] 289 include_dirs = bus_center_sdk_test_inc 290 include_dirs += [ "unittest/common/" ] 291 deps = bus_center_sdk_test_deps 292 deps += [ 293 "$dsoftbus_root_path/tests/sdk:softbus_client_static", 294 "$dsoftbus_root_path/tests/sdk/common:softbus_access_token_test", 295 ] 296 if (is_standard_system) { 297 external_deps = [ "hilog:libhilog" ] 298 } else { 299 external_deps = [ "hilog:libhilog" ] 300 } 301 external_deps += [ 302 "access_token:libnativetoken", 303 "access_token:libtoken_setproc", 304 "c_utils:utils", 305 "ipc:ipc_core", 306 ] 307 } 308 309 group("unittest") { 310 testonly = true 311 deps = [ 312 ":BusCenterHeartbeatSdkTest", 313 ":BusCenterMetaNodeSdkTest", 314 ":BusCenterSdkTest", 315 ":BusCenterServerTest", 316 ":ClientBusCentManagerTest", 317 ":ClientBusCenterSdkTest", 318 ":ClientBusMangerTest", 319 ] 320 } 321} 322