# Copyright (c) 2020-2023 Huawei Device Co., Ltd. All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, this list of # conditions and the following disclaimer. # # 2. Redistributions in binary form must reproduce the above copyright notice, this list # of conditions and the following disclaimer in the documentation and/or other materials # provided with the distribution. # # 3. Neither the name of the copyright holder nor the names of its contributors may be used # to endorse or promote products derived from this software without specific prior written # permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. import("./../hdf.gni") HDF_FRAMEWORKS_PATH = "./../../../../framework" HDF_PERIPHERAL_PATH = "./../../../../../peripheral" HDF_ADAPTERS_PATH = "./../../../../adapter" HDF_TEST_FRAMWORK_ROOT = "$HDF_FRAMEWORKS_PATH/test/unittest" INTERFACES_INNER_ROOT = "../../../../interfaces/inner_api" module_switch = defined(LOSCFG_DRIVERS_HDF_TEST) module_name = "hdf_test" hdf_driver(module_name) { sources = [ "$HDF_TEST_FRAMWORK_ROOT/common/hdf_main_test.c", "$HDF_TEST_FRAMWORK_ROOT/manager/sample_driver_test.c", "$HDF_TEST_FRAMWORK_ROOT/osal/osal_all_test.c", "$HDF_TEST_FRAMWORK_ROOT/osal/osal_file_test.c", "$HDF_TEST_FRAMWORK_ROOT/osal/osal_get_case_test.c", "$HDF_TEST_FRAMWORK_ROOT/osal/osal_list_test.c", "$HDF_TEST_FRAMWORK_ROOT/osal/osal_test_entry.c", "$HDF_TEST_FRAMWORK_ROOT/osal/osal_work_test.c", "$HDF_TEST_FRAMWORK_ROOT/pm/hdf_pm_driver_test.c", "$HDF_TEST_FRAMWORK_ROOT/utils/hcs_parser/unittest/hcs_config_test.c", "$HDF_TEST_FRAMWORK_ROOT/utils/hcs_parser/unittest/hcs_parser_test.c", ] if (defined(LOSCFG_DRIVERS_HDF_WIFI)) { sources += [ "$HDF_TEST_FRAMWORK_ROOT/model/network/wifi/unittest/message/hdf_queue_test.c", "$HDF_TEST_FRAMWORK_ROOT/model/network/wifi/unittest/message/hdf_single_node_message_test.c", "$HDF_TEST_FRAMWORK_ROOT/model/network/wifi/unittest/module/hdf_module_test.c", "$HDF_TEST_FRAMWORK_ROOT/model/network/wifi/unittest/net/hdf_netbuf_test.c", "$HDF_TEST_FRAMWORK_ROOT/model/network/wifi/unittest/netdevice/net_device_test.c", "$HDF_TEST_FRAMWORK_ROOT/model/network/wifi/unittest/qos/flow_control_test.c", "$HDF_TEST_FRAMWORK_ROOT/wifi/hdf_wifi_test.c", ] } if (defined(LOSCFG_DRIVERS_HDF_USB_DDK_DEVICE)) { sources += [ "$HDF_TEST_FRAMWORK_ROOT/model/usb/device/src/hdf_usb_device_test.c", "$HDF_TEST_FRAMWORK_ROOT/model/usb/device/src/usb_device_lite_cdcacm_test.c", "$HDF_TEST_FRAMWORK_ROOT/model/usb/device/src/usb_device_lite_sdk_if_test.c", "$HDF_TEST_FRAMWORK_ROOT/model/usb/device/src/usb_device_lite_sdk_io_test.c", ] } if (defined(LOSCFG_DRIVERS_HDF_USB_DDK_HOST) && defined(LOSCFG_DRIVERS_HDF_USB_PNP_NOTIFY)) { sources += [ "$HDF_TEST_FRAMWORK_ROOT/model/usb/host/src/hdf_usb_entry_test.c", "$HDF_TEST_FRAMWORK_ROOT/model/usb/host/src/usb_raw_io.c", "$HDF_TEST_FRAMWORK_ROOT/model/usb/host/src/usb_raw_test.c", "$HDF_TEST_FRAMWORK_ROOT/model/usb/host/src/usb_test.c", ] } if (defined(LOSCFG_DRIVERS_HDF_PLATFORM)) { sources += [ "$HDF_TEST_FRAMWORK_ROOT/platform/common/platform_device_test.c", "$HDF_TEST_FRAMWORK_ROOT/platform/common/platform_driver_test.c", "$HDF_TEST_FRAMWORK_ROOT/platform/common/platform_event_test.c", "$HDF_TEST_FRAMWORK_ROOT/platform/common/platform_manager_test.c", "$HDF_TEST_FRAMWORK_ROOT/platform/common/platform_queue_test.c", "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_platform_entry_test.c", ] if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_TRACE)) { sources += [ "$HDF_TEST_FRAMWORK_ROOT/platform/common/platform_trace_test.c" ] } if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_DUMPER)) { sources += [ "$HDF_TEST_FRAMWORK_ROOT/platform/common/platform_dumper_test.c" ] } if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_GPIO)) { sources += [ "$HDF_TEST_FRAMWORK_ROOT/platform/common/gpio_driver_test.c", "$HDF_TEST_FRAMWORK_ROOT/platform/common/gpio_test.c", "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_gpio_entry_test.c", ] } if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_PIN)) { sources += [ "$HDF_TEST_FRAMWORK_ROOT/platform/common/pin_driver_test.c", "$HDF_TEST_FRAMWORK_ROOT/platform/common/pin_test.c", "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_pin_entry_test.c", "$HDF_TEST_FRAMWORK_ROOT/platform/virtual/pin_virtual.c", ] } if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_I2C)) { sources += [ "$HDF_TEST_FRAMWORK_ROOT/platform/common/i2c_driver_test.c", "$HDF_TEST_FRAMWORK_ROOT/platform/common/i2c_test.c", "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_i2c_entry_test.c", "$HDF_TEST_FRAMWORK_ROOT/platform/virtual/mini/i2c_mini_virtual.c", ] } if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_ADC)) { sources += [ "$HDF_TEST_FRAMWORK_ROOT/platform/common/adc_driver_test.c", "$HDF_TEST_FRAMWORK_ROOT/platform/common/adc_test.c", "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_adc_entry_test.c", "$HDF_TEST_FRAMWORK_ROOT/platform/virtual/adc_virtual.c", ] } if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_DAC)) { sources += [ "$HDF_TEST_FRAMWORK_ROOT/platform/common/dac_driver_test.c", "$HDF_TEST_FRAMWORK_ROOT/platform/common/dac_test.c", "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_dac_entry_test.c", "$HDF_TEST_FRAMWORK_ROOT/platform/virtual/dac_virtual.c", ] } if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_I3C)) { sources += [ "$HDF_TEST_FRAMWORK_ROOT/platform/common/i3c_driver_test.c", "$HDF_TEST_FRAMWORK_ROOT/platform/common/i3c_test.c", "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_i3c_entry_test.c", "$HDF_TEST_FRAMWORK_ROOT/platform/virtual/i3c_virtual.c", ] } if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_WATCHDOG)) { sources += [ "$HDF_TEST_FRAMWORK_ROOT/platform/common/watchdog_driver_test.c", "$HDF_TEST_FRAMWORK_ROOT/platform/common/watchdog_test.c", "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_watchdog_entry_test.c", "$HDF_TEST_FRAMWORK_ROOT/platform/virtual/mini/watchdog_mini_virtual.c", "$HDF_TEST_FRAMWORK_ROOT/platform/virtual/watchdog_virtual.c", ] } if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_SPI)) { sources += [ "$HDF_TEST_FRAMWORK_ROOT/platform/common/spi_driver_test.c", "$HDF_TEST_FRAMWORK_ROOT/platform/common/spi_test.c", "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_spi_entry_test.c", "$HDF_TEST_FRAMWORK_ROOT/platform/virtual/spi_virtual.c", ] } if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_UART)) { sources += [ "$HDF_TEST_FRAMWORK_ROOT/platform/common/uart_driver_test.c", "$HDF_TEST_FRAMWORK_ROOT/platform/common/uart_test.c", "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_uart_entry_test.c", "$HDF_TEST_FRAMWORK_ROOT/platform/virtual/mini/uart_mini_virtual.c", ] } if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_I2S)) { sources += [ "$HDF_TEST_FRAMWORK_ROOT/platform/common/i2s_test.c", "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_i2s_entry_test.c", ] } if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_REGULATOR)) { sources += [ "$HDF_TEST_FRAMWORK_ROOT/platform/common/regulator_test.c", "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_regulator_entry_test.c", "$HDF_TEST_FRAMWORK_ROOT/platform/virtual/regulator_virtual.c", ] } if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_RTC)) { sources += [ "$HDF_TEST_FRAMWORK_ROOT/platform/common/rtc_driver_test.c", "$HDF_TEST_FRAMWORK_ROOT/platform/common/rtc_test.c", "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_rtc_entry_test.c", "$HDF_TEST_FRAMWORK_ROOT/platform/virtual/mini/rtc_mini_virtual.c", ] } if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_SDIO)) { sources += [ "$HDF_TEST_FRAMWORK_ROOT/platform/common/sdio_test.c", "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_sdio_entry_test.c", ] } if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_MIPI_DSI)) { sources += [ "$HDF_TEST_FRAMWORK_ROOT/platform/common/mipi_dsi_test.c", "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_mipi_dsi_entry_test.c", ] } if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_MIPI_CSI)) { sources += [ "$HDF_TEST_FRAMWORK_ROOT/platform/common/mipi_csi_test.c", "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_mipi_csi_entry_test.c", ] } if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_EMMC)) { sources += [ "$HDF_TEST_FRAMWORK_ROOT/platform/common/emmc_test.c", "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_emmc_entry_test.c", ] } if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_HDMI)) { sources += [ "$HDF_TEST_FRAMWORK_ROOT/platform/common/hdmi_test.c", "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_hdmi_entry_test.c", ] } if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_PCIE)) { sources += [ "$HDF_TEST_FRAMWORK_ROOT/platform/common/pcie_driver_test.c", "$HDF_TEST_FRAMWORK_ROOT/platform/common/pcie_test.c", "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_pcie_entry_test.c", "$HDF_TEST_FRAMWORK_ROOT/platform/virtual/pcie_virtual.c", ] } if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_PWM)) { sources += [ "$HDF_TEST_FRAMWORK_ROOT/platform/common/pwm_driver_test.c", "$HDF_TEST_FRAMWORK_ROOT/platform/common/pwm_test.c", "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_pwm_entry_test.c", "$HDF_TEST_FRAMWORK_ROOT/platform/virtual/pwm_virtual.c", ] } if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_TIMER)) { sources += [ "$HDF_TEST_FRAMWORK_ROOT/platform/common/timer_driver_test.c", "$HDF_TEST_FRAMWORK_ROOT/platform/common/timer_test.c", "$HDF_TEST_FRAMWORK_ROOT/platform/entry/hdf_timer_entry_test.c", ] } if (defined(LOSCFG_DRIVERS_HDF_PLATFORM_CAN)) { sources += [ "$HDF_ADAPTERS_PATH/platform/can/can_virtual.c", "$HDF_TEST_FRAMWORK_ROOT/platform/common/can_test.c", "$HDF_TEST_FRAMWORK_ROOT/platform/config/can_test_config.c", ] } } if (defined(LOSCFG_DRIVERS_HDF_SENSOR)) { sources += [ "$HDF_TEST_FRAMWORK_ROOT/sensor/hdf_sensor_test.c" ] } configs += [ ":test_lite" ] } config("test_lite") { include_dirs = [ "$HDF_FRAMEWORKS_PATH/include", "$HDF_FRAMEWORKS_PATH/include/osal", "$HDF_FRAMEWORKS_PATH/include/utils", "$HDF_FRAMEWORKS_PATH/utils/include", "$HDF_FRAMEWORKS_PATH/include/platform", "$HDF_FRAMEWORKS_PATH/include/core", "$INTERFACES_INNER_ROOT/core", "$INTERFACES_INNER_ROOT/utils", "$INTERFACES_INNER_ROOT/osal/shared", "$HDF_FRAMEWORKS_PATH/support/platform/include", "$HDF_FRAMEWORKS_PATH/core/host/include", "$HDF_FRAMEWORKS_PATH/core/master/include", "$HDF_FRAMEWORKS_PATH/core/shared/include", "$HDF_FRAMEWORKS_PATH/core/manager/include", "$HDF_FRAMEWORKS_PATH/core/common/include/host", "../osal/include", "osal/include", "$HDF_FRAMEWORKS_PATH/core/adapter/vnode/include", "$HDF_FRAMEWORKS_PATH/core/adapter/syscall/include", "../network/include", "$HDF_TEST_FRAMWORK_ROOT/common", "$HDF_TEST_FRAMWORK_ROOT/manager", "$HDF_TEST_FRAMWORK_ROOT/config", "$HDF_TEST_FRAMWORK_ROOT/platform", "$HDF_TEST_FRAMWORK_ROOT/platform/common", "$HDF_TEST_FRAMWORK_ROOT/platform/entry", "$HDF_TEST_FRAMWORK_ROOT/hdfframe", "$HDF_TEST_FRAMWORK_ROOT/osal", "$HDF_TEST_FRAMWORK_ROOT/adapter/osal/unittest", "$HDF_TEST_FRAMWORK_ROOT/adapter/osal/include", "$HDF_TEST_FRAMWORK_ROOT/utils/hcs_parser/unittest", "$HDF_TEST_FRAMWORK_ROOT", ] if (defined(LOSCFG_DRIVERS_HDF_WIFI)) { include_dirs += [ "$HDF_TEST_FRAMWORK_ROOT/model/network/wifi/unittest/netdevice", "$HDF_TEST_FRAMWORK_ROOT/model/network/wifi/unittest/module", "$HDF_TEST_FRAMWORK_ROOT/model/network/wifi/unittest/net", "$HDF_TEST_FRAMWORK_ROOT/model/network/wifi/unittest/qos", "$HDF_FRAMEWORKS_PATH/model/network/wifi/include", "$HDF_FRAMEWORKS_PATH/model/network/common/netdevice", "$HDF_FRAMEWORKS_PATH/model/network/wifi/platform/src/qos", "$HDF_TEST_FRAMWORK_ROOT/model/network/wifi/unittest/message", "$HDF_FRAMEWORKS_PATH/model/network/wifi/include", "$HDF_FRAMEWORKS_PATH/model/network/wifi/core/module", "$HDF_FRAMEWORKS_PATH/model/network/wifi/platform/include", "$HDF_FRAMEWORKS_PATH/model/network/wifi/platform/include/message", "$HDF_FRAMEWORKS_PATH/model/network/wifi/platform/src", "$HDF_FRAMEWORKS_PATH/model/network/wifi/core/components/softap", "$HDF_FRAMEWORKS_PATH/model/network/wifi/core/components/sta", "$HDF_FRAMEWORKS_PATH/include/wifi", "$HDF_FRAMEWORKS_PATH/include/net", "$HDF_TEST_FRAMWORK_ROOT/wifi", ] } if (defined(LOSCFG_DRIVERS_HDF_SENSOR)) { include_dirs += [ "$HDF_TEST_FRAMWORK_ROOT/sensor", "$HDF_PERIPHERAL_PATH/sensor/interfaces/include", "$HDF_PERIPHERAL_PATH/sensor/hal/include", "$HDF_FRAMEWORKS_PATH/model/sensor/driver/include", "$HDF_FRAMEWORKS_PATH/model/sensor/driver/common/include", ] } if (defined(LOSCFG_DRIVERS_HDF_USB_DDK_DEVICE)) { include_dirs += [ "$HDF_TEST_FRAMWORK_ROOT/model/usb/device/include", "$HDF_PERIPHERAL_PATH/usb/ddk/common/include", "$HDF_PERIPHERAL_PATH/usb/ddk/device/include", "$HDF_PERIPHERAL_PATH/usb/interfaces/ddk/common", "$HDF_PERIPHERAL_PATH/usb/interfaces/ddk/device", ] } if (defined(LOSCFG_DRIVERS_HDF_USB_DDK_HOST)) { include_dirs += [ "$HDF_TEST_FRAMWORK_ROOT/model/usb/host/include", "$HDF_PERIPHERAL_PATH/usb/interfaces/ddk/common", "$HDF_PERIPHERAL_PATH/usb/interfaces/ddk/host", "$HDF_PERIPHERAL_PATH/usb/gadget/function/include", ] } }