idf_build_get_property(target IDF_TARGET)

set(srcs
    "test_app_main.c"
    "test_spi_master.c"
    "test_spi_sio.c"
    "test_spi_bus_lock.c"
)

# TODO: IDF-10593 ～ IDF-10585: SCT is temporarily supported on follow chips
set(sct_targets esp32s2 esp32s3 esp32c2 esp32c3 esp32c6 esp32h2 esp32h21)
if("${target}" IN_LIST sct_targets)
    # sct test using slave hd APIs, need slave hd support
    # tmp skip sct test under iram_safe, both sct and slave hd are not cleaned
    if(CONFIG_SOC_SPI_SUPPORT_SLAVE_HD_VER2 AND NOT CONFIG_COMPILER_DUMP_RTL_FILES)
        list(APPEND srcs "test_spi_master_sct.c")
    endif()
endif()

# In order for the cases defined by `TEST_CASE` to be linked into the final elf,
# the component can be registered as WHOLE_ARCHIVE
idf_component_register(
    SRCS ${srcs}
    PRIV_REQUIRES esp_driver_spi spi_flash esp_timer esp_driver_gpio esp_mm
    WHOLE_ARCHIVE
)
