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_featured_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/hal/include", 170 "$TEST_ROOT_DIR/interfaces/include", 171 ] 172 sources = [ "./client/hdf_client_test.cpp" ] 173 resource_config_file = 174 "$HDF_CORE_DIR/hdf_core/adapter/uhdf2/test/resource/wlan/ohos_test.xml" 175 176 cflags = configFlag 177 deps = [ "$TEST_ROOT_DIR/client:wifi_driver_client" ] 178 if (is_standard_system) { 179 external_deps = [ 180 "c_utils:utils", 181 "hdf_core:libhdf_utils", 182 "hilog:libhilog", 183 ] 184 } else { 185 external_deps = [ "hilog:libhilog" ] 186 } 187 } 188} 189