Upgrade fatfs component version

This commit is contained in:
jacqueline
2024-04-09 11:04:42 +10:00
parent 96b62321c3
commit 6e73f1a22e
35 changed files with 633 additions and 76 deletions
+2 -2
View File
@@ -1,5 +1,5 @@
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- |
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
This test app runs a few FATFS test cases in a wear levelling FAT partition.
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -10,6 +10,7 @@
#include <time.h>
#include <sys/time.h>
#include <sys/unistd.h>
#include <sys/stat.h>
#include "unity.h"
#include "esp_partition.h"
#include "esp_log.h"
@@ -44,14 +45,14 @@ static void test_teardown(void)
TEST_ESP_OK(esp_vfs_fat_spiflash_unmount_rw_wl("/spiflash", s_test_wl_handle));
}
TEST_CASE("(WL) can format partition", "[fatfs][wear_levelling]")
TEST_CASE("(WL) can format partition", "[fatfs][wear_levelling][timeout=180]")
{
TEST_ESP_OK(esp_vfs_fat_spiflash_format_rw_wl("/spiflash", NULL));
test_setup();
test_teardown();
}
TEST_CASE("(WL) can format when the FAT is mounted already", "[fatfs][wear_levelling]")
TEST_CASE("(WL) can format when the FAT is mounted already", "[fatfs][wear_levelling][timeout=180]")
{
test_setup();
TEST_ESP_OK(esp_vfs_fat_spiflash_format_rw_wl("/spiflash", NULL));
@@ -60,6 +61,30 @@ TEST_CASE("(WL) can format when the FAT is mounted already", "[fatfs][wear_level
test_teardown();
}
TEST_CASE("(WL) can format specified FAT when more are mounted", "[fatfs][wear_levelling][timeout=180]")
{
esp_vfs_fat_sdmmc_mount_config_t mount_config = {
.format_if_mount_failed = true,
.max_files = 5,
};
wl_handle_t s_test_wl_handle1;
wl_handle_t s_test_wl_handle2;
TEST_ESP_OK(esp_vfs_fat_spiflash_mount_rw_wl("/spiflash1", "storage", &mount_config, &s_test_wl_handle1));
TEST_ESP_OK(esp_vfs_fat_spiflash_mount_rw_wl("/spiflash2", "storage2", &mount_config, &s_test_wl_handle2));
test_fatfs_create_file_with_text("/spiflash1/hello.txt", fatfs_test_hello_str);
test_fatfs_create_file_with_text("/spiflash2/hello.txt", fatfs_test_hello_str);
TEST_ESP_OK(esp_vfs_fat_spiflash_format_rw_wl("/spiflash2", "storage2"));
FILE* f = fopen("/spiflash2/hello.txt", "r");
TEST_ASSERT_NULL(f); // File is erased on the formatted FAT
test_fatfs_pread_file("/spiflash1/hello.txt"); // File is still readable on the other FAT
TEST_ESP_OK(esp_vfs_fat_spiflash_unmount_rw_wl("/spiflash1", s_test_wl_handle1));
TEST_ESP_OK(esp_vfs_fat_spiflash_unmount_rw_wl("/spiflash2", s_test_wl_handle2));
}
TEST_CASE("(WL) can create and write file", "[fatfs][wear_levelling]")
{
test_setup();
@@ -274,3 +299,14 @@ TEST_CASE("FATFS prefers SPI RAM for allocations", "[fatfs]")
test_teardown();
}
#endif // CONFIG_SPIRAM
#if CONFIG_FATFS_IMMEDIATE_FSYNC
TEST_CASE("Size is correct after write when immediate fsync is enabled", "[fatfs]")
{
test_setup();
test_fatfs_size("/spiflash/size.txt", "random text\n preferably something relatively long\n");
test_teardown();
}
#endif // CONFIG_FATFS_IMMEDIATE_FSYNC
+2 -1
View File
@@ -1,3 +1,4 @@
# Name, Type, SubType, Offset, Size, Flags
factory, app, factory, 0x10000, 1M,
factory, app, factory, 0x10000, 768k,
storage, data, fat, , 528k,
storage2, data, fat, , 528k,
1 # Name Type SubType Offset Size Flags
2 factory app factory 0x10000 1M 768k
3 storage data fat 528k
4 storage2 data fat 528k
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
# SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: CC0-1.0
import pytest
@@ -20,7 +20,7 @@ def test_fatfs_flash_wl_generic(dut: Dut) -> None:
dut.write('')
dut.expect_exact('Enter test for running.')
dut.write('*')
dut.expect_unity_test_output(timeout=120)
dut.expect_unity_test_output(timeout=180)
@pytest.mark.supported_targets
@@ -36,4 +36,4 @@ def test_fatfs_flash_wl_psram(dut: Dut) -> None:
dut.write('')
dut.expect_exact('Enter test for running.')
dut.write('*')
dut.expect_unity_test_output(timeout=120)
dut.expect_unity_test_output(timeout=180)
@@ -0,0 +1 @@
CONFIG_FATFS_IMMEDIATE_FSYNC=y