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/sdk:softbus_client",
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/kits/discovery",
79      "$dsoftbus_root_path/interfaces/kits/common",
80      "$dsoftbus_root_path/sdk/discovery/include",
81      "unittest/common/",
82      "$dsoftbus_root_path/sdk/discovery/manager/include",
83      "$dsoftbus_root_path/tests/sdk/common/include",
84    ]
85    deps = [
86      "$dsoftbus_root_path/sdk:softbus_client",
87      "$dsoftbus_root_path/tests/sdk/common:softbus_access_token_test",
88    ]
89    external_deps = [
90      "bounds_checking_function:libsec_static",
91      "c_utils:utils",
92      "googletest:gtest_main",
93      "hilog:libhilog",
94    ]
95    if (support_bluetooth &&
96        (dsoftbus_feature_conn_br || dsoftbus_feature_conn_ble)) {
97      sources += [ "disc_sdk_test_bt_status.c" ]
98      external_deps += [ "bluetooth:btframework" ]
99    } else {
100      sources += [ "disc_sdk_test_bt_status_virtual.c" ]
101    }
102  }
103
104  group("unittest") {
105    testonly = true
106    deps = [
107      ":DiscSdkOnlyL2Test",
108      ":DiscSdkTest",
109    ]
110  }
111}
112