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 = [ "disc_sdk_test.cpp" ] 27 include_dirs = [ 28 "$dsoftbus_root_path/sdk/bus_center/manager/include", 29 "$dsoftbus_root_path/interfaces/kits/discovery", 30 "$dsoftbus_root_path/interfaces/kits/common", 31 "$dsoftbus_root_path/tests/sdk/common/include", 32 ] 33 deps = [ 34 "$dsoftbus_root_path/sdk:softbus_client", 35 "$dsoftbus_root_path/tests/sdk/common:softbus_access_token_test", 36 ] 37 } 38 } 39} else { 40 import("//build/test.gni") 41 module_output_path = "dsoftbus/discovery" 42 ohos_unittest("DiscSdkOnlyL2Test") { 43 module_out_path = module_output_path 44 sources = [ "disc_sdk_only_l2_test.cpp" ] 45 include_dirs = [ 46 "$dsoftbus_root_path/core/common/inner_communication", 47 "$dsoftbus_root_path/core/common/include", 48 "$dsoftbus_root_path/interfaces/kits/discovery", 49 "$dsoftbus_root_path/interfaces/kits/common", 50 "$dsoftbus_root_path/sdk/discovery/include", 51 "//commonlibrary/c_utils/base/include", 52 "//third_party/bounds_checking_function/include", 53 "unittest/common/", 54 "$dsoftbus_root_path/sdk/discovery/manager/include", 55 "$dsoftbus_root_path/tests/sdk/common/include", 56 ] 57 deps = [ 58 "$dsoftbus_root_path/sdk:softbus_client", 59 "$dsoftbus_root_path/tests/sdk/common:softbus_access_token_test", 60 "//third_party/bounds_checking_function:libsec_static", 61 "//third_party/googletest:gtest_main", 62 ] 63 if (is_standard_system) { 64 external_deps = [ 65 "c_utils:utils", 66 "hilog:libhilog", 67 ] 68 } else { 69 external_deps = [ 70 "c_utils:utils", 71 "hilog:libhilog", 72 ] 73 } 74 } 75 76 ohos_unittest("DiscSdkTest") { 77 module_out_path = module_output_path 78 sources = [ "disc_sdk_test.cpp" ] 79 include_dirs = [ 80 "$dsoftbus_root_path/sdk/bus_center/manager/include", 81 "$dsoftbus_root_path/core/common/inner_communication", 82 "$dsoftbus_root_path/core/common/include", 83 "$dsoftbus_root_path/interfaces/kits/discovery", 84 "$dsoftbus_root_path/interfaces/kits/common", 85 "$dsoftbus_root_path/sdk/discovery/include", 86 "//commonlibrary/c_utils/base/include", 87 "//third_party/bounds_checking_function/include", 88 "unittest/common/", 89 "$dsoftbus_root_path/sdk/discovery/manager/include", 90 "$dsoftbus_root_path/tests/sdk/common/include", 91 ] 92 deps = [ 93 "$dsoftbus_root_path/sdk:softbus_client", 94 "$dsoftbus_root_path/tests/sdk/common:softbus_access_token_test", 95 "//third_party/bounds_checking_function:libsec_static", 96 "//third_party/googletest:gtest_main", 97 ] 98 if (is_standard_system) { 99 external_deps = [ 100 "c_utils:utils", 101 "hilog:libhilog", 102 ] 103 } else { 104 external_deps = [ 105 "c_utils:utils", 106 "hilog:libhilog", 107 ] 108 } 109 } 110 111 ohos_unittest("DiscSdkAutoTest") { 112 sanitize = { 113 cfi = true 114 cfi_cross_dso = true 115 debug = false 116 } 117 module_out_path = module_output_path 118 sources = [ "disc_sdk_auto_test.cpp" ] 119 include_dirs = [ 120 "$dsoftbus_root_path/core/common/include", 121 "$dsoftbus_root_path/tests/sdk/common/include", 122 "$dsoftbus_root_path/interfaces/kits/common", 123 "$dsoftbus_root_path/interfaces/kits/discovery", 124 ] 125 deps = [ 126 "$dsoftbus_root_path/sdk:softbus_client", 127 "$dsoftbus_root_path/tests/sdk/common:softbus_access_token_test", 128 "//third_party/bounds_checking_function:libsec_static", 129 "//third_party/googletest:gtest_main", 130 ] 131 if (is_standard_system) { 132 external_deps = [ 133 "c_utils:utils", 134 "hilog:libhilog", 135 ] 136 } else { 137 external_deps = [ 138 "c_utils:utils", 139 "hilog:libhilog", 140 ] 141 } 142 } 143 144 group("unittest") { 145 testonly = true 146 deps = [ 147 ":DiscSdkAutoTest", 148 ":DiscSdkOnlyL2Test", 149 ":DiscSdkTest", 150 ] 151 } 152} 153