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