add: Unit test - don't trigger WDT when erasing chip

This commit is contained in:
Adam Múdry 2022-12-19 11:22:45 +01:00 committed by BOT
parent cfc8332833
commit 586e738f8a
4 changed files with 25 additions and 6 deletions

View File

@ -651,4 +651,5 @@ TEST_CASE("Test esp_flash read/write performance", "[esp_flash][test_env=UT_T1_E
#endif
TEST_CASE_MULTI_FLASH("Test esp_flash read/write performance", test_flash_read_write_performance);
#endif //!TEMPORARY_DISABLED_FOR_TARGETS(ESP32C6)

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Unlicense OR CC0-1.0
*/
@ -153,6 +153,10 @@ typedef void (*flash_test_func_t)(const esp_partition_t *part);
#define TEST_CASE_MULTI_FLASH(STR, FUNC_TO_RUN) \
TEST_CASE(STR", "TEST_CHIP_NUM_STR" chips", "[esp_flash_multi][test_env=UT_T1_ESP_FLASH][timeout=35]") {flash_test_func(FUNC_TO_RUN, TEST_CONFIG_NUM);}
#endif
#define TEST_CASE_MULTI_FLASH_LONG(STR, FUNC_TO_RUN) \
TEST_CASE(STR", "TEST_CHIP_NUM_STR" chips", "[esp_flash_multi][test_env=UT_T1_ESP_FLASH][timeout=120]") {flash_test_func(FUNC_TO_RUN, TEST_CONFIG_NUM);}
#endif
#define TEST_CASE_MULTI_FLASH_IGNORE(STR, FUNC_TO_RUN) \

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Unlicense OR CC0-1.0
*/
@ -15,6 +15,7 @@
#include "esp_private/spi_common_internal.h"
#include "esp_flash_spi_init.h"
#include "memspi_host_driver.h"
#include "spi_flash_mmap.h"
#include <esp_attr.h>
#include "esp_log.h"
@ -444,6 +445,21 @@ void test_erase_large_region(const esp_partition_t *part)
TEST_CASE_FLASH("SPI flash erase large region", test_erase_large_region);
TEST_CASE_MULTI_FLASH("SPI flash erase large region", test_erase_large_region);
static void test_flash_erase_not_trigger_wdt(const esp_partition_t *part)
{
spi_host_device_t out_host_id;
get_chip_host(part->flash_chip, &out_host_id, NULL);
// don't erase main flash (spi1), test only spi2 & spi3
if (out_host_id != SPI1_HOST) {
ESP_ERROR_CHECK(esp_flash_erase_chip(part->flash_chip));
} else {
ESP_LOGI(TAG, "spi1 skipped");
}
}
TEST_CASE_MULTI_FLASH_LONG("Test erasing flash chip not triggering WDT", test_flash_erase_not_trigger_wdt);
#if CONFIG_SPI_FLASH_AUTO_SUSPEND
void esp_test_for_suspend(void)
{

View File

@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
# SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Apache-2.0
import pytest
@ -56,6 +56,4 @@ def test_esp_flash_rom(dut: Dut) -> None:
indirect=True,
)
def test_esp_flash_multi(dut: Dut) -> None:
dut.expect_exact('Press ENTER to see the list of tests')
dut.write('[esp_flash_multi]')
dut.expect_unity_test_output()
dut.run_all_single_board_cases(group='esp_flash_multi', timeout=120)