1# Copyright (c) 2023 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("//build/test.gni") 15import("../../../../../dsoftbus.gni") 16 17module_output_path = "dsoftbus/transmission" 18dsoftbus_root_path = "../../../../.." 19softbus_adapter_config = "${dsoftbus_root_path}/adapter/default_config" 20 21ohos_unittest("TransSdkTcpDirectTest") { 22 sanitize = { 23 cfi = true 24 cfi_cross_dso = true 25 debug = false 26 } 27 module_out_path = module_output_path 28 sources = [ "trans_sdk_tcp_direct_test.cpp" ] 29 30 include_dirs = [ 31 "$dsoftbus_root_path/core/common/softbus_property/include", 32 "$softbus_adapter_config/spec_config", 33 "$dsoftbus_root_path/adapter/common/include/OS_adapter_define/linux", 34 "$dsoftbus_root_path/core/common/include", 35 "$dsoftbus_root_path/core/connection/interface", 36 "$dsoftbus_root_path/sdk/transmission/session/include", 37 "$dsoftbus_root_path/interfaces/inner_kits/transport", 38 "$dsoftbus_root_path/interfaces/kits/transport", 39 "$dsoftbus_root_path/tests/sdk/common/include", 40 "$dsoftbus_root_path/sdk/transmission/trans_channel/tcp_direct/src", 41 "$dsoftbus_root_path/adapter/common/include", 42 "$dsoftbus_root_path/sdk/transmission/trans_channel/tcp_direct/include", 43 "$dsoftbus_root_path/sdk/transmission/session/include", 44 "$dsoftbus_root_path/core/frame/common/include", 45 "$dsoftbus_root_path/sdk/transmission/trans_channel/udp/common/include", 46 "$dsoftbus_root_path/core/transmission/trans_channel/udp_negotiation/include", 47 "$dsoftbus_root_path/sdk/transmission/trans_channel/udp/file/include", 48 "$dsoftbus_root_path/sdk/transmission/ipc/include", 49 ] 50 51 deps = [ 52 "$dsoftbus_root_path/adapter:softbus_adapter", 53 "$dsoftbus_root_path/core/common:softbus_utils", 54 "$dsoftbus_root_path/tests/sdk:softbus_client_static", 55 "$dsoftbus_root_path/tests/sdk/common:softbus_access_token_test", 56 ] 57 58 external_deps = [ 59 "bounds_checking_function:libsec_static", 60 "c_utils:utils", 61 "hilog:libhilog", 62 ] 63} 64 65ohos_unittest("TransSessionTest") { 66 module_out_path = module_output_path 67 sources = [ "trans_session_test.cpp" ] 68 69 include_dirs = [ 70 "$dsoftbus_root_path/core/common/include", 71 "$dsoftbus_root_path/core/common/include", 72 "$dsoftbus_root_path/core/connection/interface", 73 "$dsoftbus_root_path/sdk/transmission/session/include", 74 "$dsoftbus_root_path/interfaces/inner_kits/transport", 75 "$dsoftbus_root_path/interfaces/kits/transport", 76 "$dsoftbus_root_path/tests/sdk/common/include", 77 "$dsoftbus_root_path/sdk/transmission/trans_channel/tcp_direct/src", 78 "$dsoftbus_root_path/adapter/common/include", 79 "$dsoftbus_root_path/sdk/transmission/trans_channel/tcp_direct/include", 80 "$dsoftbus_root_path/sdk/transmission/session/include", 81 "$dsoftbus_root_path/core/frame/common/include", 82 "$dsoftbus_root_path/sdk/transmission/trans_channel/udp/common/include", 83 "$dsoftbus_root_path/core/transmission/trans_channel/udp_negotiation/include", 84 "$dsoftbus_root_path/sdk/transmission/trans_channel/udp/file/include", 85 "$dsoftbus_root_path/sdk/transmission/ipc/include", 86 ] 87 88 deps = [ 89 "$dsoftbus_root_path/core/common:softbus_utils", 90 "$dsoftbus_root_path/tests/sdk:softbus_client_static", 91 "$dsoftbus_root_path/tests/sdk/common:softbus_access_token_test", 92 ] 93 94 if (is_standard_system) { 95 external_deps = [ 96 "c_utils:utils", 97 "googletest:gmock", 98 "hilog:libhilog", 99 ] 100 } else { 101 external_deps = [ 102 "c_utils:utils", 103 "hilog:libhilog", 104 ] 105 } 106} 107 108ohos_unittest("TransTcpDirectTest") { 109 module_out_path = module_output_path 110 sources = [ 111 "trans_tcp_direct_mock.cpp", 112 "trans_tcp_direct_test.cpp", 113 ] 114 115 include_dirs = [ 116 "$dsoftbus_root_path/core/common/include", 117 "$dsoftbus_root_path/core/common/include", 118 "$dsoftbus_root_path/core/connection/interface", 119 "$dsoftbus_root_path/sdk/transmission/session/include", 120 "$dsoftbus_root_path/interfaces/inner_kits/transport", 121 "$dsoftbus_root_path/interfaces/kits/transport", 122 "$dsoftbus_root_path/tests/sdk/common/include", 123 "$dsoftbus_root_path/sdk/transmission/trans_channel/common/include", 124 "$dsoftbus_root_path/sdk/transmission/trans_channel/tcp_direct/src", 125 "$dsoftbus_root_path/adapter/common/include", 126 "$dsoftbus_root_path/sdk/transmission/trans_channel/tcp_direct/include", 127 "$dsoftbus_root_path/sdk/transmission/session/include", 128 "$dsoftbus_root_path/core/frame/common/include", 129 "$dsoftbus_root_path/sdk/transmission/trans_channel/udp/common/include", 130 "$dsoftbus_root_path/core/transmission/trans_channel/udp_negotiation/include", 131 "$dsoftbus_root_path/sdk/transmission/trans_channel/udp/file/include", 132 "$dsoftbus_root_path/sdk/transmission/ipc/include", 133 ] 134 135 deps = [ 136 "$dsoftbus_root_path/core/common:softbus_utils", 137 "$dsoftbus_root_path/tests/sdk:softbus_client_static", 138 "$dsoftbus_root_path/tests/sdk/common:softbus_access_token_test", 139 ] 140 141 if (is_standard_system) { 142 external_deps = [ 143 "c_utils:utils", 144 "googletest:gmock", 145 "hilog:libhilog", 146 ] 147 } else { 148 external_deps = [ 149 "c_utils:utils", 150 "hilog:libhilog", 151 ] 152 } 153} 154 155ohos_unittest("TransTcpDirectMockTest") { 156 module_out_path = module_output_path 157 sources = [ 158 "trans_tcp_direct_mock_test.cpp", 159 "trans_tcp_direct_tlv_mock.cpp", 160 ] 161 162 include_dirs = [ 163 "$dsoftbus_root_path/core/common/include", 164 "$dsoftbus_root_path/core/common/include", 165 "$dsoftbus_root_path/core/connection/interface", 166 "$dsoftbus_root_path/sdk/transmission/session/include", 167 "$dsoftbus_root_path/interfaces/inner_kits/transport", 168 "$dsoftbus_root_path/interfaces/kits/transport", 169 "$dsoftbus_root_path/tests/sdk/common/include", 170 "$dsoftbus_root_path/sdk/transmission/trans_channel/common/include", 171 "$dsoftbus_root_path/sdk/transmission/trans_channel/tcp_direct/src", 172 "$dsoftbus_root_path/adapter/common/include", 173 "$dsoftbus_root_path/sdk/transmission/trans_channel/tcp_direct/include", 174 "$dsoftbus_root_path/sdk/transmission/session/include", 175 "$dsoftbus_root_path/core/frame/common/include", 176 "$dsoftbus_root_path/sdk/transmission/trans_channel/udp/common/include", 177 "$dsoftbus_root_path/core/transmission/trans_channel/udp_negotiation/include", 178 "$dsoftbus_root_path/sdk/transmission/trans_channel/udp/file/include", 179 "$dsoftbus_root_path/sdk/transmission/ipc/include", 180 ] 181 182 deps = [ 183 "$dsoftbus_root_path/core/common:softbus_utils", 184 "$dsoftbus_root_path/tests/sdk/common:softbus_access_token_test", 185 ] 186 187 if (is_standard_system) { 188 external_deps = [ 189 "c_utils:utils", 190 "googletest:gmock", 191 "hilog:libhilog", 192 ] 193 } else { 194 external_deps = [ 195 "c_utils:utils", 196 "googletest:gmock", 197 "hilog:libhilog", 198 ] 199 } 200} 201 202group("unittest") { 203 testonly = true 204 deps = [ 205 ":TransSdkTcpDirectTest", 206 ":TransSessionTest", 207 ":TransTcpDirectMockTest", 208 ":TransTcpDirectTest", 209 ] 210} 211