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("../../../../dsoftbus.gni")
15
16dsoftbus_root_path = "../../../.."
17
18if (defined(ohos_lite)) {
19  import("//build/lite/config/component/lite_component.gni")
20  import("//build/lite/config/test.gni")
21
22  if (ohos_build_type == "debug") {
23    unittest("DiscSdkTest") {
24      output_extension = "bin"
25      output_dir = "$root_out_dir/test/unittest/dsoftbus"
26      sources = [
27        "disc_sdk_test.cpp",
28        "disc_sdk_test_bt_status_virtual.c",
29      ]
30      include_dirs = [
31        "$dsoftbus_root_path/core/common/include",
32        "$dsoftbus_root_path/sdk/bus_center/manager/include",
33        "$dsoftbus_root_path/interfaces/kits/discovery",
34        "$dsoftbus_root_path/interfaces/kits/common",
35        "$dsoftbus_root_path/tests/sdk/common/include",
36      ]
37      deps = [
38        "$dsoftbus_root_path/sdk:softbus_client",
39        "$dsoftbus_root_path/tests/sdk/common:softbus_access_token_test",
40      ]
41    }
42  }
43} else {
44  import("//build/test.gni")
45  module_output_path = "dsoftbus/discovery"
46  ohos_unittest("DiscSdkOnlyL2Test") {
47    module_out_path = module_output_path
48    sources = [ "disc_sdk_only_l2_test.cpp" ]
49    include_dirs = [
50      "$dsoftbus_root_path/core/common/inner_communication",
51      "$dsoftbus_root_path/core/common/include",
52      "$dsoftbus_root_path/interfaces/kits/discovery",
53      "$dsoftbus_root_path/interfaces/kits/common",
54      "$dsoftbus_root_path/sdk/discovery/include",
55      "$dsoftbus_root_path/sdk/discovery/manager/include",
56      "$dsoftbus_root_path/tests/sdk/common/include",
57      "unittest/common/",
58    ]
59    deps = [
60      "$dsoftbus_root_path/tests/sdk:softbus_client_static",
61      "$dsoftbus_root_path/tests/sdk/common:softbus_access_token_test",
62    ]
63    external_deps = [
64      "bounds_checking_function:libsec_static",
65      "c_utils:utils",
66      "googletest:gtest_main",
67      "hilog:libhilog",
68    ]
69  }
70
71  ohos_unittest("DiscSdkTest") {
72    module_out_path = module_output_path
73    sources = [ "disc_sdk_test.cpp" ]
74    include_dirs = [
75      "$dsoftbus_root_path/sdk/bus_center/manager/include",
76      "$dsoftbus_root_path/core/common/inner_communication",
77      "$dsoftbus_root_path/core/common/include",
78      "$dsoftbus_root_path/interfaces/inner_kits/lnn",
79      "$dsoftbus_root_path/interfaces/kits/discovery",
80      "$dsoftbus_root_path/interfaces/kits/common",
81      "$dsoftbus_root_path/sdk/discovery/include",
82      "unittest/common/",
83      "$dsoftbus_root_path/sdk/discovery/manager/include",
84      "$dsoftbus_root_path/tests/sdk/common/include",
85    ]
86    deps = [
87      "$dsoftbus_root_path/tests/sdk:softbus_client_static",
88      "$dsoftbus_root_path/tests/sdk/common:softbus_access_token_test",
89    ]
90    external_deps = [
91      "bounds_checking_function:libsec_static",
92      "c_utils:utils",
93      "googletest:gtest_main",
94      "hilog:libhilog",
95    ]
96    if (support_bluetooth &&
97        (dsoftbus_feature_conn_br || dsoftbus_feature_conn_ble)) {
98      sources += [ "disc_sdk_test_bt_status.c" ]
99      external_deps += [ "bluetooth:btframework" ]
100    } else {
101      sources += [ "disc_sdk_test_bt_status_virtual.c" ]
102    }
103  }
104
105  group("unittest") {
106    testonly = true
107    deps = [
108      ":DiscSdkOnlyL2Test",
109      ":DiscSdkTest",
110    ]
111  }
112}
113