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} 23 24configFlag = [ 25 "-Wall", 26 "-Wextra", 27 "-Werror", 28 "-fsigned-char", 29 "-fno-common", 30 "-fno-strict-aliasing", 31] 32 33if (defined(ohos_lite)) { 34 unittest("hdf_common_wifi") { 35 output_extension = "bin" 36 output_dir = "$root_out_dir/test/unittest/hdf" 37 include_dirs = [ 38 "//third_party/bounds_checking_function/include", 39 "$HDF_CORE_DIR/hdf_core/framework/include/platform", 40 "$HDF_CORE_DIR/hdf_core/framework/include/core", 41 "$HDF_CORE_DIR/hdf_core/framework/include", 42 "$HDF_CORE_DIR/hdf_core/framework/test/unittest/include", 43 ] 44 45 sources = [ 46 "common/hdf_flow_control_test.cpp", 47 "common/hdf_message_test.cpp", 48 "common/hdf_module_test.cpp", 49 "common/hdf_net_buff_test.cpp", 50 "common/hdf_net_device_test.cpp", 51 ] 52 public_deps = [ 53 "$HDF_CORE_DIR/hdf_core/adapter/build/test_common:libhdf_test_common", 54 "$HDF_CORE_DIR/hdf_core/adapter/uhdf/manager:hdf_core", 55 "$HDF_CORE_DIR/hdf_core/adapter/uhdf/platform:hdf_platform", 56 "//third_party/bounds_checking_function:libsec_shared", 57 ] 58 external_deps = [ "hilog_lite:hilog_shared" ] 59 60 cflags = configFlag 61 } 62 63 unittest("hdf_hal_wifi") { 64 output_extension = "bin" 65 output_dir = "$root_out_dir/test/unittest/hdf" 66 include_dirs = [ 67 "//third_party/bounds_checking_function/include", 68 "$TEST_ROOT_DIR/client/include", 69 "$TEST_ROOT_DIR/hal/include", 70 "$TEST_ROOT_DIR/interfaces/include", 71 ] 72 73 sources = [ "hal/wifi_hal_test.cpp" ] 74 public_deps = [ 75 "$TEST_ROOT_DIR/client:wifi_driver_client", 76 "$TEST_ROOT_DIR/hal:wifi_hal", 77 "//third_party/bounds_checking_function:libsec_shared", 78 ] 79 external_deps = [ "hdf_core:hdf_posix_osal" ] 80 81 cflags = configFlag 82 } 83 84 unittest("hdf_client_wifi") { 85 output_extension = "bin" 86 output_dir = "$root_out_dir/test/unittest/hdf" 87 include_dirs = [ 88 "//third_party/bounds_checking_function/include", 89 "$TEST_ROOT_DIR/client/include", 90 "$TEST_ROOT_DIR/hal/include", 91 "$TEST_ROOT_DIR/interfaces/include", 92 ] 93 94 sources = [ "client/hdf_client_test.cpp" ] 95 public_deps = [ 96 "$TEST_ROOT_DIR/client:wifi_driver_client", 97 "//third_party/bounds_checking_function:libsec_shared", 98 ] 99 external_deps = [ "hdf_core:hdf_posix_osal" ] 100 101 cflags = configFlag 102 } 103} else { 104 module_output_path = "drivers_peripheral_wlan/wlan" 105 ohos_unittest("hdf_common_wifi") { 106 module_out_path = module_output_path 107 include_dirs = [ 108 "$TEST_ROOT_DIR/client/include", 109 "$TEST_ROOT_DIR/hal/include", 110 "$TEST_ROOT_DIR/interfaces/include", 111 ] 112 sources = [ 113 "./common/hdf_flow_control_test.cpp", 114 "./common/hdf_message_test.cpp", 115 "./common/hdf_module_test.cpp", 116 "./common/hdf_net_buff_test.cpp", 117 "./common/hdf_net_device_test.cpp", 118 ] 119 resource_config_file = 120 "$HDF_CORE_DIR/hdf_core/adapter/uhdf2/test/resource/wlan/ohos_test.xml" 121 122 cflags = configFlag 123 deps = [ 124 "$HDF_CORE_DIR/hdf_core/adapter/build/test_common:libhdf_test_common", 125 ] 126 if (is_standard_system) { 127 external_deps = [ 128 "c_utils:utils", 129 "hdf_core:libhdf_host", 130 "hdf_core:libhdf_utils", 131 "hilog:libhilog", 132 ] 133 } else { 134 external_deps = [ "hilog:libhilog" ] 135 } 136 } 137 138 ohos_unittest("hdf_hal_wifi") { 139 module_out_path = module_output_path 140 include_dirs = [ 141 "$TEST_ROOT_DIR/client/include", 142 "$TEST_ROOT_DIR/hal/include", 143 "$TEST_ROOT_DIR/interfaces/include", 144 ] 145 sources = [ "./hal/wifi_hal_test.cpp" ] 146 resource_config_file = 147 "$HDF_CORE_DIR/hdf_core/adapter/uhdf2/test/resource/wlan/ohos_test.xml" 148 149 cflags = configFlag 150 deps = [ 151 "$TEST_ROOT_DIR/client:wifi_driver_client", 152 "$TEST_ROOT_DIR/hal:wifi_hal", 153 ] 154 if (is_standard_system) { 155 external_deps = [ 156 "c_utils:utils", 157 "hdf_core:libhdf_utils", 158 "hilog:libhilog", 159 ] 160 } else { 161 external_deps = [ "hilog:libhilog" ] 162 } 163 } 164 165 ohos_unittest("hdf_client_wifi") { 166 module_out_path = module_output_path 167 include_dirs = [ 168 "$TEST_ROOT_DIR/client/include", 169 "$TEST_ROOT_DIR/hostapd/client/include", 170 "$TEST_ROOT_DIR/hal/include", 171 "$TEST_ROOT_DIR/interfaces/include", 172 "$TEST_ROOT_DIR/wpa/client/include", 173 ] 174 defines = [ "OHOS_ARCH_LITE" ] 175 sources = [ 176 "$TEST_ROOT_DIR/client/src/sbuf/sbuf_wpa_cmd_adapter.c", 177 "$TEST_ROOT_DIR/hostapd/client/src/hostapd_client.c", 178 "$TEST_ROOT_DIR/test/unittest/client/hdf_client_test.cpp", 179 "$TEST_ROOT_DIR/wpa/client/src/wpa_client.c", 180 ] 181 182 resource_config_file = 183 "$HDF_CORE_DIR/hdf_core/adapter/uhdf2/test/resource/wlan/ohos_test.xml" 184 185 cflags = configFlag 186 deps = [ 187 "$TEST_ROOT_DIR/client:wifi_driver_client", 188 "$TEST_ROOT_DIR/hostapd/client:hostapd_hdi_client", 189 "$TEST_ROOT_DIR/wpa/client:wpa_hdi_client", 190 ] 191 if (is_standard_system) { 192 external_deps = [ 193 "c_utils:utils", 194 "hdf_core:libhdf_utils", 195 "hilog:libhilog", 196 ] 197 } else { 198 external_deps = [ "hilog:libhilog" ] 199 } 200 } 201 202 ohos_unittest("hdf_chip_wifi") { 203 module_out_path = module_output_path 204 include_dirs = [ "$TEST_ROOT_DIR/chip/hdi_service" ] 205 sources = [ 206 "chip/interface_tool_test.cpp", 207 "chip/wifi_ap_iface_test.cpp", 208 "chip/wifi_chip_modes_test.cpp", 209 "chip/wifi_chip_test.cpp", 210 "chip/wifi_hal_fn.cpp", 211 "chip/wifi_p2p_iface_test.cpp", 212 "chip/wifi_sta_iface_test.cpp", 213 "chip/wifi_test.cpp", 214 "chip/wifi_vendor_hal_list_test.cpp", 215 "chip/wifi_vendor_hal_test.cpp", 216 ] 217 218 cflags = configFlag 219 deps = [ "$TEST_ROOT_DIR/chip/hdi_service:libchip_controller_chip_interface_service_1.0" ] 220 if (is_standard_system) { 221 external_deps = [ 222 "c_utils:utils", 223 "drivers_interface_wlan:chip_idl_headers", 224 "hdf_core:libhdf_host", 225 "hdf_core:libhdf_utils", 226 "hilog:libhilog", 227 "init:libbegetutil", 228 "ipc:ipc_single", 229 ] 230 } else { 231 external_deps = [ "hilog:libhilog" ] 232 } 233 } 234} 235