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