• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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("hdf_usb_device_sdk_if_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 = [ "//drivers/peripheral/usb/test/unittest/common/usb_device_liteos_sdk_test.cpp" ]
42    deps = [
43      "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared",
44      "//drivers/adapter/uhdf/manager:hdf_core",
45      "//drivers/adapter/uhdf/platform:hdf_platform",
46      "//drivers/adapter/uhdf/posix:hdf_posix_osal",
47      "//drivers/adapter/uhdf/test/unittest/common:hdf_test_common",
48    ]
49    public_deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
50    cflags = [
51      "-Wall",
52      "-Wextra",
53      "-Werror",
54      "-fsigned-char",
55      "-fno-common",
56      "-fno-strict-aliasing",
57    ]
58  }
59  unittest("usb_host_sdk_test") {
60    output_extension = "bin"
61    output_dir = "$root_out_dir/test/unittest/hdf"
62    include_dirs = [
63      "//third_party/googletest/googletest/include",
64      "//third_party/bounds_checking_function/include",
65      "//drivers/framework/ability/sbuf/include",
66      "//drivers/framework/include/platform",
67      "//drivers/framework/include/core",
68      "//drivers/framework/include/osal",
69      "//drivers/adapter/uhdf/posix/include",
70      "//drivers/framework/include/utils",
71      "//drivers/framework/include/config",
72      "//drivers/framework/include",
73      "//drivers/framework/test/unittest/include",
74      "//base/hiviewdfx/hilog_lite/interfaces/native/innerkits",
75    ]
76
77    sources = [
78      "//drivers/peripheral/usb/test/unittest/host_sdk/liteos/hdf_usb_test.cpp",
79    ]
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_sdk_test1") {
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_test1.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_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_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  unittest("usb_host_raw_test1") {
170    output_extension = "bin"
171    output_dir = "$root_out_dir/test/unittest/hdf"
172    include_dirs = [
173      "//third_party/googletest/googletest/include",
174      "//third_party/bounds_checking_function/include",
175      "//drivers/framework/ability/sbuf/include",
176      "//drivers/framework/include/platform",
177      "//drivers/framework/include/core",
178      "//drivers/framework/include/osal",
179      "//drivers/adapter/uhdf/posix/include",
180      "//drivers/framework/include/utils",
181      "//drivers/framework/include/config",
182      "//drivers/framework/include",
183      "//drivers/framework/test/unittest/include",
184      "//base/hiviewdfx/hilog_lite/interfaces/native/innerkits",
185    ]
186
187    sources = [ "//drivers/peripheral/usb/test/unittest/host_sdk/liteos/hdf_usb_raw_test1.cpp" ]
188    deps = [
189      "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared",
190      "//drivers/adapter/uhdf/manager:hdf_core",
191      "//drivers/adapter/uhdf/platform:hdf_platform",
192      "//drivers/adapter/uhdf/posix:hdf_posix_osal",
193      "//drivers/adapter/uhdf/test/unittest/common:hdf_test_common",
194    ]
195    public_deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
196    cflags = [
197      "-Wall",
198      "-Wextra",
199      "-Werror",
200      "-fsigned-char",
201      "-fno-common",
202      "-fno-strict-aliasing",
203    ]
204  }
205} else {
206  module_output_path = "hdf/usb"
207  ohos_unittest("usb_device_sdk_if_test") {
208    module_out_path = module_output_path
209    include_dirs = [
210      "//drivers/peripheral/usb/ddk/common/include",
211      "//drivers/peripheral/usb/ddk/device/include",
212      "//drivers/peripheral/usb/interfaces/ddk/common",
213      "//drivers/peripheral/usb/interfaces/ddk/device",
214      "//third_party/googletest/googletest/include",
215      "device_sdk",
216      "//utils/native/base/include",
217      "$hdf_framework_path/core/manager/include",
218      "$hdf_framework_path/core/host/include",
219      "$hdf_framework_path/core/shared/include",
220      "$hdf_framework_path/include/osal",
221      "$hdf_framework_path/include/utils",
222      "$hdf_framework_path/include/core",
223      "$hdf_framework_path/utils/include",
224      "$hdf_framework_path/ability/sbuf/include",
225      "$hdf_uhdf_path/ipc/include",
226      "$hdf_uhdf_path/osal/include",
227      "$hdf_uhdf_path/include/config",
228      "$hdf_uhdf_path/include/host",
229      "$hdf_uhdf_path/shared/include",
230      "$hdf_uhdf_path/manager/include",
231    ]
232
233    sources = [
234      "./device_sdk/usb_device_cdcacm_test.cpp",
235      "./device_sdk/usb_device_sdk_if_test.cpp",
236    ]
237    deps = [
238      "$hdf_uhdf_path/config:uhdf_hcs_pkg",
239      "$hdf_uhdf_path/hdi:libhdi",
240      "$hdf_uhdf_path/host:libhdf_host",
241      "$hdf_uhdf_path/ipc:libhdf_ipc_adapter",
242      "$hdf_uhdf_path/osal:libhdf_utils",
243      "//drivers/peripheral/usb/ddk:libusb_core",
244      "//utils/native/base:utils",
245    ]
246
247    if (is_standard_system) {
248      external_deps = [ "hiviewdfx_hilog_native:libhilog" ]
249    } else {
250      external_deps = [ "hilog:libhilog" ]
251    }
252  }
253
254  ohos_unittest("usb_device_sdk_io_test") {
255    module_out_path = module_output_path
256    include_dirs = [
257      "//drivers/peripheral/usb/ddk/common/include",
258      "//drivers/peripheral/usb/ddk/device/include",
259      "//drivers/peripheral/usb/interfaces/ddk/common",
260      "//drivers/peripheral/usb/interfaces/ddk/device",
261      "//third_party/googletest/googletest/include",
262      "device_sdk",
263      "//utils/native/base/include",
264      "$hdf_framework_path/core/manager/include",
265      "$hdf_framework_path/core/host/include",
266      "$hdf_framework_path/core/shared/include",
267      "$hdf_framework_path/include/osal",
268      "$hdf_framework_path/include/utils",
269      "$hdf_framework_path/include/core",
270      "$hdf_framework_path/utils/include",
271      "$hdf_framework_path/ability/sbuf/include",
272      "$hdf_uhdf_path/ipc/include",
273      "$hdf_uhdf_path/osal/include",
274      "$hdf_uhdf_path/include/config",
275      "$hdf_uhdf_path/include/host",
276      "$hdf_uhdf_path/shared/include",
277      "$hdf_uhdf_path/manager/include",
278    ]
279
280    sources = [
281      "./device_sdk/usb_device_cdcacm_test.cpp",
282      "./device_sdk/usb_device_sdk_io_test.cpp",
283    ]
284    deps = [
285      "$hdf_uhdf_path/config:uhdf_hcs_pkg",
286      "$hdf_uhdf_path/hdi:libhdi",
287      "$hdf_uhdf_path/host:libhdf_host",
288      "$hdf_uhdf_path/ipc:libhdf_ipc_adapter",
289      "$hdf_uhdf_path/osal:libhdf_utils",
290      "//drivers/peripheral/usb/ddk:libusb_core",
291      "//utils/native/base:utils",
292    ]
293
294    if (is_standard_system) {
295      external_deps = [ "hiviewdfx_hilog_native:libhilog" ]
296    } else {
297      external_deps = [ "hilog:libhilog" ]
298    }
299  }
300
301  ohos_unittest("usb_host_sdk_if_test") {
302    module_out_path = module_output_path
303    include_dirs = [
304      "$hdf_framework_path/include/config",
305      "$hdf_framework_path/ability/config/hcs_parser/include",
306      "$hdf_framework_path/core/common/include/host/",
307      "//drivers/peripheral/usb/ddk/common/include",
308      "//drivers/peripheral/usb/ddk/device/include",
309      "//drivers/peripheral/usb/ddk/host/include",
310      "//drivers/peripheral/usb/interfaces/ddk/common",
311      "//drivers/peripheral/usb/interfaces/ddk/host",
312      "//drivers/peripheral/usb/interfaces/ddk/device",
313      "host_sdk",
314    ]
315
316    sources = [ "./host_sdk/usb_host_sdk_if_test.cpp" ]
317
318    deps = [
319      "//drivers/adapter/uhdf2/config:uhdf_hcs_pkg",
320      "//drivers/adapter/uhdf2/osal:libhdf_utils",
321      "//drivers/peripheral/usb/ddk:libusb_core",
322      "//utils/native/base:utils",
323    ]
324
325    if (is_standard_system) {
326      external_deps = [ "hiviewdfx_hilog_native:libhilog" ]
327    } else {
328      external_deps = [ "hilog:libhilog" ]
329    }
330  }
331
332  ohos_unittest("usb_raw_sdk_if_test") {
333    module_out_path = module_output_path
334    include_dirs = [
335      "$hdf_framework_path/include/config",
336      "$hdf_framework_path/ability/config/hcs_parser/include",
337      "$hdf_framework_path/core/common/include/host/",
338      "//drivers/peripheral/usb/ddk/common/include",
339      "//drivers/peripheral/usb/ddk/host/include",
340      "//drivers/peripheral/usb/interfaces/ddk/common",
341      "//drivers/peripheral/usb/interfaces/ddk/host",
342      "//drivers/peripheral/usb/interfaces/ddk/device",
343      "host_sdk",
344    ]
345
346    sources = [ "./host_sdk/usb_raw_sdk_if_test.cpp" ]
347
348    deps = [
349      "//drivers/adapter/uhdf2/host:libhdf_host",
350      "//drivers/adapter/uhdf2/ipc:libhdf_ipc_adapter",
351      "//drivers/adapter/uhdf2/osal:libhdf_utils",
352      "//drivers/peripheral/usb/ddk:libusb_core",
353      "//utils/native/base:utils",
354    ]
355
356    if (is_standard_system) {
357      external_deps = [ "hiviewdfx_hilog_native:libhilog" ]
358    } else {
359      external_deps = [ "hilog:libhilog" ]
360    }
361  }
362
363  ohos_unittest("usb_host_sdk_if_test_io") {
364    module_out_path = module_output_path
365    include_dirs = [
366      "$hdf_framework_path/include/config",
367      "$hdf_framework_path/ability/config/hcs_parser/include",
368      "$hdf_framework_path/core/common/include/host/",
369      "//drivers/peripheral/usb/ddk/common/include",
370      "//drivers/peripheral/usb/ddk/device/include",
371      "//drivers/peripheral/usb/ddk/host/include",
372      "//drivers/peripheral/usb/interfaces/ddk/common",
373      "//drivers/peripheral/usb/interfaces/ddk/host",
374      "//drivers/peripheral/usb/interfaces/ddk/device",
375      "host_sdk",
376    ]
377
378    sources = [ "./host_sdk/usb_host_sdk_if_test_io.cpp" ]
379
380    deps = [
381      "//drivers/adapter/uhdf2/config:uhdf_hcs_pkg",
382      "//drivers/adapter/uhdf2/osal:libhdf_utils",
383      "//drivers/peripheral/usb/ddk:libusb_core",
384      "//utils/native/base:utils",
385    ]
386
387    if (is_standard_system) {
388      external_deps = [ "hiviewdfx_hilog_native:libhilog" ]
389    } else {
390      external_deps = [ "hilog:libhilog" ]
391    }
392  }
393
394  ohos_unittest("usb_raw_sdk_if_test_io") {
395    module_out_path = module_output_path
396    include_dirs = [
397      "$hdf_framework_path/include/config",
398      "$hdf_framework_path/ability/config/hcs_parser/include",
399      "$hdf_framework_path/core/common/include/host/",
400      "//drivers/peripheral/usb/ddk/common/include",
401      "//drivers/peripheral/usb/ddk/host/include",
402      "//drivers/peripheral/usb/interfaces/ddk/common",
403      "//drivers/peripheral/usb/interfaces/ddk/host",
404      "//drivers/peripheral/usb/interfaces/ddk/device",
405      "host_sdk",
406    ]
407
408    sources = [ "./host_sdk/usb_raw_sdk_if_test_io.cpp" ]
409
410    deps = [
411      "//drivers/adapter/uhdf2/host:libhdf_host",
412      "//drivers/adapter/uhdf2/ipc:libhdf_ipc_adapter",
413      "//drivers/adapter/uhdf2/osal:libhdf_utils",
414      "//drivers/peripheral/usb/ddk:libusb_core",
415      "//utils/native/base:utils",
416    ]
417
418    if (is_standard_system) {
419      external_deps = [ "hiviewdfx_hilog_native:libhilog" ]
420    } else {
421      external_deps = [ "hilog:libhilog" ]
422    }
423  }
424  group("hdf_unittest_usb") {
425    testonly = true
426    deps = [
427      ":usb_device_sdk_if_test",
428      ":usb_device_sdk_io_test",
429      ":usb_host_sdk_if_test",
430      ":usb_host_sdk_if_test_io",
431      ":usb_raw_sdk_if_test",
432      ":usb_raw_sdk_if_test_io",
433    ]
434  }
435}
436