Upgrade fatfs component version
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
# Documentation: .gitlab/ci/README.md#manifest-file-to-control-the-buildtest-apps
|
||||
|
||||
components/fatfs/test_apps/sdcard:
|
||||
disable_test:
|
||||
- if: IDF_TARGET in ["esp32s3", "esp32c2", "esp32c6", "esp32h2"]
|
||||
temporary: true
|
||||
reason: No sdspi runners for these targets
|
||||
disable:
|
||||
- if: IDF_TARGET == "esp32p4"
|
||||
temporary: true
|
||||
reason: target esp32p4 is not supported yet # TODO: IDF-7501
|
||||
@@ -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 read-only FAT partition.
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,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
|
||||
@@ -92,7 +92,7 @@ TEST_CASE("Mount fails cleanly without card inserted", "[fatfs][ignore]")
|
||||
HEAP_SIZE_CHECK(heap_size, 0);
|
||||
}
|
||||
|
||||
TEST_CASE("(SD) can format partition", "[fatfs][sdmmc]")
|
||||
TEST_CASE("(SD) can format partition", "[fatfs][sdmmc][timeout=180]")
|
||||
{
|
||||
sdmmc_card_t *card = NULL;
|
||||
test_setup_sdmmc(&card);
|
||||
|
||||
@@ -167,7 +167,7 @@ TEST_CASE("(SDSPI) can get partition info", "[fatfs][sdspi]")
|
||||
test_teardown_sdspi(&mem);
|
||||
}
|
||||
|
||||
TEST_CASE("(SDSPI) can format card", "[fatfs][sdspi]")
|
||||
TEST_CASE("(SDSPI) can format card", "[fatfs][sdspi][timeout=180]")
|
||||
{
|
||||
sdspi_mem_t mem;
|
||||
test_setup_sdspi(&mem);
|
||||
|
||||
@@ -19,7 +19,7 @@ def test_fatfs_sdcard_generic_sdmmc(dut: Dut) -> None:
|
||||
dut.write('')
|
||||
dut.expect_exact('Enter test for running.')
|
||||
dut.write('[sdmmc]')
|
||||
dut.expect_unity_test_output(timeout=120)
|
||||
dut.expect_unity_test_output(timeout=180)
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@@ -38,7 +38,7 @@ def test_fatfs_sdcard_generic_sdspi(dut: Dut) -> None:
|
||||
dut.write('')
|
||||
dut.expect_exact('Enter test for running.')
|
||||
dut.write('[sdspi]')
|
||||
dut.expect_unity_test_output(timeout=120)
|
||||
dut.expect_unity_test_output(timeout=180)
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@@ -55,7 +55,7 @@ def test_fatfs_sdcard_psram_sdmmc(dut: Dut) -> None:
|
||||
dut.write('')
|
||||
dut.expect_exact('Enter test for running.')
|
||||
dut.write('[sdmmc]')
|
||||
dut.expect_unity_test_output(timeout=120)
|
||||
dut.expect_unity_test_output(timeout=180)
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@@ -72,4 +72,4 @@ def test_fatfs_sdcard_psram_sdspi(dut: Dut) -> None:
|
||||
dut.write('')
|
||||
dut.expect_exact('Enter test for running.')
|
||||
dut.write('[sdspi]')
|
||||
dut.expect_unity_test_output(timeout=120)
|
||||
dut.expect_unity_test_output(timeout=180)
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
@@ -434,6 +434,40 @@ void test_fatfs_stat(const char* filename, const char* root_dir)
|
||||
TEST_ASSERT_FALSE(st.st_mode & S_IFREG);
|
||||
}
|
||||
|
||||
void test_fatfs_size(const char* filename, const char* content) {
|
||||
size_t expected_size = strlen(content);
|
||||
|
||||
int fd = open(filename, O_CREAT | O_WRONLY);
|
||||
TEST_ASSERT_NOT_EQUAL(-1, fd);
|
||||
|
||||
ssize_t wr = write(fd, content, expected_size);
|
||||
TEST_ASSERT_NOT_EQUAL(-1, wr);
|
||||
|
||||
struct stat st;
|
||||
TEST_ASSERT_EQUAL(0, stat(filename, &st));
|
||||
TEST_ASSERT_EQUAL(wr, st.st_size);
|
||||
|
||||
ssize_t wr2 = pwrite(fd, content, expected_size, expected_size);
|
||||
TEST_ASSERT_NOT_EQUAL(-1, wr2);
|
||||
|
||||
TEST_ASSERT_EQUAL(0, stat(filename, &st));
|
||||
TEST_ASSERT_EQUAL(wr + wr2, st.st_size);
|
||||
|
||||
TEST_ASSERT_EQUAL(0, ftruncate(fd, wr));
|
||||
|
||||
TEST_ASSERT_EQUAL(0, stat(filename, &st));
|
||||
TEST_ASSERT_EQUAL(wr, st.st_size);
|
||||
|
||||
TEST_ASSERT_EQUAL(0, close(fd));
|
||||
|
||||
wr /= 2;
|
||||
|
||||
TEST_ASSERT_EQUAL(0, truncate(filename, wr));
|
||||
|
||||
TEST_ASSERT_EQUAL(0, stat(filename, &st));
|
||||
TEST_ASSERT_EQUAL(wr, st.st_size);
|
||||
}
|
||||
|
||||
void test_fatfs_mtime_dst(const char* filename, const char* root_dir)
|
||||
{
|
||||
struct timeval tv = { 1653638041, 0 };
|
||||
|
||||
@@ -51,6 +51,8 @@ void test_fatfs_ftruncate_file(const char* path);
|
||||
|
||||
void test_fatfs_stat(const char* filename, const char* root_dir);
|
||||
|
||||
void test_fatfs_size(const char* filename, const char* content);
|
||||
|
||||
void test_fatfs_mtime_dst(const char* filename, const char* root_dir);
|
||||
|
||||
void test_fatfs_utime(const char* filename, const char* root_dir);
|
||||
|
||||
Reference in New Issue
Block a user