1# Copyright (c) 2020-2021 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/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_core_entry_test.c", 89 ] 90 91 if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_GPIO)) { 92 sources += [ 93 "$HDF_TEST_FRAMWORK_ROOT/platform/common/gpio_driver_test.c", 94 "$HDF_TEST_FRAMWORK_ROOT/platform/common/gpio_test.c", 95 "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_gpio_entry_test.c", 96 ] 97 } 98 99 if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_PIN)) { 100 sources += [ 101 "$HDF_TEST_FRAMWORK_ROOT/platform/common/pin_driver_test.c", 102 "$HDF_TEST_FRAMWORK_ROOT/platform/common/pin_test.c", 103 "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_pin_entry_test.c", 104 ] 105 } 106 107 if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_I2C)) { 108 sources += [ 109 "$HDF_TEST_FRAMWORK_ROOT/platform/common/i2c_driver_test.c", 110 "$HDF_TEST_FRAMWORK_ROOT/platform/common/i2c_test.c", 111 "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_i2c_entry_test.c", 112 ] 113 } 114 115 if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_ADC)) { 116 sources += [ 117 "$HDF_TEST_FRAMWORK_ROOT/platform/common/adc_driver_test.c", 118 "$HDF_TEST_FRAMWORK_ROOT/platform/common/adc_test.c", 119 "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_adc_entry_test.c", 120 ] 121 } 122 123 if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_DAC)) { 124 sources += [ 125 "$HDF_TEST_FRAMWORK_ROOT/platform/common/dac_driver_test.c", 126 "$HDF_TEST_FRAMWORK_ROOT/platform/common/dac_test.c", 127 "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_dac_entry_test.c", 128 "$HDF_TEST_FRAMWORK_ROOT/platform/virtual/dac_virtual.c", 129 ] 130 } 131 132 if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_I3C)) { 133 sources += [ 134 "$HDF_TEST_FRAMWORK_ROOT/platform/common/i3c_driver_test.c", 135 "$HDF_TEST_FRAMWORK_ROOT/platform/common/i3c_test.c", 136 "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_i3c_entry_test.c", 137 "$HDF_TEST_FRAMWORK_ROOT/platform/virtual/i3c_virtual.c", 138 ] 139 } 140 141 if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_WATCHDOG)) { 142 sources += [ 143 "$HDF_TEST_FRAMWORK_ROOT/platform/common/watchdog_driver_test.c", 144 "$HDF_TEST_FRAMWORK_ROOT/platform/common/watchdog_test.c", 145 "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_watchdog_entry_test.c", 146 ] 147 } 148 149 if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_SPI)) { 150 sources += [ 151 "$HDF_TEST_FRAMWORK_ROOT/platform/common/spi_driver_test.c", 152 "$HDF_TEST_FRAMWORK_ROOT/platform/common/spi_test.c", 153 "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_spi_entry_test.c", 154 ] 155 } 156 157 if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_UART)) { 158 sources += [ 159 "$HDF_TEST_FRAMWORK_ROOT/platform/common/uart_driver_test.c", 160 "$HDF_TEST_FRAMWORK_ROOT/platform/common/uart_test.c", 161 "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_uart_entry_test.c", 162 ] 163 } 164 165 if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_I2S)) { 166 sources += [ 167 "$HDF_TEST_FRAMWORK_ROOT/platform/common/i2s_test.c", 168 "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_i2s_entry_test.c", 169 ] 170 } 171 if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_REGULATOR)) { 172 sources += [ 173 "$HDF_TEST_FRAMWORK_ROOT/platform/common/regulator_test.c", 174 "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_regulator_entry_test.c", 175 "$HDF_TEST_FRAMWORK_ROOT/platform/virtual/regulator_virtual.c", 176 ] 177 } 178 179 if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_RTC)) { 180 sources += [ 181 "$HDF_TEST_FRAMWORK_ROOT/platform/common/rtc_driver_test.c", 182 "$HDF_TEST_FRAMWORK_ROOT/platform/common/rtc_test.c", 183 "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_rtc_entry_test.c", 184 ] 185 } 186 187 if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_SDIO)) { 188 sources += [ 189 "$HDF_TEST_FRAMWORK_ROOT/platform/common/sdio_test.c", 190 "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_sdio_entry_test.c", 191 ] 192 } 193 194 if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_MIPI_DSI)) { 195 sources += [ 196 "$HDF_TEST_FRAMWORK_ROOT/platform/common/mipi_dsi_test.c", 197 "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_mipi_dsi_entry_test.c", 198 ] 199 } 200 201 if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_MIPI_CSI)) { 202 sources += [ 203 "$HDF_TEST_FRAMWORK_ROOT/platform/common/mipi_csi_test.c", 204 "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_mipi_csi_entry_test.c", 205 ] 206 } 207 208 if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_EMMC)) { 209 sources += [ 210 "$HDF_TEST_FRAMWORK_ROOT/platform/common/emmc_test.c", 211 "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_emmc_entry_test.c", 212 ] 213 } 214 215 if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_HDMI)) { 216 sources += [ 217 "$HDF_TEST_FRAMWORK_ROOT/platform/common/hdmi_test.c", 218 "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_hdmi_entry_test.c", 219 ] 220 } 221 222 if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_PCIE)) { 223 sources += [ 224 "$HDF_TEST_FRAMWORK_ROOT/platform/common/pcie_test.c", 225 "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_pcie_entry_test.c", 226 "$HDF_TEST_FRAMWORK_ROOT/platform/virtual/pcie_virtual.c", 227 ] 228 } 229 230 if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_PWM)) { 231 sources += [ 232 "$HDF_TEST_FRAMWORK_ROOT/platform/common/pwm_driver_test.c", 233 "$HDF_TEST_FRAMWORK_ROOT/platform/common/pwm_test.c", 234 "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_pwm_entry_test.c", 235 ] 236 } 237 238 if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_TIMER)) { 239 sources += [ 240 "$HDF_TEST_FRAMWORK_ROOT/platform/common/timer_driver_test.c", 241 "$HDF_TEST_FRAMWORK_ROOT/platform/common/timer_test.c", 242 "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_timer_entry_test.c", 243 ] 244 } 245 } 246 247 if (defined(LOSCFG_DRIVERS_HDF_SENSOR)) { 248 sources += [ "$HDF_TEST_FRAMWORK_ROOT/sensor/hdf_sensor_test.c" ] 249 } 250 251 configs += [ ":test_lite" ] 252} 253 254config("test_lite") { 255 include_dirs = [ 256 "$HDF_FRAMEWORKS_PATH/include", 257 "$HDF_FRAMEWORKS_PATH/include/osal", 258 "$HDF_FRAMEWORKS_PATH/include/utils", 259 "$HDF_FRAMEWORKS_PATH/utils/include", 260 "$HDF_FRAMEWORKS_PATH/include/platform", 261 "$HDF_FRAMEWORKS_PATH/include/core", 262 "$HDF_FRAMEWORKS_PATH/support/platform/include", 263 "$HDF_FRAMEWORKS_PATH/core/host/include", 264 "$HDF_FRAMEWORKS_PATH/core/master/include", 265 "$HDF_FRAMEWORKS_PATH/core/shared/include", 266 "$HDF_FRAMEWORKS_PATH/core/manager/include", 267 "$HDF_FRAMEWORKS_PATH/core/common/include/host", 268 "../osal/include", 269 "osal/include", 270 "$HDF_FRAMEWORKS_PATH/core/adapter/vnode/include", 271 "$HDF_FRAMEWORKS_PATH/core/adapter/syscall/include", 272 "../network/include", 273 "$HDF_TEST_FRAMWORK_ROOT/common", 274 "$HDF_TEST_FRAMWORK_ROOT/manager", 275 "$HDF_TEST_FRAMWORK_ROOT/config", 276 "$HDF_TEST_FRAMWORK_ROOT/platform", 277 "$HDF_TEST_FRAMWORK_ROOT/platform/common", 278 "$HDF_TEST_FRAMWORK_ROOT/platform/entry", 279 "$HDF_TEST_FRAMWORK_ROOT/hdfframe", 280 "$HDF_TEST_FRAMWORK_ROOT/osal", 281 "$HDF_TEST_FRAMWORK_ROOT/adapter/osal/unittest", 282 "$HDF_TEST_FRAMWORK_ROOT/adapter/osal/include", 283 "$HDF_TEST_FRAMWORK_ROOT/utils/hcs_parser/unittest", 284 "$HDF_TEST_FRAMWORK_ROOT", 285 ] 286 287 if (defined(LOSCFG_DRIVERS_HDF_WIFI)) { 288 include_dirs += [ 289 "$HDF_TEST_FRAMWORK_ROOT/model/network/wifi/unittest/netdevice", 290 "$HDF_TEST_FRAMWORK_ROOT/model/network/wifi/unittest/module", 291 "$HDF_TEST_FRAMWORK_ROOT/model/network/wifi/unittest/net", 292 "$HDF_TEST_FRAMWORK_ROOT/model/network/wifi/unittest/qos", 293 "$HDF_FRAMEWORKS_PATH/model/network/wifi/include", 294 "$HDF_FRAMEWORKS_PATH/model/network/common/netdevice", 295 "$HDF_FRAMEWORKS_PATH/model/network/wifi/platform/src/qos", 296 "$HDF_TEST_FRAMWORK_ROOT/model/network/wifi/unittest/message", 297 "$HDF_FRAMEWORKS_PATH/model/network/wifi/include", 298 "$HDF_FRAMEWORKS_PATH/model/network/wifi/core/module", 299 "$HDF_FRAMEWORKS_PATH/model/network/wifi/platform/include", 300 "$HDF_FRAMEWORKS_PATH/model/network/wifi/platform/include/message", 301 "$HDF_FRAMEWORKS_PATH/model/network/wifi/platform/src", 302 "$HDF_FRAMEWORKS_PATH/model/network/wifi/core/components/softap", 303 "$HDF_FRAMEWORKS_PATH/model/network/wifi/core/components/sta", 304 "$HDF_FRAMEWORKS_PATH/include/wifi", 305 "$HDF_FRAMEWORKS_PATH/include/net", 306 "$HDF_TEST_FRAMWORK_ROOT/wifi", 307 ] 308 } 309 310 if (defined(LOSCFG_DRIVERS_HDF_SENSOR)) { 311 include_dirs += [ 312 "$HDF_TEST_FRAMWORK_ROOT/sensor", 313 "$HDF_PERIPHERAL_PATH/sensor/interfaces/include", 314 "$HDF_PERIPHERAL_PATH/sensor/hal/include", 315 "$HDF_FRAMEWORKS_PATH/model/sensor/driver/include", 316 "$HDF_FRAMEWORKS_PATH/model/sensor/driver/common/include", 317 ] 318 } 319 320 if (defined(LOSCFG_DRIVERS_HDF_USB_DDK_DEVICE)) { 321 include_dirs += [ 322 "$HDF_TEST_FRAMWORK_ROOT/model/usb/device/include", 323 "$HDF_PERIPHERAL_PATH/usb/ddk/common/include", 324 "$HDF_PERIPHERAL_PATH/usb/ddk/device/include", 325 "$HDF_PERIPHERAL_PATH/usb/interfaces/ddk/common", 326 "$HDF_PERIPHERAL_PATH/usb/interfaces/ddk/device", 327 ] 328 } 329 330 if (defined(LOSCFG_DRIVERS_HDF_USB_DDK_HOST)) { 331 include_dirs += [ 332 "$HDF_TEST_FRAMWORK_ROOT/model/usb/host/include", 333 "$HDF_PERIPHERAL_PATH/usb/interfaces/ddk/common", 334 "$HDF_PERIPHERAL_PATH/usb/interfaces/ddk/host", 335 "$HDF_PERIPHERAL_PATH/usb/gadget/function/include", 336 ] 337 } 338} 339