mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 03:00:34 +03:00
Merge branch 'bugfix/fatfs-restore-ff-use-expand' into 'master'
fix(fatfs): restore FF_USE_EXPAND for contiguous file API Closes IDFGH-18260 See merge request espressif/esp-idf!52783
This commit is contained in:
@@ -611,3 +611,29 @@ TEST_CASE("can create and remove directories", "[fatfs]")
|
|||||||
test_mkdir_rmdir();
|
test_mkdir_rmdir();
|
||||||
test_teardown();
|
test_teardown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE("esp_vfs_fat_create_contiguous_file works (requires FF_USE_EXPAND)", "[fatfs]")
|
||||||
|
{
|
||||||
|
/* Do not gate this case on FF_USE_EXPAND: with expand disabled the test app
|
||||||
|
* fails to link (undefined reference to f_expand), catching ffconf regressions. */
|
||||||
|
STATIC_REQUIRE(FF_USE_EXPAND == 1);
|
||||||
|
|
||||||
|
test_setup();
|
||||||
|
|
||||||
|
const char *base_path = "/linux";
|
||||||
|
const char *full_path = "/linux/expand.txt";
|
||||||
|
constexpr uint64_t desired_size = 64;
|
||||||
|
|
||||||
|
remove(full_path);
|
||||||
|
REQUIRE(esp_vfs_fat_create_contiguous_file(base_path, full_path, desired_size, true) == ESP_OK);
|
||||||
|
|
||||||
|
struct stat st;
|
||||||
|
REQUIRE(stat(full_path, &st) == 0);
|
||||||
|
REQUIRE(st.st_size == (off_t)desired_size);
|
||||||
|
|
||||||
|
bool is_contiguous = false;
|
||||||
|
REQUIRE(esp_vfs_fat_test_contiguous_file(base_path, full_path, &is_contiguous) == ESP_OK);
|
||||||
|
REQUIRE(is_contiguous);
|
||||||
|
|
||||||
|
test_teardown();
|
||||||
|
}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@
|
|||||||
/* This option switches fast seek feature. (0:Disable or 1:Enable) */
|
/* This option switches fast seek feature. (0:Disable or 1:Enable) */
|
||||||
|
|
||||||
|
|
||||||
#define FF_USE_EXPAND 0
|
#define FF_USE_EXPAND 1
|
||||||
/* This option switches f_expand(). (0:Disable or 1:Enable) */
|
/* This option switches f_expand(). (0:Disable or 1:Enable) */
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -223,14 +223,12 @@ TEST_CASE("(WL) can ftruncate", "[fatfs][wear_levelling]")
|
|||||||
test_teardown();
|
test_teardown();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if FF_USE_EXPAND
|
|
||||||
TEST_CASE("(WL) can esp_vfs_fat_create_contiguous_file", "[fatfs][wear_levelling]")
|
TEST_CASE("(WL) can esp_vfs_fat_create_contiguous_file", "[fatfs][wear_levelling]")
|
||||||
{
|
{
|
||||||
test_setup();
|
test_setup();
|
||||||
test_fatfs_create_contiguous_file("/spiflash", "/spiflash/expand.txt");
|
test_fatfs_create_contiguous_file("/spiflash", "/spiflash/expand.txt");
|
||||||
test_teardown();
|
test_teardown();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
TEST_CASE("(WL) stat returns correct values", "[fatfs][wear_levelling]")
|
TEST_CASE("(WL) stat returns correct values", "[fatfs][wear_levelling]")
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -200,7 +200,6 @@ TEST_CASE("(SD) can ftruncate", "[fatfs][sdmmc]")
|
|||||||
test_teardown_sdmmc(card);
|
test_teardown_sdmmc(card);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if FF_USE_EXPAND
|
|
||||||
TEST_CASE("(SD) can esp_vfs_fat_create_contiguous_file", "[fatfs][sdmmc]")
|
TEST_CASE("(SD) can esp_vfs_fat_create_contiguous_file", "[fatfs][sdmmc]")
|
||||||
{
|
{
|
||||||
sdmmc_card_t *card = NULL;
|
sdmmc_card_t *card = NULL;
|
||||||
@@ -208,7 +207,6 @@ TEST_CASE("(SD) can esp_vfs_fat_create_contiguous_file", "[fatfs][sdmmc]")
|
|||||||
test_fatfs_create_contiguous_file("/sdcard", "/sdcard/expand.txt");
|
test_fatfs_create_contiguous_file("/sdcard", "/sdcard/expand.txt");
|
||||||
test_teardown_sdmmc(card);
|
test_teardown_sdmmc(card);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
TEST_CASE("(SD) stat returns correct values", "[fatfs][sdmmc]")
|
TEST_CASE("(SD) stat returns correct values", "[fatfs][sdmmc]")
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1436,7 +1436,6 @@ void test_fatfs_info(const char* base_path, const char* filepath)
|
|||||||
TEST_ASSERT_EQUAL(free_bytes, free_bytes_new);
|
TEST_ASSERT_EQUAL(free_bytes, free_bytes_new);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if FF_USE_EXPAND
|
|
||||||
void test_fatfs_create_contiguous_file(const char* base_path, const char* full_path)
|
void test_fatfs_create_contiguous_file(const char* base_path, const char* full_path)
|
||||||
{
|
{
|
||||||
size_t desired_file_size = 64;
|
size_t desired_file_size = 64;
|
||||||
@@ -1459,4 +1458,3 @@ void test_fatfs_create_contiguous_file(const char* base_path, const char* full_p
|
|||||||
TEST_ASSERT_EQUAL(ESP_OK, err);
|
TEST_ASSERT_EQUAL(ESP_OK, err);
|
||||||
TEST_ASSERT_TRUE(is_contiguous);
|
TEST_ASSERT_TRUE(is_contiguous);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -79,9 +79,7 @@ void test_fatfs_rw_speed(const char* filename, void* buf, size_t buf_size, size_
|
|||||||
|
|
||||||
void test_fatfs_info(const char* base_path, const char* filepath);
|
void test_fatfs_info(const char* base_path, const char* filepath);
|
||||||
|
|
||||||
#if FF_USE_EXPAND
|
|
||||||
void test_fatfs_create_contiguous_file(const char* base_path, const char* full_path);
|
void test_fatfs_create_contiguous_file(const char* base_path, const char* full_path);
|
||||||
#endif
|
|
||||||
|
|
||||||
void test_fatfs_readdir_stat(const char* path);
|
void test_fatfs_readdir_stat(const char* path);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user