Merge branch 'fix/vfs_fatfs_test_stale_partition_v6.1' into 'release/v6.1'

test(vfs): reformat WL FATFS in setup to avoid stale-partition flakes (v6.1)

See merge request espressif/esp-idf!50400
This commit is contained in:
Jiang Jiang Jian
2026-07-16 11:27:21 +08:00
2 changed files with 6 additions and 3 deletions
@@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2015-2026 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
@@ -68,6 +68,8 @@ static inline void test_spi_flash_setup(void)
.max_files = 5 .max_files = 5
}; };
//reformat the partition to ensure having a fresh copy for each test
TEST_ESP_OK(esp_vfs_fat_spiflash_format_rw_wl("/spiflash", NULL));
TEST_ESP_OK(esp_vfs_fat_spiflash_mount_rw_wl("/spiflash", NULL, &mount_config, &test_wl_handle)); TEST_ESP_OK(esp_vfs_fat_spiflash_mount_rw_wl("/spiflash", NULL, &mount_config, &test_wl_handle));
} }
@@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2015-2026 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
@@ -82,9 +82,10 @@ TEST_CASE("open() with O_APPEND on FATFS works well", "[vfs][FATFS]")
wl_handle_t test_wl_handle; wl_handle_t test_wl_handle;
esp_vfs_fat_sdmmc_mount_config_t mount_config = { esp_vfs_fat_sdmmc_mount_config_t mount_config = {
.format_if_mount_failed = true,
.max_files = 2 .max_files = 2
}; };
//reformat the partition to ensure having a fresh copy for each test
TEST_ESP_OK(esp_vfs_fat_spiflash_format_rw_wl("/spiflash", NULL));
TEST_ESP_OK(esp_vfs_fat_spiflash_mount_rw_wl("/spiflash", NULL, &mount_config, &test_wl_handle)); TEST_ESP_OK(esp_vfs_fat_spiflash_mount_rw_wl("/spiflash", NULL, &mount_config, &test_wl_handle));
test_append("/spiflash/file.txt"); test_append("/spiflash/file.txt");