]> granicus.if.org Git - esp-idf/blobdiff - components/fatfs/test/test_fatfs_sdmmc.c
Merge branch 'bugfix/spiram_malloc_reserve_internal_fragments' into 'master'
[esp-idf] / components / fatfs / test / test_fatfs_sdmmc.c
index 6dc1ec3fc064daba2c170147997c2fe7af6f9008..2ab31f087e1960e78229347c40fe528a1df23555 100644 (file)
@@ -95,7 +95,6 @@ TEST_CASE("(SD) overwrite and append file", "[fatfs][sd][test_env=UT_T1_SDMODE]"
     test_teardown();
 }
 
-
 TEST_CASE("(SD) can lseek", "[fatfs][sd][test_env=UT_T1_SDMODE]")
 {
     test_setup();
@@ -103,6 +102,13 @@ TEST_CASE("(SD) can lseek", "[fatfs][sd][test_env=UT_T1_SDMODE]")
     test_teardown();
 }
 
+TEST_CASE("(SD) can truncate", "[fatfs][sd][test_env=UT_T1_SDMODE]")
+{
+    test_setup();
+    test_fatfs_truncate_file("/sdcard/truncate.txt");
+    test_teardown();
+}
+
 TEST_CASE("(SD) stat returns correct values", "[fatfs][test_env=UT_T1_SDMODE]")
 {
     test_setup();
@@ -154,7 +160,7 @@ TEST_CASE("(SD) multiple tasks can use same volume", "[fatfs][test_env=UT_T1_SDM
 
 static void speed_test(void* buf, size_t buf_size, size_t file_size, bool write);
 
-TEST_CASE("(SD) write/read speed test", "[fatfs][sd][test_env=UT_T1_SDMODE]")
+TEST_CASE("(SD) write/read speed test", "[fatfs][sd][test_env=UT_T1_SDMODE][timeout=60]")
 {
     size_t heap_size;
     HEAP_SIZE_CAPTURE(heap_size);
@@ -208,6 +214,11 @@ TEST_CASE("(SD) mount two FAT partitions, SDMMC and WL, at the same time", "[fat
     const char* str_sd = "this is sd\n";
     const char* str_wl = "this is spiflash\n";
 
+    /* Erase flash before the firs use */
+    const esp_partition_t *test_partition = esp_partition_find_first(ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_ANY, "flash_test");
+    esp_partition_erase_range(test_partition, 0, test_partition->size);
+    printf("Partition erased: addr- 0x%08x, size- 0x%08x\n", test_partition->address, test_partition->size);
+
     /* Mount FATFS in SD can WL at the same time. Create a file on each FS */
     wl_handle_t wl_handle = WL_INVALID_HANDLE;
     test_setup();