• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2021-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
14TEST_ROOT_DIR = "../.."
15HDF_CORE_DIR = "../../../.."
16
17if (defined(ohos_lite)) {
18  import("//build/lite/config/test.gni")
19} else {
20  import("//build/test.gni")
21  import("$HDF_CORE_DIR/hdf_core/adapter/uhdf2/uhdf.gni")
22  import("$TEST_ROOT_DIR/wlan.gni")
23}
24
25configFlag = [
26  "-Wall",
27  "-Wextra",
28  "-Werror",
29  "-fsigned-char",
30  "-fno-common",
31  "-fno-strict-aliasing",
32]
33
34if (defined(ohos_lite)) {
35  unittest("hdf_common_wifi") {
36    output_extension = "bin"
37    output_dir = "$root_out_dir/test/unittest/hdf"
38    include_dirs = [
39      "//third_party/bounds_checking_function/include",
40      "$HDF_CORE_DIR/hdf_core/framework/include/platform",
41      "$HDF_CORE_DIR/hdf_core/framework/include/core",
42      "$HDF_CORE_DIR/hdf_core/framework/include",
43      "$HDF_CORE_DIR/hdf_core/framework/test/unittest/include",
44    ]
45
46    sources = [
47      "common/hdf_flow_control_test.cpp",
48      "common/hdf_message_test.cpp",
49      "common/hdf_module_test.cpp",
50      "common/hdf_net_buff_test.cpp",
51      "common/hdf_net_device_test.cpp",
52    ]
53    public_deps = [
54      "$HDF_CORE_DIR/hdf_core/adapter/build/test_common:libhdf_test_common",
55      "$HDF_CORE_DIR/hdf_core/adapter/uhdf/manager:hdf_core",
56      "$HDF_CORE_DIR/hdf_core/adapter/uhdf/platform:hdf_platform",
57      "//third_party/bounds_checking_function:libsec_shared",
58    ]
59    external_deps = [ "hilog_lite:hilog_shared" ]
60
61    cflags = configFlag
62  }
63
64  unittest("hdf_hal_wifi") {
65    output_extension = "bin"
66    output_dir = "$root_out_dir/test/unittest/hdf"
67    include_dirs = [
68      "//third_party/bounds_checking_function/include",
69      "$TEST_ROOT_DIR/client/include",
70      "$TEST_ROOT_DIR/hal/include",
71      "$TEST_ROOT_DIR/interfaces/include",
72    ]
73
74    sources = [ "hal/wifi_hal_test.cpp" ]
75    public_deps = [
76      "$TEST_ROOT_DIR/client:wifi_driver_client",
77      "$TEST_ROOT_DIR/hal:wifi_hal",
78      "//third_party/bounds_checking_function:libsec_shared",
79    ]
80    external_deps = [ "hdf_core:hdf_posix_osal" ]
81
82    cflags = configFlag
83  }
84
85  unittest("hdf_client_wifi") {
86    output_extension = "bin"
87    output_dir = "$root_out_dir/test/unittest/hdf"
88    include_dirs = [
89      "//third_party/bounds_checking_function/include",
90      "$TEST_ROOT_DIR/client/include",
91      "$TEST_ROOT_DIR/hal/include",
92      "$TEST_ROOT_DIR/interfaces/include",
93    ]
94
95    sources = [ "client/hdf_client_test.cpp" ]
96    public_deps = [
97      "$TEST_ROOT_DIR/client:wifi_driver_client",
98      "//third_party/bounds_checking_function:libsec_shared",
99    ]
100    external_deps = [ "hdf_core:hdf_posix_osal" ]
101
102    cflags = configFlag
103  }
104} else {
105  module_output_path = "drivers_peripheral_wlan/wlan"
106  ohos_unittest("hdf_common_wifi") {
107    module_out_path = module_output_path
108    include_dirs = [
109      "$TEST_ROOT_DIR/client/include",
110      "$TEST_ROOT_DIR/hal/include",
111      "$TEST_ROOT_DIR/interfaces/include",
112    ]
113    sources = [
114      "./common/hdf_flow_control_test.cpp",
115      "./common/hdf_message_test.cpp",
116      "./common/hdf_module_test.cpp",
117      "./common/hdf_net_buff_test.cpp",
118      "./common/hdf_net_device_test.cpp",
119    ]
120    resource_config_file =
121        "$HDF_CORE_DIR/hdf_core/adapter/uhdf2/test/resource/wlan/ohos_test.xml"
122
123    cflags = configFlag
124    deps = [
125      "$HDF_CORE_DIR/hdf_core/adapter/build/test_common:libhdf_test_common",
126    ]
127    if (is_standard_system) {
128      external_deps = [
129        "c_utils:utils",
130        "hdf_core:libhdf_host",
131        "hdf_core:libhdf_utils",
132        "hilog:libhilog",
133      ]
134    } else {
135      external_deps = [ "hilog:libhilog" ]
136    }
137  }
138
139  ohos_unittest("hdf_hal_wifi") {
140    module_out_path = module_output_path
141    include_dirs = [
142      "$TEST_ROOT_DIR/client/include",
143      "$TEST_ROOT_DIR/hal/include",
144      "$TEST_ROOT_DIR/interfaces/include",
145    ]
146    sources = [ "./hal/wifi_hal_test.cpp" ]
147    resource_config_file =
148        "$HDF_CORE_DIR/hdf_core/adapter/uhdf2/test/resource/wlan/ohos_test.xml"
149
150    cflags = configFlag
151    deps = [
152      "$TEST_ROOT_DIR/client:wifi_driver_client",
153      "$TEST_ROOT_DIR/hal:wifi_hal",
154    ]
155    if (is_standard_system) {
156      external_deps = [
157        "c_utils:utils",
158        "hdf_core:libhdf_utils",
159        "hilog:libhilog",
160      ]
161    } else {
162      external_deps = [ "hilog:libhilog" ]
163    }
164  }
165
166  ohos_unittest("hdf_client_wifi") {
167    CLIENT_ROOT_DIR = "./.."
168    module_out_path = module_output_path
169    include_dirs = [
170      "$TEST_ROOT_DIR/client/include",
171      "$TEST_ROOT_DIR/hostapd/client/include",
172      "$TEST_ROOT_DIR/hal/include",
173      "$TEST_ROOT_DIR/interfaces/include",
174      "$TEST_ROOT_DIR/wpa/client/include",
175      "$CLIENT_ROOT_DIR/interfaces/include",
176      "$root_out_dir/include",
177      "$root_out_dir/lib",
178    ]
179    defines = [ "OHOS_ARCH_LITE" ]
180    sources = [
181      "$TEST_ROOT_DIR/client/src/sbuf/sbuf_common_adapter.c",
182      "$TEST_ROOT_DIR/client/src/sbuf/sbuf_wpa_cmd_adapter.c",
183      "$TEST_ROOT_DIR/client/src/wifi_driver_client.c",
184      "$TEST_ROOT_DIR/hostapd/client/src/hostapd_client.c",
185      "$TEST_ROOT_DIR/test/unittest/client/hdf_client_test.cpp",
186      "$TEST_ROOT_DIR/wpa/client/src/wpa_client.c",
187    ]
188    if (drivers_peripheral_wlan_feature_enable_HDF_NL80211) {
189      sources += [ "$TEST_ROOT_DIR/client/src/sbuf/sbuf_cmd_adapter.c" ]
190    } else {
191      sources += [
192        "$TEST_ROOT_DIR/client/src/netlink/netlink_cmd_adapter.c",
193        "$TEST_ROOT_DIR/client/src/netlink/netlink_event_adapter.c",
194      ]
195    }
196
197    resource_config_file =
198        "$HDF_CORE_DIR/hdf_core/adapter/uhdf2/test/resource/wlan/ohos_test.xml"
199
200    cflags = configFlag
201    deps = [
202      "$TEST_ROOT_DIR/client:wifi_driver_client",
203      "$TEST_ROOT_DIR/hostapd/client:hostapd_hdi_client",
204      "$TEST_ROOT_DIR/wpa/client:wpa_hdi_client",
205    ]
206    if (is_standard_system) {
207      external_deps = [
208        "c_utils:utils",
209        "hdf_core:libhdf_utils",
210        "hilog:libhilog",
211        "init:libbegetutil",
212        "libnl:libnl_share",
213      ]
214    } else {
215      external_deps = [ "hilog:libhilog" ]
216    }
217  }
218
219  ohos_unittest("hdf_chip_wifi") {
220    module_out_path = module_output_path
221    include_dirs = [ "$TEST_ROOT_DIR/chip/hdi_service" ]
222    sources = [
223      "$TEST_ROOT_DIR/chip/hdi_service/hdi_sync_util.cpp",
224      "$TEST_ROOT_DIR/chip/hdi_service/iface_tool.cpp",
225      "$TEST_ROOT_DIR/chip/hdi_service/iface_util.cpp",
226      "$TEST_ROOT_DIR/chip/hdi_service/wifi.cpp",
227      "$TEST_ROOT_DIR/chip/hdi_service/wifi_ap_iface.cpp",
228      "$TEST_ROOT_DIR/chip/hdi_service/wifi_chip.cpp",
229      "$TEST_ROOT_DIR/chip/hdi_service/wifi_chip_modes.cpp",
230      "$TEST_ROOT_DIR/chip/hdi_service/wifi_ext_iface.cpp",
231      "$TEST_ROOT_DIR/chip/hdi_service/wifi_p2p_iface.cpp",
232      "$TEST_ROOT_DIR/chip/hdi_service/wifi_sta_iface.cpp",
233      "$TEST_ROOT_DIR/chip/hdi_service/wifi_vendor_hal.cpp",
234      "$TEST_ROOT_DIR/chip/hdi_service/wifi_vendor_hal_list.cpp",
235      "$TEST_ROOT_DIR/chip/hdi_service/wifi_vendor_hal_stubs.cpp",
236      "chip/interface_tool_test.cpp",
237      "chip/wifi_ap_iface_test.cpp",
238      "chip/wifi_chip_modes_test.cpp",
239      "chip/wifi_chip_test.cpp",
240      "chip/wifi_hal_fn.cpp",
241      "chip/wifi_p2p_iface_test.cpp",
242      "chip/wifi_sta_iface_test.cpp",
243      "chip/wifi_test.cpp",
244      "chip/wifi_vendor_hal_list_test.cpp",
245      "chip/wifi_vendor_hal_test.cpp",
246    ]
247
248    cflags = configFlag
249    deps = [ "$TEST_ROOT_DIR/chip/hdi_service:libchip_controller_chip_interface_service_1.0" ]
250
251    defines = [
252      "private = public",
253      "protected = public",
254      "P2P_NAME=\"$drivers_peripheral_wlan_p2p_name\"",
255      "HAL_SO_NAME=\"$drivers_peripheral_wlan_feature_vendor\"",
256    ]
257
258    if (is_standard_system) {
259      external_deps = [
260        "c_utils:utils",
261        "drivers_interface_wlan:chip_idl_headers",
262        "hdf_core:libhdf_host",
263        "hdf_core:libhdf_utils",
264        "hilog:libhilog",
265        "init:libbegetutil",
266        "ipc:ipc_single",
267      ]
268    } else {
269      external_deps = [ "hilog:libhilog" ]
270    }
271  }
272}
273