1# Copyright (c) 2020-2023 Huawei Device Co., Ltd. All rights reserved. 2# 3# Redistribution and use in source and binary forms, with or without modification, 4# are permitted provided that the following conditions are met: 5# 6# 1. Redistributions of source code must retain the above copyright notice, this list of 7# conditions and the following disclaimer. 8# 9# 2. Redistributions in binary form must reproduce the above copyright notice, this list 10# of conditions and the following disclaimer in the documentation and/or other materials 11# provided with the distribution. 12# 13# 3. Neither the name of the copyright holder nor the names of its contributors may be used 14# to endorse or promote products derived from this software without specific prior written 15# permission. 16# 17# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 19# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 20# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 21# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 22# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 23# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 24# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 25# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 26# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 27# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 29import("./../hdf.gni") 30 31HDF_FRAMEWORKS_PATH = "./../../../../framework" 32HDF_PERIPHERAL_PATH = "./../../../../../peripheral" 33HDF_ADAPTERS_PATH = "./../../../../adapter" 34 35HDF_TEST_FRAMWORK_ROOT = "$HDF_FRAMEWORKS_PATH/test/unittest" 36INTERFACES_INNER_ROOT = "../../../../interfaces/inner_api" 37 38module_switch = defined(LOSCFG_DRIVERS_HDF_TEST) 39module_name = "hdf_test" 40hdf_driver(module_name) { 41 sources = [ 42 "$HDF_TEST_FRAMWORK_ROOT/common/hdf_main_test.c", 43 "$HDF_TEST_FRAMWORK_ROOT/manager/sample_driver_test.c", 44 "$HDF_TEST_FRAMWORK_ROOT/osal/osal_all_test.c", 45 "$HDF_TEST_FRAMWORK_ROOT/osal/osal_file_test.c", 46 "$HDF_TEST_FRAMWORK_ROOT/osal/osal_get_case_test.c", 47 "$HDF_TEST_FRAMWORK_ROOT/osal/osal_list_test.c", 48 "$HDF_TEST_FRAMWORK_ROOT/osal/osal_test_entry.c", 49 "$HDF_TEST_FRAMWORK_ROOT/osal/osal_work_test.c", 50 "$HDF_TEST_FRAMWORK_ROOT/pm/hdf_pm_driver_test.c", 51 "$HDF_TEST_FRAMWORK_ROOT/utils/hcs_parser/unittest/hcs_config_test.c", 52 "$HDF_TEST_FRAMWORK_ROOT/utils/hcs_parser/unittest/hcs_parser_test.c", 53 ] 54 55 if (defined(LOSCFG_DRIVERS_HDF_WIFI)) { 56 sources += [ 57 "$HDF_TEST_FRAMWORK_ROOT/model/network/wifi/unittest/message/hdf_queue_test.c", 58 "$HDF_TEST_FRAMWORK_ROOT/model/network/wifi/unittest/message/hdf_single_node_message_test.c", 59 "$HDF_TEST_FRAMWORK_ROOT/model/network/wifi/unittest/module/hdf_module_test.c", 60 "$HDF_TEST_FRAMWORK_ROOT/model/network/wifi/unittest/net/hdf_netbuf_test.c", 61 "$HDF_TEST_FRAMWORK_ROOT/model/network/wifi/unittest/netdevice/net_device_test.c", 62 "$HDF_TEST_FRAMWORK_ROOT/model/network/wifi/unittest/qos/flow_control_test.c", 63 "$HDF_TEST_FRAMWORK_ROOT/wifi/hdf_wifi_test.c", 64 ] 65 } 66 67 if (defined(LOSCFG_DRIVERS_HDF_USB_DDK_DEVICE)) { 68 sources += [ 69 "$HDF_TEST_FRAMWORK_ROOT/model/usb/device/src/hdf_usb_device_test.c", 70 "$HDF_TEST_FRAMWORK_ROOT/model/usb/device/src/usb_device_lite_cdcacm_test.c", 71 "$HDF_TEST_FRAMWORK_ROOT/model/usb/device/src/usb_device_lite_sdk_if_test.c", 72 "$HDF_TEST_FRAMWORK_ROOT/model/usb/device/src/usb_device_lite_sdk_io_test.c", 73 ] 74 } 75 76 if (defined(LOSCFG_DRIVERS_HDF_USB_DDK_HOST) && 77 defined(LOSCFG_DRIVERS_HDF_USB_PNP_NOTIFY)) { 78 sources += [ 79 "$HDF_TEST_FRAMWORK_ROOT/model/usb/host/src/hdf_usb_entry_test.c", 80 "$HDF_TEST_FRAMWORK_ROOT/model/usb/host/src/usb_raw_io.c", 81 "$HDF_TEST_FRAMWORK_ROOT/model/usb/host/src/usb_raw_test.c", 82 "$HDF_TEST_FRAMWORK_ROOT/model/usb/host/src/usb_test.c", 83 ] 84 } 85 86 if (defined(LOSCFG_DRIVERS_HDF_PLATFORM)) { 87 sources += [ 88 "$HDF_TEST_FRAMWORK_ROOT/platform/common/platform_device_test.c", 89 "$HDF_TEST_FRAMWORK_ROOT/platform/common/platform_driver_test.c", 90 "$HDF_TEST_FRAMWORK_ROOT/platform/common/platform_event_test.c", 91 "$HDF_TEST_FRAMWORK_ROOT/platform/common/platform_manager_test.c", 92 "$HDF_TEST_FRAMWORK_ROOT/platform/common/platform_queue_test.c", 93 "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_platform_entry_test.c", 94 ] 95 96 if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_TRACE)) { 97 sources += 98 [ "$HDF_TEST_FRAMWORK_ROOT/platform/common/platform_trace_test.c" ] 99 } 100 101 if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_DUMPER)) { 102 sources += 103 [ "$HDF_TEST_FRAMWORK_ROOT/platform/common/platform_dumper_test.c" ] 104 } 105 106 if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_GPIO)) { 107 sources += [ 108 "$HDF_TEST_FRAMWORK_ROOT/platform/common/gpio_driver_test.c", 109 "$HDF_TEST_FRAMWORK_ROOT/platform/common/gpio_test.c", 110 "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_gpio_entry_test.c", 111 ] 112 } 113 114 if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_PIN)) { 115 sources += [ 116 "$HDF_TEST_FRAMWORK_ROOT/platform/common/pin_driver_test.c", 117 "$HDF_TEST_FRAMWORK_ROOT/platform/common/pin_test.c", 118 "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_pin_entry_test.c", 119 "$HDF_TEST_FRAMWORK_ROOT/platform/virtual/pin_virtual.c", 120 ] 121 } 122 123 if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_I2C)) { 124 sources += [ 125 "$HDF_TEST_FRAMWORK_ROOT/platform/common/i2c_driver_test.c", 126 "$HDF_TEST_FRAMWORK_ROOT/platform/common/i2c_test.c", 127 "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_i2c_entry_test.c", 128 "$HDF_TEST_FRAMWORK_ROOT/platform/virtual/mini/i2c_mini_virtual.c", 129 ] 130 } 131 132 if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_ADC)) { 133 sources += [ 134 "$HDF_TEST_FRAMWORK_ROOT/platform/common/adc_driver_test.c", 135 "$HDF_TEST_FRAMWORK_ROOT/platform/common/adc_test.c", 136 "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_adc_entry_test.c", 137 "$HDF_TEST_FRAMWORK_ROOT/platform/virtual/adc_virtual.c", 138 ] 139 } 140 141 if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_DAC)) { 142 sources += [ 143 "$HDF_TEST_FRAMWORK_ROOT/platform/common/dac_driver_test.c", 144 "$HDF_TEST_FRAMWORK_ROOT/platform/common/dac_test.c", 145 "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_dac_entry_test.c", 146 "$HDF_TEST_FRAMWORK_ROOT/platform/virtual/dac_virtual.c", 147 ] 148 } 149 150 if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_I3C)) { 151 sources += [ 152 "$HDF_TEST_FRAMWORK_ROOT/platform/common/i3c_driver_test.c", 153 "$HDF_TEST_FRAMWORK_ROOT/platform/common/i3c_test.c", 154 "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_i3c_entry_test.c", 155 "$HDF_TEST_FRAMWORK_ROOT/platform/virtual/i3c_virtual.c", 156 ] 157 } 158 159 if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_WATCHDOG)) { 160 sources += [ 161 "$HDF_TEST_FRAMWORK_ROOT/platform/common/watchdog_driver_test.c", 162 "$HDF_TEST_FRAMWORK_ROOT/platform/common/watchdog_test.c", 163 "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_watchdog_entry_test.c", 164 "$HDF_TEST_FRAMWORK_ROOT/platform/virtual/mini/watchdog_mini_virtual.c", 165 "$HDF_TEST_FRAMWORK_ROOT/platform/virtual/watchdog_virtual.c", 166 ] 167 } 168 169 if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_SPI)) { 170 sources += [ 171 "$HDF_TEST_FRAMWORK_ROOT/platform/common/spi_driver_test.c", 172 "$HDF_TEST_FRAMWORK_ROOT/platform/common/spi_test.c", 173 "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_spi_entry_test.c", 174 "$HDF_TEST_FRAMWORK_ROOT/platform/virtual/spi_virtual.c", 175 ] 176 } 177 178 if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_UART)) { 179 sources += [ 180 "$HDF_TEST_FRAMWORK_ROOT/platform/common/uart_driver_test.c", 181 "$HDF_TEST_FRAMWORK_ROOT/platform/common/uart_test.c", 182 "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_uart_entry_test.c", 183 "$HDF_TEST_FRAMWORK_ROOT/platform/virtual/mini/uart_mini_virtual.c", 184 ] 185 } 186 187 if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_I2S)) { 188 sources += [ 189 "$HDF_TEST_FRAMWORK_ROOT/platform/common/i2s_test.c", 190 "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_i2s_entry_test.c", 191 ] 192 } 193 if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_REGULATOR)) { 194 sources += [ 195 "$HDF_TEST_FRAMWORK_ROOT/platform/common/regulator_test.c", 196 "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_regulator_entry_test.c", 197 "$HDF_TEST_FRAMWORK_ROOT/platform/virtual/regulator_virtual.c", 198 ] 199 } 200 201 if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_RTC)) { 202 sources += [ 203 "$HDF_TEST_FRAMWORK_ROOT/platform/common/rtc_driver_test.c", 204 "$HDF_TEST_FRAMWORK_ROOT/platform/common/rtc_test.c", 205 "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_rtc_entry_test.c", 206 "$HDF_TEST_FRAMWORK_ROOT/platform/virtual/mini/rtc_mini_virtual.c", 207 ] 208 } 209 210 if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_SDIO)) { 211 sources += [ 212 "$HDF_TEST_FRAMWORK_ROOT/platform/common/sdio_test.c", 213 "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_sdio_entry_test.c", 214 ] 215 } 216 217 if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_MIPI_DSI)) { 218 sources += [ 219 "$HDF_TEST_FRAMWORK_ROOT/platform/common/mipi_dsi_test.c", 220 "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_mipi_dsi_entry_test.c", 221 ] 222 } 223 224 if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_MIPI_CSI)) { 225 sources += [ 226 "$HDF_TEST_FRAMWORK_ROOT/platform/common/mipi_csi_test.c", 227 "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_mipi_csi_entry_test.c", 228 ] 229 } 230 231 if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_EMMC)) { 232 sources += [ 233 "$HDF_TEST_FRAMWORK_ROOT/platform/common/emmc_test.c", 234 "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_emmc_entry_test.c", 235 ] 236 } 237 238 if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_HDMI)) { 239 sources += [ 240 "$HDF_TEST_FRAMWORK_ROOT/platform/common/hdmi_test.c", 241 "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_hdmi_entry_test.c", 242 ] 243 } 244 245 if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_PCIE)) { 246 sources += [ 247 "$HDF_TEST_FRAMWORK_ROOT/platform/common/pcie_driver_test.c", 248 "$HDF_TEST_FRAMWORK_ROOT/platform/common/pcie_test.c", 249 "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_pcie_entry_test.c", 250 "$HDF_TEST_FRAMWORK_ROOT/platform/virtual/pcie_virtual.c", 251 ] 252 } 253 if (defined(LOSCFG_DRIVERS_HDF_WLAN_PCIE)) { 254 sources += [ 255 "$HDF_TEST_FRAMWORK_ROOT/platform/common/pcie_bus_driver_test.c", 256 "$HDF_TEST_FRAMWORK_ROOT/platform/common/pcie_bus_test.c", 257 "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_pcie_bus_entry_test.c", 258 ] 259 } 260 261 if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_PWM)) { 262 sources += [ 263 "$HDF_TEST_FRAMWORK_ROOT/platform/common/pwm_driver_test.c", 264 "$HDF_TEST_FRAMWORK_ROOT/platform/common/pwm_test.c", 265 "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_pwm_entry_test.c", 266 "$HDF_TEST_FRAMWORK_ROOT/platform/virtual/pwm_virtual.c", 267 ] 268 } 269 270 if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_TIMER)) { 271 sources += [ 272 "$HDF_TEST_FRAMWORK_ROOT/platform/common/timer_driver_test.c", 273 "$HDF_TEST_FRAMWORK_ROOT/platform/common/timer_test.c", 274 "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_timer_entry_test.c", 275 ] 276 } 277 278 if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_CAN)) { 279 sources += [ 280 "$HDF_ADAPTERS_PATH/platform/can/can_virtual.c", 281 "$HDF_TEST_FRAMWORK_ROOT/platform/common/can_test.c", 282 "$HDF_TEST_FRAMWORK_ROOT/platform/config/can_test_config.c", 283 ] 284 } 285 } 286 287 if (defined(LOSCFG_DRIVERS_HDF_SENSOR)) { 288 sources += [ "$HDF_TEST_FRAMWORK_ROOT/sensor/hdf_sensor_test.c" ] 289 } 290 291 configs += [ ":test_lite" ] 292} 293 294config("test_lite") { 295 include_dirs = [ 296 "$HDF_FRAMEWORKS_PATH/include", 297 "$HDF_FRAMEWORKS_PATH/include/osal", 298 "$HDF_FRAMEWORKS_PATH/include/utils", 299 "$HDF_FRAMEWORKS_PATH/utils/include", 300 "$HDF_FRAMEWORKS_PATH/include/platform", 301 "$HDF_FRAMEWORKS_PATH/include/core", 302 "$INTERFACES_INNER_ROOT/core", 303 "$INTERFACES_INNER_ROOT/utils", 304 "$INTERFACES_INNER_ROOT/osal/shared", 305 "$HDF_FRAMEWORKS_PATH/support/platform/include", 306 "$HDF_FRAMEWORKS_PATH/core/host/include", 307 "$HDF_FRAMEWORKS_PATH/core/master/include", 308 "$HDF_FRAMEWORKS_PATH/core/shared/include", 309 "$HDF_FRAMEWORKS_PATH/core/manager/include", 310 "$HDF_FRAMEWORKS_PATH/core/common/include/host", 311 "../osal/include", 312 "osal/include", 313 "$HDF_FRAMEWORKS_PATH/core/adapter/vnode/include", 314 "$HDF_FRAMEWORKS_PATH/core/adapter/syscall/include", 315 "../network/include", 316 "$HDF_TEST_FRAMWORK_ROOT/common", 317 "$HDF_TEST_FRAMWORK_ROOT/manager", 318 "$HDF_TEST_FRAMWORK_ROOT/config", 319 "$HDF_TEST_FRAMWORK_ROOT/platform", 320 "$HDF_TEST_FRAMWORK_ROOT/platform/common", 321 "$HDF_TEST_FRAMWORK_ROOT/platform/entry", 322 "$HDF_TEST_FRAMWORK_ROOT/hdfframe", 323 "$HDF_TEST_FRAMWORK_ROOT/osal", 324 "$HDF_TEST_FRAMWORK_ROOT/adapter/osal/unittest", 325 "$HDF_TEST_FRAMWORK_ROOT/adapter/osal/include", 326 "$HDF_TEST_FRAMWORK_ROOT/utils/hcs_parser/unittest", 327 "$HDF_TEST_FRAMWORK_ROOT", 328 "$HDF_FRAMEWORKS_PATH/include/wifi", 329 ] 330 331 if (defined(LOSCFG_DRIVERS_HDF_WIFI)) { 332 include_dirs += [ 333 "$HDF_TEST_FRAMWORK_ROOT/model/network/wifi/unittest/netdevice", 334 "$HDF_TEST_FRAMWORK_ROOT/model/network/wifi/unittest/module", 335 "$HDF_TEST_FRAMWORK_ROOT/model/network/wifi/unittest/net", 336 "$HDF_TEST_FRAMWORK_ROOT/model/network/wifi/unittest/qos", 337 "$HDF_FRAMEWORKS_PATH/model/network/wifi/include", 338 "$HDF_FRAMEWORKS_PATH/model/network/common/netdevice", 339 "$HDF_FRAMEWORKS_PATH/model/network/wifi/platform/src/qos", 340 "$HDF_TEST_FRAMWORK_ROOT/model/network/wifi/unittest/message", 341 "$HDF_FRAMEWORKS_PATH/model/network/wifi/include", 342 "$HDF_FRAMEWORKS_PATH/model/network/wifi/core/module", 343 "$HDF_FRAMEWORKS_PATH/model/network/wifi/platform/include", 344 "$HDF_FRAMEWORKS_PATH/model/network/wifi/platform/include/message", 345 "$HDF_FRAMEWORKS_PATH/model/network/wifi/platform/src", 346 "$HDF_FRAMEWORKS_PATH/model/network/wifi/core/components/softap", 347 "$HDF_FRAMEWORKS_PATH/model/network/wifi/core/components/sta", 348 "$HDF_FRAMEWORKS_PATH/include/wifi", 349 "$HDF_FRAMEWORKS_PATH/include/net", 350 "$HDF_TEST_FRAMWORK_ROOT/wifi", 351 ] 352 } 353 354 if (defined(LOSCFG_DRIVERS_HDF_SENSOR)) { 355 include_dirs += [ 356 "$HDF_TEST_FRAMWORK_ROOT/sensor", 357 "$HDF_PERIPHERAL_PATH/sensor/interfaces/include", 358 "$HDF_PERIPHERAL_PATH/sensor/hal/include", 359 "$HDF_FRAMEWORKS_PATH/model/sensor/driver/include", 360 "$HDF_FRAMEWORKS_PATH/model/sensor/driver/common/include", 361 ] 362 } 363 364 if (defined(LOSCFG_DRIVERS_HDF_USB_DDK_DEVICE)) { 365 include_dirs += [ 366 "$HDF_TEST_FRAMWORK_ROOT/model/usb/device/include", 367 "$HDF_PERIPHERAL_PATH/usb/ddk/common/include", 368 "$HDF_PERIPHERAL_PATH/usb/ddk/device/include", 369 "$HDF_PERIPHERAL_PATH/usb/interfaces/ddk/common", 370 "$HDF_PERIPHERAL_PATH/usb/interfaces/ddk/device", 371 ] 372 } 373 374 if (defined(LOSCFG_DRIVERS_HDF_USB_DDK_HOST)) { 375 include_dirs += [ 376 "$HDF_TEST_FRAMWORK_ROOT/model/usb/host/include", 377 "$HDF_PERIPHERAL_PATH/usb/interfaces/ddk/common", 378 "$HDF_PERIPHERAL_PATH/usb/interfaces/ddk/host", 379 "$HDF_PERIPHERAL_PATH/usb/gadget/function/include", 380 ] 381 } 382} 383