• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2021 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("//foundation/communication/dsoftbus/dsoftbus.gni")
15
16bus_center_sdk_test_src = [ "bus_center_sdk_test.cpp" ]
17softbus_center_sdk_test_src = [ "softbus_center_sdk_test.cpp" ]
18bus_center_sdk_test_inc = [
19  "$dsoftbus_root_path/adapter/common/include",
20  "$dsoftbus_root_path/core/bus_center/interface",
21  "$dsoftbus_root_path/core/bus_center/lnn/lane_hub/heartbeat/include",
22  "$dsoftbus_root_path/core/bus_center/lnn/lane_hub/lane_manager/include",
23  "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/local_ledger/include",
24  "$dsoftbus_root_path/core/common/include",
25  "$dsoftbus_root_path/core/discovery/interface",
26  "$dsoftbus_root_path/core/discovery/manager/include",
27  "$dsoftbus_root_path/interfaces/kits/bus_center",
28  "$dsoftbus_root_path/interfaces/kits/common",
29  "$dsoftbus_root_path/tests/sdk/common/include",
30  "//commonlibrary/c_utils/base/include",
31  "//third_party/bounds_checking_function/include",
32  "$dsoftbus_root_path/sdk/bus_center/manager/include",
33]
34bus_center_sdk_test_deps = [
35  "$dsoftbus_root_path/core/frame:softbus_server",
36  "$dsoftbus_root_path/sdk:softbus_client",
37  "//base/security/access_token/interfaces/innerkits/nativetoken:libnativetoken",
38  "//base/security/access_token/interfaces/innerkits/token_setproc:libtoken_setproc",
39  "//third_party/bounds_checking_function:libsec_static",
40]
41
42if (dsoftbus_feature_lnn_meta_node) {
43  bus_center_sdk_test_src += [ "bus_center_meta_node_sdk_test.cpp" ]
44}
45
46if (dsoftbus_feature_lnn_heartbeat) {
47  bus_center_sdk_test_src += [ "bus_center_heartbeat_sdk_test.cpp" ]
48  bus_center_sdk_test_inc += [
49    "$dsoftbus_root_path/core/bus_center/interface",
50    "$dsoftbus_root_path/core/bus_center/lnn/lane_hub/heartbeat/include",
51    "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/common/include",
52  ]
53}
54
55if (defined(ohos_lite)) {
56  import("//build/lite/config/component/lite_component.gni")
57  import("//build/lite/config/test.gni")
58
59  if (ohos_build_type == "debug") {
60    unittest("BusCenterSdkTest") {
61      output_extension = "bin"
62      output_dir = "$root_out_dir/test/unittest/dsoftbus"
63      sources = bus_center_sdk_test_src
64      include_dirs = bus_center_sdk_test_inc
65      deps = bus_center_sdk_test_deps
66      deps += [ "$hilog_lite_deps_path" ]
67    }
68  }
69  if (ohos_build_type == "debug") {
70    unittest("SoftbusCenterSdkTest") {
71      output_extension = "bin"
72      output_dir = "$root_out_dir/test/unittest/dsoftbus"
73      sources = softbus_center_sdk_test_src
74      include_dirs = bus_center_sdk_test_inc
75      deps = bus_center_sdk_test_deps
76      deps += [ "$hilog_lite_deps_path" ]
77    }
78  }
79} else {
80  import("//build/test.gni")
81
82  module_output_path = "dsoftbus/bus_center"
83  ohos_unittest("BusCenterSdkTest") {
84    module_out_path = module_output_path
85    sources = bus_center_sdk_test_src
86    include_dirs = bus_center_sdk_test_inc
87    include_dirs += [
88      "unittest/common/",
89      "//commonlibrary/c_utils/base/include",
90    ]
91    deps = bus_center_sdk_test_deps
92    deps += [
93      "$dsoftbus_root_path/tests/sdk/common:softbus_access_token_test",
94      "//third_party/googletest:gtest_main",
95    ]
96    if (is_standard_system) {
97      external_deps = [
98        "c_utils:utils",
99        "hiviewdfx_hilog_native:libhilog",
100      ]
101    } else {
102      external_deps = [
103        "c_utils:utils",
104        "hilog:libhilog",
105      ]
106    }
107  }
108
109  ohos_unittest("SoftbusCenterSdkTest") {
110    module_out_path = module_output_path
111    sources = softbus_center_sdk_test_src
112    include_dirs = bus_center_sdk_test_inc
113    include_dirs += [
114      "unittest/common/",
115      "//commonlibrary/c_utils/base/include",
116    ]
117    deps = bus_center_sdk_test_deps
118    deps += [
119      "$dsoftbus_root_path/tests/sdk/common:softbus_access_token_test",
120      "//third_party/googletest:gtest_main",
121    ]
122    if (is_standard_system) {
123      external_deps = [
124        "c_utils:utils",
125        "hiviewdfx_hilog_native:libhilog",
126      ]
127    } else {
128      external_deps = [
129        "c_utils:utils",
130        "hilog:libhilog",
131      ]
132    }
133  }
134  group("unittest") {
135    testonly = true
136    deps = [
137      ":BusCenterSdkTest",
138      ":SoftbusCenterSdkTest",
139    ]
140  }
141}
142