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 14if (defined(ohos_lite)) { 15 import("//build/lite/config/test.gni") 16} else { 17 import("//build/config/sanitizers/sanitizers.gni") 18 import("//build/test.gni") 19 import("//drivers/adapter/uhdf2/uhdf.gni") 20} 21 22if (defined(ohos_lite)) { 23 unittest("usb_host_sdk_test") { 24 output_extension = "bin" 25 output_dir = "$root_out_dir/test/unittest/hdf" 26 include_dirs = [ 27 "//third_party/googletest/googletest/include", 28 "//third_party/bounds_checking_function/include", 29 "//drivers/framework/ability/sbuf/include", 30 "//drivers/framework/include/platform", 31 "//drivers/framework/include/core", 32 "//drivers/framework/include/osal", 33 "//drivers/adapter/uhdf/posix/include", 34 "//drivers/framework/include/utils", 35 "//drivers/framework/include/config", 36 "//drivers/framework/include", 37 "//drivers/framework/test/unittest/include", 38 "//base/hiviewdfx/hilog_lite/interfaces/native/innerkits", 39 ] 40 41 sources = [ 42 "//drivers/peripheral/usb/test/unittest/host_sdk/liteos/hdf_usb_test.cpp", 43 ] 44 deps = [ 45 "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared", 46 "//drivers/adapter/uhdf/manager:hdf_core", 47 "//drivers/adapter/uhdf/platform:hdf_platform", 48 "//drivers/adapter/uhdf/posix:hdf_posix_osal", 49 "//drivers/adapter/uhdf/test/unittest/common:hdf_test_common", 50 ] 51 public_deps = [ "//third_party/bounds_checking_function:libsec_shared" ] 52 cflags = [ 53 "-Wall", 54 "-Wextra", 55 "-Werror", 56 "-fsigned-char", 57 "-fno-common", 58 "-fno-strict-aliasing", 59 ] 60 } 61 unittest("usb_host_sdk_io_test") { 62 output_extension = "bin" 63 output_dir = "$root_out_dir/test/unittest/hdf" 64 include_dirs = [ 65 "//third_party/googletest/googletest/include", 66 "//third_party/bounds_checking_function/include", 67 "//drivers/framework/ability/sbuf/include", 68 "//drivers/framework/include/platform", 69 "//drivers/framework/include/core", 70 "//drivers/framework/include/osal", 71 "//drivers/adapter/uhdf/posix/include", 72 "//drivers/framework/include/utils", 73 "//drivers/framework/include/config", 74 "//drivers/framework/include", 75 "//drivers/framework/test/unittest/include", 76 "//base/hiviewdfx/hilog_lite/interfaces/native/innerkits", 77 ] 78 79 sources = [ "//drivers/peripheral/usb/test/unittest/host_sdk/liteos/hdf_usb_io_test.cpp" ] 80 deps = [ 81 "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared", 82 "//drivers/adapter/uhdf/manager:hdf_core", 83 "//drivers/adapter/uhdf/platform:hdf_platform", 84 "//drivers/adapter/uhdf/posix:hdf_posix_osal", 85 "//drivers/adapter/uhdf/test/unittest/common:hdf_test_common", 86 ] 87 public_deps = [ "//third_party/bounds_checking_function:libsec_shared" ] 88 cflags = [ 89 "-Wall", 90 "-Wextra", 91 "-Werror", 92 "-fsigned-char", 93 "-fno-common", 94 "-fno-strict-aliasing", 95 ] 96 } 97 unittest("usb_host_raw_test") { 98 output_extension = "bin" 99 output_dir = "$root_out_dir/test/unittest/hdf" 100 include_dirs = [ 101 "//third_party/googletest/googletest/include", 102 "//third_party/bounds_checking_function/include", 103 "//drivers/framework/ability/sbuf/include", 104 "//drivers/framework/include/platform", 105 "//drivers/framework/include/core", 106 "//drivers/framework/include/osal", 107 "//drivers/adapter/uhdf/posix/include", 108 "//drivers/framework/include/utils", 109 "//drivers/framework/include/config", 110 "//drivers/framework/include", 111 "//drivers/framework/test/unittest/include", 112 "//base/hiviewdfx/hilog_lite/interfaces/native/innerkits", 113 ] 114 115 sources = [ "//drivers/peripheral/usb/test/unittest/host_sdk/liteos/hdf_usb_raw_test.cpp" ] 116 deps = [ 117 "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared", 118 "//drivers/adapter/uhdf/manager:hdf_core", 119 "//drivers/adapter/uhdf/platform:hdf_platform", 120 "//drivers/adapter/uhdf/posix:hdf_posix_osal", 121 "//drivers/adapter/uhdf/test/unittest/common:hdf_test_common", 122 ] 123 public_deps = [ "//third_party/bounds_checking_function:libsec_shared" ] 124 cflags = [ 125 "-Wall", 126 "-Wextra", 127 "-Werror", 128 "-fsigned-char", 129 "-fno-common", 130 "-fno-strict-aliasing", 131 ] 132 } 133 unittest("usb_host_raw_io_test") { 134 output_extension = "bin" 135 output_dir = "$root_out_dir/test/unittest/hdf" 136 include_dirs = [ 137 "//third_party/googletest/googletest/include", 138 "//third_party/bounds_checking_function/include", 139 "//drivers/framework/ability/sbuf/include", 140 "//drivers/framework/include/platform", 141 "//drivers/framework/include/core", 142 "//drivers/framework/include/osal", 143 "//drivers/adapter/uhdf/posix/include", 144 "//drivers/framework/include/utils", 145 "//drivers/framework/include/config", 146 "//drivers/framework/include", 147 "//drivers/framework/test/unittest/include", 148 "//base/hiviewdfx/hilog_lite/interfaces/native/innerkits", 149 ] 150 151 sources = [ "//drivers/peripheral/usb/test/unittest/host_sdk/liteos/hdf_usb_raw_io_test.cpp" ] 152 deps = [ 153 "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared", 154 "//drivers/adapter/uhdf/manager:hdf_core", 155 "//drivers/adapter/uhdf/platform:hdf_platform", 156 "//drivers/adapter/uhdf/posix:hdf_posix_osal", 157 "//drivers/adapter/uhdf/test/unittest/common:hdf_test_common", 158 ] 159 public_deps = [ "//third_party/bounds_checking_function:libsec_shared" ] 160 cflags = [ 161 "-Wall", 162 "-Wextra", 163 "-Werror", 164 "-fsigned-char", 165 "-fno-common", 166 "-fno-strict-aliasing", 167 ] 168 } 169} else { 170 module_output_path = "hdf/usb" 171 ohos_unittest("usb_host_sdk_if_test") { 172 module_out_path = module_output_path 173 include_dirs = [ 174 "//drivers/peripheral/usb/ddk/common/include", 175 "//drivers/peripheral/usb/ddk/device/include", 176 "//drivers/peripheral/usb/ddk/host/include", 177 "//drivers/peripheral/usb/interfaces/ddk/common", 178 "//drivers/peripheral/usb/interfaces/ddk/host", 179 "//drivers/peripheral/usb/interfaces/ddk/device", 180 "//drivers/peripheral/usb/test/unittest/host_sdk", 181 ] 182 183 sources = [ "//drivers/peripheral/usb/test/unittest/host_sdk/usb_host_sdk_if_test.cpp" ] 184 185 deps = [ "//drivers/peripheral/usb/ddk:libusb_core" ] 186 187 if (is_standard_system) { 188 external_deps = [ 189 "device_driver_framework:libhdf_utils", 190 "hiviewdfx_hilog_native:libhilog", 191 "utils_base:utils", 192 ] 193 } else { 194 external_deps = [ "hilog:libhilog" ] 195 } 196 } 197 198 ohos_unittest("usb_raw_sdk_if_test") { 199 module_out_path = module_output_path 200 include_dirs = [ 201 "//drivers/peripheral/usb/ddk/common/include", 202 "//drivers/peripheral/usb/ddk/host/include", 203 "//drivers/peripheral/usb/interfaces/ddk/common", 204 "//drivers/peripheral/usb/interfaces/ddk/host", 205 "//drivers/peripheral/usb/interfaces/ddk/device", 206 "//drivers/peripheral/usb/test/unittest/host_sdk", 207 ] 208 209 sources = [ 210 "//drivers/peripheral/usb/test/unittest/host_sdk/usb_raw_sdk_if_test.cpp", 211 ] 212 213 deps = [ "//drivers/peripheral/usb/ddk:libusb_core" ] 214 215 if (is_standard_system) { 216 external_deps = [ 217 "device_driver_framework:libhdf_host", 218 "device_driver_framework:libhdf_ipc_adapter", 219 "device_driver_framework:libhdf_utils", 220 "hiviewdfx_hilog_native:libhilog", 221 "utils_base:utils", 222 ] 223 } else { 224 external_deps = [ "hilog:libhilog" ] 225 } 226 } 227 228 ohos_unittest("usb_host_sdk_if_test_io") { 229 module_out_path = module_output_path 230 include_dirs = [ 231 "//drivers/peripheral/usb/ddk/common/include", 232 "//drivers/peripheral/usb/ddk/device/include", 233 "//drivers/peripheral/usb/ddk/host/include", 234 "//drivers/peripheral/usb/interfaces/ddk/common", 235 "//drivers/peripheral/usb/interfaces/ddk/host", 236 "//drivers/peripheral/usb/interfaces/ddk/device", 237 "//drivers/peripheral/usb/test/unittest/host_sdk", 238 ] 239 240 sources = [ "//drivers/peripheral/usb/test/unittest/host_sdk/usb_host_sdk_if_test_io.cpp" ] 241 242 deps = [ "//drivers/peripheral/usb/ddk:libusb_core" ] 243 244 if (is_standard_system) { 245 external_deps = [ 246 "device_driver_framework:libhdf_utils", 247 "hiviewdfx_hilog_native:libhilog", 248 "utils_base:utils", 249 ] 250 } else { 251 external_deps = [ "hilog:libhilog" ] 252 } 253 } 254 255 ohos_unittest("usb_raw_sdk_if_test_io") { 256 module_out_path = module_output_path 257 include_dirs = [ 258 "//drivers/peripheral/usb/ddk/common/include", 259 "//drivers/peripheral/usb/ddk/host/include", 260 "//drivers/peripheral/usb/interfaces/ddk/common", 261 "//drivers/peripheral/usb/interfaces/ddk/host", 262 "//drivers/peripheral/usb/interfaces/ddk/device", 263 "//drivers/peripheral/usb/test/unittest/host_sdk", 264 ] 265 266 sources = [ "//drivers/peripheral/usb/test/unittest/host_sdk/usb_raw_sdk_if_test_io.cpp" ] 267 268 deps = [ "//drivers/peripheral/usb/ddk:libusb_core" ] 269 270 if (is_standard_system) { 271 external_deps = [ 272 "device_driver_framework:libhdf_host", 273 "device_driver_framework:libhdf_ipc_adapter", 274 "device_driver_framework:libhdf_utils", 275 "hiviewdfx_hilog_native:libhilog", 276 "utils_base:utils", 277 ] 278 } else { 279 external_deps = [ "hilog:libhilog" ] 280 } 281 } 282 group("hdf_unittest_usb_host") { 283 testonly = true 284 deps = [ 285 ":usb_host_sdk_if_test", 286 ":usb_host_sdk_if_test_io", 287 ":usb_raw_sdk_if_test", 288 ":usb_raw_sdk_if_test_io", 289 ] 290 } 291} 292