1# Copyright (c) 2020-2022 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("//drivers/hdf_core/adapter/khdf/liteos/hdf.gni") 30 31HDF_TEST_FRAMWORK_ROOT = "$HDF_FRAMEWORKS_PATH/test/unittest" 32 33module_switch = defined(LOSCFG_DRIVERS_HDF_TEST) 34module_name = "hdf_test" 35hdf_driver(module_name) { 36 sources = [ 37 "$HDF_TEST_FRAMWORK_ROOT/common/hdf_main_test.c", 38 "$HDF_TEST_FRAMWORK_ROOT/manager/sample_driver_test.c", 39 "$HDF_TEST_FRAMWORK_ROOT/osal/osal_all_test.c", 40 "$HDF_TEST_FRAMWORK_ROOT/osal/osal_file_test.c", 41 "$HDF_TEST_FRAMWORK_ROOT/osal/osal_get_case_test.c", 42 "$HDF_TEST_FRAMWORK_ROOT/osal/osal_list_test.c", 43 "$HDF_TEST_FRAMWORK_ROOT/osal/osal_test_entry.c", 44 "$HDF_TEST_FRAMWORK_ROOT/osal/osal_work_test.c", 45 "$HDF_TEST_FRAMWORK_ROOT/pm/hdf_pm_driver_test.c", 46 "$HDF_TEST_FRAMWORK_ROOT/utils/hcs_parser/unittest/hcs_config_test.c", 47 "$HDF_TEST_FRAMWORK_ROOT/utils/hcs_parser/unittest/hcs_parser_test.c", 48 ] 49 50 if (defined(LOSCFG_DRIVERS_HDF_WIFI)) { 51 sources += [ 52 "$HDF_TEST_FRAMWORK_ROOT/model/network/wifi/unittest/message/hdf_queue_test.c", 53 "$HDF_TEST_FRAMWORK_ROOT/model/network/wifi/unittest/message/hdf_single_node_message_test.c", 54 "$HDF_TEST_FRAMWORK_ROOT/model/network/wifi/unittest/module/hdf_module_test.c", 55 "$HDF_TEST_FRAMWORK_ROOT/model/network/wifi/unittest/net/hdf_netbuf_test.c", 56 "$HDF_TEST_FRAMWORK_ROOT/model/network/wifi/unittest/netdevice/net_device_test.c", 57 "$HDF_TEST_FRAMWORK_ROOT/model/network/wifi/unittest/qos/flow_control_test.c", 58 "$HDF_TEST_FRAMWORK_ROOT/wifi/hdf_wifi_test.c", 59 ] 60 } 61 62 if (defined(LOSCFG_DRIVERS_HDF_USB_DDK_DEVICE)) { 63 sources += [ 64 "$HDF_TEST_FRAMWORK_ROOT/model/usb/device/src/hdf_usb_device_test.c", 65 "$HDF_TEST_FRAMWORK_ROOT/model/usb/device/src/usb_device_lite_cdcacm_test.c", 66 "$HDF_TEST_FRAMWORK_ROOT/model/usb/device/src/usb_device_lite_sdk_if_test.c", 67 "$HDF_TEST_FRAMWORK_ROOT/model/usb/device/src/usb_device_lite_sdk_io_test.c", 68 ] 69 } 70 71 if (defined(LOSCFG_DRIVERS_HDF_USB_DDK_HOST) && 72 defined(LOSCFG_DRIVERS_HDF_USB_PNP_NOTIFY)) { 73 sources += [ 74 "$HDF_TEST_FRAMWORK_ROOT/model/usb/host/src/hdf_usb_entry_test.c", 75 "$HDF_TEST_FRAMWORK_ROOT/model/usb/host/src/usb_raw_io.c", 76 "$HDF_TEST_FRAMWORK_ROOT/model/usb/host/src/usb_raw_test.c", 77 "$HDF_TEST_FRAMWORK_ROOT/model/usb/host/src/usb_test.c", 78 ] 79 } 80 81 if (defined(LOSCFG_DRIVERS_HDF_PLATFORM)) { 82 sources += [ 83 "$HDF_TEST_FRAMWORK_ROOT/platform/common/platform_device_test.c", 84 "$HDF_TEST_FRAMWORK_ROOT/platform/common/platform_driver_test.c", 85 "$HDF_TEST_FRAMWORK_ROOT/platform/common/platform_event_test.c", 86 "$HDF_TEST_FRAMWORK_ROOT/platform/common/platform_manager_test.c", 87 "$HDF_TEST_FRAMWORK_ROOT/platform/common/platform_queue_test.c", 88 "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_platform_entry_test.c", 89 ] 90 91 if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_TRACE)) { 92 sources += 93 [ "$HDF_TEST_FRAMWORK_ROOT/platform/common/platform_trace_test.c" ] 94 } 95 96 if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_DUMPER)) { 97 sources += 98 [ "$HDF_TEST_FRAMWORK_ROOT/platform/common/platform_dumper_test.c" ] 99 } 100 101 if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_GPIO)) { 102 sources += [ 103 "$HDF_TEST_FRAMWORK_ROOT/platform/common/gpio_driver_test.c", 104 "$HDF_TEST_FRAMWORK_ROOT/platform/common/gpio_test.c", 105 "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_gpio_entry_test.c", 106 ] 107 } 108 109 if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_PIN)) { 110 sources += [ 111 "$HDF_TEST_FRAMWORK_ROOT/platform/common/pin_driver_test.c", 112 "$HDF_TEST_FRAMWORK_ROOT/platform/common/pin_test.c", 113 "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_pin_entry_test.c", 114 ] 115 } 116 117 if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_I2C)) { 118 sources += [ 119 "$HDF_TEST_FRAMWORK_ROOT/platform/common/i2c_driver_test.c", 120 "$HDF_TEST_FRAMWORK_ROOT/platform/common/i2c_test.c", 121 "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_i2c_entry_test.c", 122 ] 123 } 124 125 if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_ADC)) { 126 sources += [ 127 "$HDF_TEST_FRAMWORK_ROOT/platform/common/adc_driver_test.c", 128 "$HDF_TEST_FRAMWORK_ROOT/platform/common/adc_test.c", 129 "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_adc_entry_test.c", 130 ] 131 } 132 133 if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_DAC)) { 134 sources += [ 135 "$HDF_TEST_FRAMWORK_ROOT/platform/common/dac_driver_test.c", 136 "$HDF_TEST_FRAMWORK_ROOT/platform/common/dac_test.c", 137 "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_dac_entry_test.c", 138 "$HDF_TEST_FRAMWORK_ROOT/platform/virtual/dac_virtual.c", 139 ] 140 } 141 142 if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_I3C)) { 143 sources += [ 144 "$HDF_TEST_FRAMWORK_ROOT/platform/common/i3c_driver_test.c", 145 "$HDF_TEST_FRAMWORK_ROOT/platform/common/i3c_test.c", 146 "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_i3c_entry_test.c", 147 "$HDF_TEST_FRAMWORK_ROOT/platform/virtual/i3c_virtual.c", 148 ] 149 } 150 151 if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_WATCHDOG)) { 152 sources += [ 153 "$HDF_TEST_FRAMWORK_ROOT/platform/common/watchdog_driver_test.c", 154 "$HDF_TEST_FRAMWORK_ROOT/platform/common/watchdog_test.c", 155 "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_watchdog_entry_test.c", 156 ] 157 } 158 159 if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_SPI)) { 160 sources += [ 161 "$HDF_TEST_FRAMWORK_ROOT/platform/common/spi_driver_test.c", 162 "$HDF_TEST_FRAMWORK_ROOT/platform/common/spi_test.c", 163 "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_spi_entry_test.c", 164 ] 165 } 166 167 if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_UART)) { 168 sources += [ 169 "$HDF_TEST_FRAMWORK_ROOT/platform/common/uart_driver_test.c", 170 "$HDF_TEST_FRAMWORK_ROOT/platform/common/uart_test.c", 171 "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_uart_entry_test.c", 172 ] 173 } 174 175 if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_I2S)) { 176 sources += [ 177 "$HDF_TEST_FRAMWORK_ROOT/platform/common/i2s_test.c", 178 "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_i2s_entry_test.c", 179 ] 180 } 181 if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_REGULATOR)) { 182 sources += [ 183 "$HDF_TEST_FRAMWORK_ROOT/platform/common/regulator_test.c", 184 "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_regulator_entry_test.c", 185 "$HDF_TEST_FRAMWORK_ROOT/platform/virtual/regulator_virtual.c", 186 ] 187 } 188 189 if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_RTC)) { 190 sources += [ 191 "$HDF_TEST_FRAMWORK_ROOT/platform/common/rtc_driver_test.c", 192 "$HDF_TEST_FRAMWORK_ROOT/platform/common/rtc_test.c", 193 "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_rtc_entry_test.c", 194 ] 195 } 196 197 if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_SDIO)) { 198 sources += [ 199 "$HDF_TEST_FRAMWORK_ROOT/platform/common/sdio_test.c", 200 "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_sdio_entry_test.c", 201 ] 202 } 203 204 if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_MIPI_DSI)) { 205 sources += [ 206 "$HDF_TEST_FRAMWORK_ROOT/platform/common/mipi_dsi_test.c", 207 "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_mipi_dsi_entry_test.c", 208 ] 209 } 210 211 if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_MIPI_CSI)) { 212 sources += [ 213 "$HDF_TEST_FRAMWORK_ROOT/platform/common/mipi_csi_test.c", 214 "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_mipi_csi_entry_test.c", 215 ] 216 } 217 218 if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_EMMC)) { 219 sources += [ 220 "$HDF_TEST_FRAMWORK_ROOT/platform/common/emmc_test.c", 221 "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_emmc_entry_test.c", 222 ] 223 } 224 225 if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_HDMI)) { 226 sources += [ 227 "$HDF_TEST_FRAMWORK_ROOT/platform/common/hdmi_test.c", 228 "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_hdmi_entry_test.c", 229 ] 230 } 231 232 if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_PCIE)) { 233 sources += [ 234 "$HDF_TEST_FRAMWORK_ROOT/platform/common/pcie_test.c", 235 "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_pcie_entry_test.c", 236 "$HDF_TEST_FRAMWORK_ROOT/platform/virtual/pcie_virtual.c", 237 ] 238 } 239 240 if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_PWM)) { 241 sources += [ 242 "$HDF_TEST_FRAMWORK_ROOT/platform/common/pwm_driver_test.c", 243 "$HDF_TEST_FRAMWORK_ROOT/platform/common/pwm_test.c", 244 "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_pwm_entry_test.c", 245 ] 246 } 247 248 if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_TIMER)) { 249 sources += [ 250 "$HDF_TEST_FRAMWORK_ROOT/platform/common/timer_driver_test.c", 251 "$HDF_TEST_FRAMWORK_ROOT/platform/common/timer_test.c", 252 "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_timer_entry_test.c", 253 ] 254 } 255 256 if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_CAN)) { 257 sources += [ 258 "$HDF_ADAPTERS_PATH/platform/can/can_virtual.c", 259 "$HDF_TEST_FRAMWORK_ROOT/platform/common/can_test.c", 260 "$HDF_TEST_FRAMWORK_ROOT/platform/config/can_test_config.c", 261 ] 262 } 263 } 264 265 if (defined(LOSCFG_DRIVERS_HDF_SENSOR)) { 266 sources += [ "$HDF_TEST_FRAMWORK_ROOT/sensor/hdf_sensor_test.c" ] 267 } 268 269 configs += [ ":test_lite" ] 270} 271 272config("test_lite") { 273 include_dirs = [ 274 "$HDF_FRAMEWORKS_PATH/include", 275 "$HDF_FRAMEWORKS_PATH/include/osal", 276 "$HDF_FRAMEWORKS_PATH/include/utils", 277 "$HDF_FRAMEWORKS_PATH/utils/include", 278 "$HDF_FRAMEWORKS_PATH/include/platform", 279 "$HDF_FRAMEWORKS_PATH/include/core", 280 "$HDF_FRAMEWORKS_PATH/support/platform/include", 281 "$HDF_FRAMEWORKS_PATH/core/host/include", 282 "$HDF_FRAMEWORKS_PATH/core/master/include", 283 "$HDF_FRAMEWORKS_PATH/core/shared/include", 284 "$HDF_FRAMEWORKS_PATH/core/manager/include", 285 "$HDF_FRAMEWORKS_PATH/core/common/include/host", 286 "../osal/include", 287 "osal/include", 288 "$HDF_FRAMEWORKS_PATH/core/adapter/vnode/include", 289 "$HDF_FRAMEWORKS_PATH/core/adapter/syscall/include", 290 "../network/include", 291 "$HDF_TEST_FRAMWORK_ROOT/common", 292 "$HDF_TEST_FRAMWORK_ROOT/manager", 293 "$HDF_TEST_FRAMWORK_ROOT/config", 294 "$HDF_TEST_FRAMWORK_ROOT/platform", 295 "$HDF_TEST_FRAMWORK_ROOT/platform/common", 296 "$HDF_TEST_FRAMWORK_ROOT/platform/entry", 297 "$HDF_TEST_FRAMWORK_ROOT/hdfframe", 298 "$HDF_TEST_FRAMWORK_ROOT/osal", 299 "$HDF_TEST_FRAMWORK_ROOT/adapter/osal/unittest", 300 "$HDF_TEST_FRAMWORK_ROOT/adapter/osal/include", 301 "$HDF_TEST_FRAMWORK_ROOT/utils/hcs_parser/unittest", 302 "$HDF_TEST_FRAMWORK_ROOT", 303 ] 304 305 if (defined(LOSCFG_DRIVERS_HDF_WIFI)) { 306 include_dirs += [ 307 "$HDF_TEST_FRAMWORK_ROOT/model/network/wifi/unittest/netdevice", 308 "$HDF_TEST_FRAMWORK_ROOT/model/network/wifi/unittest/module", 309 "$HDF_TEST_FRAMWORK_ROOT/model/network/wifi/unittest/net", 310 "$HDF_TEST_FRAMWORK_ROOT/model/network/wifi/unittest/qos", 311 "$HDF_FRAMEWORKS_PATH/model/network/wifi/include", 312 "$HDF_FRAMEWORKS_PATH/model/network/common/netdevice", 313 "$HDF_FRAMEWORKS_PATH/model/network/wifi/platform/src/qos", 314 "$HDF_TEST_FRAMWORK_ROOT/model/network/wifi/unittest/message", 315 "$HDF_FRAMEWORKS_PATH/model/network/wifi/include", 316 "$HDF_FRAMEWORKS_PATH/model/network/wifi/core/module", 317 "$HDF_FRAMEWORKS_PATH/model/network/wifi/platform/include", 318 "$HDF_FRAMEWORKS_PATH/model/network/wifi/platform/include/message", 319 "$HDF_FRAMEWORKS_PATH/model/network/wifi/platform/src", 320 "$HDF_FRAMEWORKS_PATH/model/network/wifi/core/components/softap", 321 "$HDF_FRAMEWORKS_PATH/model/network/wifi/core/components/sta", 322 "$HDF_FRAMEWORKS_PATH/include/wifi", 323 "$HDF_FRAMEWORKS_PATH/include/net", 324 "$HDF_TEST_FRAMWORK_ROOT/wifi", 325 ] 326 } 327 328 if (defined(LOSCFG_DRIVERS_HDF_SENSOR)) { 329 include_dirs += [ 330 "$HDF_TEST_FRAMWORK_ROOT/sensor", 331 "$HDF_PERIPHERAL_PATH/sensor/interfaces/include", 332 "$HDF_PERIPHERAL_PATH/sensor/hal/include", 333 "$HDF_FRAMEWORKS_PATH/model/sensor/driver/include", 334 "$HDF_FRAMEWORKS_PATH/model/sensor/driver/common/include", 335 ] 336 } 337 338 if (defined(LOSCFG_DRIVERS_HDF_USB_DDK_DEVICE)) { 339 include_dirs += [ 340 "$HDF_TEST_FRAMWORK_ROOT/model/usb/device/include", 341 "$HDF_PERIPHERAL_PATH/usb/ddk/common/include", 342 "$HDF_PERIPHERAL_PATH/usb/ddk/device/include", 343 "$HDF_PERIPHERAL_PATH/usb/interfaces/ddk/common", 344 "$HDF_PERIPHERAL_PATH/usb/interfaces/ddk/device", 345 ] 346 } 347 348 if (defined(LOSCFG_DRIVERS_HDF_USB_DDK_HOST)) { 349 include_dirs += [ 350 "$HDF_TEST_FRAMWORK_ROOT/model/usb/host/include", 351 "$HDF_PERIPHERAL_PATH/usb/interfaces/ddk/common", 352 "$HDF_PERIPHERAL_PATH/usb/interfaces/ddk/host", 353 "$HDF_PERIPHERAL_PATH/usb/gadget/function/include", 354 ] 355 } 356} 357