• 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
14defines = []
15if (defined(ohos_lite)) {
16  import("//build/lite/config/component/lite_component.gni")
17  import("//build/lite/config/test.gni")
18  import("//foundation/communication/dsoftbus/dsoftbus.gni")
19
20  defines += [ "HAVE_PRO = 0" ]
21
22  if (ohos_build_type == "debug") {
23    unittest("AdapterTest") {
24      output_extension = "bin"
25      output_dir = "$root_out_dir/test/unittest/dsoftbus"
26      sources = [
27        "dsoftbus_crypto_test.cpp",
28        "dsoftbus_other_test.cpp",
29        "softbus_adapter_range_test.cpp",
30        "softbus_socket_test.cpp",
31        "softbus_thread_test.cpp",
32      ]
33      include_dirs = [
34        "$dsoftbus_root_path/adapter/common/include",
35        "$dsoftbus_root_path/core/common/include/",
36        "$dsoftbus_root_path/interfaces/kits/common",
37        "//third_party/bounds_checking_function/include",
38      ]
39      deps = [
40        "//foundation/communication/dsoftbus/adapter:softbus_adapter",
41        "//third_party/bounds_checking_function:libsec_static",
42      ]
43    }
44  }
45} else {
46  import("//build/test.gni")
47  import("//foundation/communication/dsoftbus/dsoftbus.gni")
48  defines += [ "HAVE_PRO = 0" ]
49  module_output_path = "dsoftbus/adapter"
50  ohos_unittest("AdapterTest") {
51    module_out_path = module_output_path
52    sources = [
53      "dsoftbus_crypto_test.cpp",
54      "dsoftbus_other_test.cpp",
55      "softbus_adapter_range_test.cpp",
56      "softbus_dfx_test.cpp",
57      "softbus_socket_test.cpp",
58      "softbus_thread_test.cpp",
59    ]
60    include_dirs = [
61      "$dsoftbus_root_path/adapter/common/include",
62      "$dsoftbus_root_path/core/common/include/",
63      "$dsoftbus_root_path/interfaces/kits/common",
64      "//third_party/bounds_checking_function/include",
65    ]
66    deps = [
67      "//foundation/communication/dsoftbus/adapter:softbus_adapter",
68      "//third_party/bounds_checking_function:libsec_static",
69      "//third_party/googletest:gtest_main",
70    ]
71    if (is_standard_system) {
72      external_deps = [
73        "c_utils:utils",
74        "hiviewdfx_hilog_native:libhilog",
75      ]
76    } else {
77      external_deps = [
78        "c_utils:utils",
79        "hilog:libhilog",
80      ]
81    }
82  }
83  ohos_unittest("AdapterTimeTest") {
84    module_out_path = module_output_path
85    sources = [ "softbus_time_test.cpp" ]
86    include_dirs = [
87      "$dsoftbus_root_path/adapter/common/include",
88      "$dsoftbus_root_path/interfaces/kits/common",
89      "$dsoftbus_root_path/core/common/include/",
90    ]
91    deps = [
92      "//foundation/communication/dsoftbus/adapter:softbus_adapter",
93      "//third_party/googletest:gtest_main",
94    ]
95    if (is_standard_system) {
96      external_deps = [
97        "c_utils:utils",
98        "hiviewdfx_hilog_native:libhilog",
99      ]
100    } else {
101      external_deps = [
102        "c_utils:utils",
103        "hilog:libhilog",
104      ]
105    }
106  }
107  ohos_unittest("AdapterFileTest") {
108    module_out_path = module_output_path
109    sources = [ "softbus_file_test.cpp" ]
110    include_dirs = [
111      "$dsoftbus_root_path/adapter/common/include",
112      "$dsoftbus_root_path/interfaces/kits/common",
113      "$dsoftbus_root_path/core/common/include/",
114    ]
115    deps = [
116      "//foundation/communication/dsoftbus/adapter:softbus_adapter",
117      "//third_party/googletest:gtest_main",
118    ]
119    if (is_standard_system) {
120      external_deps = [
121        "c_utils:utils",
122        "hiviewdfx_hilog_native:libhilog",
123      ]
124    } else {
125      external_deps = [
126        "c_utils:utils",
127        "hilog:libhilog",
128      ]
129    }
130  }
131
132  group("unittest") {
133    testonly = true
134    deps = [
135      ":AdapterTest",
136      ":AdapterFileTest",
137      ":AdapterTimeTest",
138    ]
139  }
140}
141