• 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}
20import("//drivers/adapter/uhdf2/uhdf.gni")
21
22if (defined(ohos_lite)) {
23  output_path = "$root_out_dir/test/moduletest/hdf/usb"
24  moduletest("usb_host_serial_func_test") {
25    output_extension = "bin"
26    output_dir = output_path
27    include_dirs = [
28      "//third_party/googletest/googletest/include",
29      "//drivers/peripheral/usb/sample/host/include",
30      "//drivers/adapter/uhdf/posix/include",
31      "//drivers/adapter/khdf/liteos/osal/include",
32      "//drivers/adapter/khdf/liteos/model/usb/host/include",
33      "//drivers/framework/include/utils",
34      "//drivers/framework/include/osal",
35      "//drivers/framework/core/adapter/syscall/include",
36      "//drivers/framework/include/core",
37      "//drivers/framework/ability/sbuf/include",
38      "//drivers/framework/core/shared/include",
39      "//drivers/framework/core/common/include/host",
40      "//drivers/framework/utils/include",
41      "//drivers/framework/include",
42      "//third_party/bounds_checking_function/include",
43      "//base/hiviewdfx/hilog_lite/interfaces/native/innerkits",
44      "//drivers/peripheral/usb/serial/include",
45      "//drivers/peripheral/usb/ddk/common/include",
46      "//drivers/peripheral/usb/ddk/device/include",
47      "//drivers/peripheral/usb/ddk/host/include",
48      "//drivers/peripheral/usb/interfaces/ddk/common",
49      "//drivers/peripheral/usb/interfaces/ddk/host",
50      "//drivers/peripheral/usb/gadget/function/include",
51      "common",
52    ]
53    sources = [
54      "./common/liteos/usb_host_serial_func_test.cpp",
55      "//drivers/peripheral/usb/sample/host/src/usbhost_ddk_test.c",
56    ]
57    deps = [
58      "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared",
59      "//drivers/adapter/uhdf/manager:hdf_core",
60      "//drivers/adapter/uhdf/posix:hdf_posix_osal",
61      "//utils/native/lite:utils",
62    ]
63    defines = [ "__LITEOS_USB_HOST_DDK_TEST__" ]
64  }
65
66  moduletest("usb_host_raw_api_func_test") {
67    output_extension = "bin"
68    output_dir = output_path
69    include_dirs = [
70      "//third_party/googletest/googletest/include",
71      "//drivers/peripheral/usb/sample/host/include",
72      "//drivers/adapter/uhdf/posix/include",
73      "//drivers/adapter/khdf/liteos/osal/include",
74      "//drivers/adapter/khdf/liteos/model/usb/host/include",
75      "//drivers/framework/include/utils",
76      "//drivers/framework/include/osal",
77      "//drivers/framework/core/adapter/syscall/include",
78      "//drivers/framework/include/core",
79      "//drivers/framework/ability/sbuf/include",
80      "//drivers/framework/core/shared/include",
81      "//drivers/framework/core/common/include/host",
82      "//drivers/framework/utils/include",
83      "//drivers/framework/include",
84      "//third_party/bounds_checking_function/include",
85      "//base/hiviewdfx/hilog_lite/interfaces/native/innerkits",
86      "//drivers/peripheral/usb/serial/include",
87      "//drivers/peripheral/usb/ddk/common/include",
88      "//drivers/peripheral/usb/ddk/device/include",
89      "//drivers/peripheral/usb/ddk/host/include",
90      "//drivers/peripheral/usb/interfaces/ddk/common",
91      "//drivers/peripheral/usb/interfaces/ddk/host",
92      "//drivers/peripheral/usb/gadget/function/include",
93      "common",
94    ]
95    sources = [
96      "./common/liteos/usb_host_raw_api_func_test.cpp",
97      "//drivers/peripheral/usb/sample/host/src/usbhost_ddk_test.c",
98    ]
99    deps = [
100      "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared",
101      "//drivers/adapter/uhdf/manager:hdf_core",
102      "//drivers/adapter/uhdf/posix:hdf_posix_osal",
103      "//utils/native/lite:utils",
104    ]
105    defines = [ "__LITEOS_USB_HOST_DDK_TEST__" ]
106  }
107
108  moduletest("usb_host_serial_loopback") {
109    output_extension = "bin"
110    output_dir = output_path
111    include_dirs = [
112      "//third_party/googletest/googletest/include",
113      "//drivers/peripheral/usb/sample/host/include",
114      "//drivers/adapter/uhdf/posix/include",
115      "//drivers/adapter/khdf/liteos/osal/include",
116      "//drivers/adapter/khdf/liteos/model/usb/host/include",
117      "//drivers/framework/include/utils",
118      "//drivers/framework/include/osal",
119      "//drivers/framework/core/adapter/syscall/include",
120      "//drivers/framework/include/core",
121      "//drivers/framework/ability/sbuf/include",
122      "//drivers/framework/core/shared/include",
123      "//drivers/framework/core/common/include/host",
124      "//drivers/framework/utils/include",
125      "//drivers/framework/include",
126      "//third_party/bounds_checking_function/include",
127      "//base/hiviewdfx/hilog_lite/interfaces/native/innerkits",
128      "//drivers/peripheral/usb/serial/include",
129      "//drivers/peripheral/usb/ddk/common/include",
130      "//drivers/peripheral/usb/ddk/device/include",
131      "//drivers/peripheral/usb/ddk/host/include",
132      "//drivers/peripheral/usb/interfaces/ddk/common",
133      "//drivers/peripheral/usb/interfaces/ddk/host",
134      "//drivers/peripheral/usb/gadget/function/include",
135      "common",
136    ]
137    sources = [
138      "./common/liteos/usb_host_serial_loopback.cpp",
139      "//drivers/peripheral/usb/sample/host/src/usbhost_ddk_test.c",
140    ]
141    deps = [
142      "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared",
143      "//drivers/adapter/uhdf/manager:hdf_core",
144      "//drivers/adapter/uhdf/posix:hdf_posix_osal",
145      "//utils/native/lite:utils",
146    ]
147    defines = [ "__LITEOS_USB_HOST_DDK_TEST__" ]
148  }
149
150  moduletest("usb_device_serial_loopback") {
151    output_extension = "bin"
152    output_dir = output_path
153    include_dirs = [
154      "//third_party/googletest/googletest/include",
155      "//drivers/peripheral/usb/sample/device/liteos/lib/include",
156      "$hdf_framework_path/ability/sbuf/include",
157      "$hdf_framework_path/core/shared/include",
158      "$hdf_framework_path/core/host/include",
159      "$hdf_framework_path/core/master/include",
160      "$hdf_framework_path/include/core",
161      "$hdf_framework_path/include/utils",
162      "$hdf_framework_path/utils/include",
163      "$hdf_framework_path/include/osal",
164      "//drivers/adapter/uhdf/posix/include",
165      "//third_party/bounds_checking_function/include",
166      "//base/hiviewdfx/hilog_lite/interfaces/native/innerkits",
167      "common",
168    ]
169    sources = [
170      "./common/liteos/usb_device_serial_loopback.cpp",
171      "//drivers/peripheral/usb/sample/device/liteos/lib/src/lib_acm_test.c",
172    ]
173    deps = [
174      "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared",
175      "//drivers/adapter/uhdf/manager:hdf_core",
176      "//drivers/adapter/uhdf/posix:hdf_posix_osal",
177      "//utils/native/lite:utils",
178    ]
179  }
180
181  moduletest("usb_device_serial_func_test") {
182    output_extension = "bin"
183    output_dir = output_path
184    include_dirs = [
185      "//third_party/googletest/googletest/include",
186      "//drivers/peripheral/usb/sample/device/liteos/lib/include",
187      "$hdf_framework_path/ability/sbuf/include",
188      "$hdf_framework_path/core/shared/include",
189      "$hdf_framework_path/core/host/include",
190      "$hdf_framework_path/core/master/include",
191      "$hdf_framework_path/include/core",
192      "$hdf_framework_path/include/utils",
193      "$hdf_framework_path/utils/include",
194      "$hdf_framework_path/include/osal",
195      "//drivers/adapter/uhdf/posix/include",
196      "//third_party/bounds_checking_function/include",
197      "//base/hiviewdfx/hilog_lite/interfaces/native/innerkits",
198      "common",
199    ]
200    sources = [
201      "./common/liteos/usb_device_serial_func_test.cpp",
202      "//drivers/peripheral/usb/sample/device/liteos/lib/src/lib_acm_test.c",
203    ]
204    deps = [
205      "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared",
206      "//drivers/adapter/uhdf/manager:hdf_core",
207      "//drivers/adapter/uhdf/posix:hdf_posix_osal",
208      "//utils/native/lite:utils",
209    ]
210  }
211
212  group("hdf_peripheral_usb_test_module") {
213    deps = [
214      ":usb_device_serial_func_test",
215      ":usb_device_serial_loopback",
216      ":usb_host_raw_api_func_test",
217      ":usb_host_serial_func_test",
218      ":usb_host_serial_loopback",
219    ]
220  }
221} else {
222  module_output_path = "hdf/usb"
223  ohos_moduletest("usb_device_serial_func_test") {
224    module_out_path = module_output_path
225    include_dirs = [
226      "//third_party/googletest/googletest/include",
227      "$hdf_framework_path/include/config",
228      "$hdf_framework_path/ability/config/hcs_parser/include",
229      "$hdf_framework_path/include/utils",
230      "$hdf_framework_path/utils/include",
231      "common",
232    ]
233    sources = [
234      "./common/usb_device_serial_func_test.cpp",
235      "./common/usb_utils.cpp",
236    ]
237    deps = [
238      "$hdf_uhdf_path/config:uhdf_hcs_pkg",
239      "$hdf_uhdf_path/osal:libhdf_utils",
240      "//utils/native/base:utils",
241    ]
242  }
243
244  ohos_moduletest("usb_device_net_func_test") {
245    module_out_path = module_output_path
246    include_dirs = [
247      "//third_party/googletest/googletest/include",
248      "common",
249    ]
250
251    sources = [
252      "./common/usb_device_net_func_test.cpp",
253      "./common/usb_utils.cpp",
254    ]
255    deps = []
256  }
257
258  ohos_moduletest("usb_device_compose_func_test") {
259    module_out_path = module_output_path
260    include_dirs = [
261      "//third_party/googletest/googletest/include",
262      "common",
263    ]
264
265    sources = [
266      "./common/usb_device_compose_func_test.cpp",
267      "./common/usb_utils.cpp",
268    ]
269    deps = []
270  }
271
272  ohos_moduletest("usb_device_performance_test") {
273    module_out_path = module_output_path
274    include_dirs = [
275      "//third_party/googletest/googletest/include",
276      "common",
277    ]
278    sources = [
279      "./common/usb_device_performance_test.cpp",
280      "./common/usb_utils.cpp",
281    ]
282    deps = []
283  }
284
285  ohos_moduletest("usb_host_serial_func_test") {
286    module_out_path = module_output_path
287    include_dirs = [
288      "//third_party/googletest/googletest/include",
289      "$hdf_framework_path/include/config",
290      "$hdf_framework_path/ability/config/hcs_parser/include",
291      "$hdf_framework_path/include/utils",
292      "$hdf_framework_path/utils/include",
293      "common",
294    ]
295    sources = [
296      "./common/usb_host_serial_func_test.cpp",
297      "./common/usb_utils.cpp",
298    ]
299    deps = [
300      "$hdf_uhdf_path/config:uhdf_hcs_pkg",
301      "$hdf_uhdf_path/osal:libhdf_utils",
302      "//utils/native/base:utils",
303    ]
304  }
305
306  ohos_moduletest("usb_host_raw_api_func_test") {
307    module_out_path = module_output_path
308    include_dirs = [
309      "//third_party/googletest/googletest/include",
310      "$hdf_framework_path/include/config",
311      "$hdf_framework_path/ability/config/hcs_parser/include",
312      "$hdf_framework_path/include/utils",
313      "$hdf_framework_path/utils/include",
314      "common",
315    ]
316    sources = [
317      "./common/usb_host_raw_api_func_test.cpp",
318      "./common/usb_utils.cpp",
319    ]
320    deps = [
321      "$hdf_uhdf_path/config:uhdf_hcs_pkg",
322      "$hdf_uhdf_path/osal:libhdf_utils",
323      "//utils/native/base:utils",
324    ]
325  }
326
327  ohos_moduletest("usb_host_net_func_test") {
328    module_out_path = module_output_path
329    include_dirs = [
330      "//third_party/googletest/googletest/include",
331      "common",
332    ]
333
334    sources = [
335      "./common/usb_host_net_func_test.cpp",
336      "./common/usb_utils.cpp",
337    ]
338    deps = []
339  }
340
341  ohos_moduletest("usb_host_compose_func_test") {
342    module_out_path = module_output_path
343    include_dirs = [
344      "//third_party/googletest/googletest/include",
345      "common",
346    ]
347
348    sources = [
349      "./common/usb_host_compose_func_test.cpp",
350      "./common/usb_utils.cpp",
351    ]
352    deps = []
353  }
354
355  ohos_moduletest("usb_host_performance_test") {
356    module_out_path = module_output_path
357    include_dirs = [
358      "//third_party/googletest/googletest/include",
359      "common",
360    ]
361
362    sources = [
363      "./common/usb_host_performance_test.cpp",
364      "./common/usb_utils.cpp",
365    ]
366    deps = []
367  }
368
369  group("hdf_moduletest_usb") {
370    testonly = true
371    deps = [
372      ":usb_device_performance_test",
373      ":usb_device_serial_func_test",
374      ":usb_host_performance_test",
375      ":usb_host_raw_api_func_test",
376      ":usb_host_serial_func_test",
377    ]
378  }
379}
380