@@ -39,7 +39,8 @@ static void test_setup(void)
3939 sdmmc_slot_config_t slot_config = SDMMC_SLOT_CONFIG_DEFAULT ();
4040 esp_vfs_fat_sdmmc_mount_config_t mount_config = {
4141 .format_if_mount_failed = true,
42- .max_files = 5
42+ .max_files = 5 ,
43+ .allocation_unit_size = 16 * 1024
4344 };
4445 TEST_ESP_OK (esp_vfs_fat_sdmmc_mount ("/sdcard" , & host , & slot_config , & mount_config , NULL ));
4546}
@@ -50,9 +51,8 @@ static void test_teardown(void)
5051}
5152
5253static const char * test_filename = "/sdcard/hello.txt" ;
53- static const char * test_filename_utf_8 = "/sdcard/测试文件.txt" ;
5454
55- TEST_CASE ("Mount fails cleanly without card inserted" , "[fatfs][ignore]" )
55+ TEST_CASE ("Mount fails cleanly without card inserted" , "[fatfs][sd][ ignore]" )
5656{
5757 size_t heap_size ;
5858 HEAP_SIZE_CAPTURE (heap_size );
@@ -64,22 +64,22 @@ TEST_CASE("Mount fails cleanly without card inserted", "[fatfs][ignore]")
6464 };
6565
6666 for (int i = 0 ; i < 3 ; ++ i ) {
67- printf ("Initializing card, attempt %d " , i );
67+ printf ("Initializing card, attempt %d\n " , i );
6868 esp_err_t err = esp_vfs_fat_sdmmc_mount ("/sdcard" , & host , & slot_config , & mount_config , NULL );
69- printf (" err=%d\n" , err );
70- TEST_ESP_ERR (ESP_FAIL , err );
69+ printf ("err=%d\n" , err );
70+ TEST_ESP_ERR (ESP_ERR_TIMEOUT , err );
7171 }
7272 HEAP_SIZE_CHECK (heap_size , 0 );
7373}
7474
75- TEST_CASE ("(SD) can create and write file" , "[fatfs][sdcard][ignore ]" )
75+ TEST_CASE ("(SD) can create and write file" , "[fatfs][sd][test_env=UT_T1_SDMODE ]" )
7676{
7777 test_setup ();
7878 test_fatfs_create_file_with_text (test_filename , fatfs_test_hello_str );
7979 test_teardown ();
8080}
8181
82- TEST_CASE ("(SD) can read file" , "[fatfs][ignore ]" )
82+ TEST_CASE ("(SD) can read file" , "[fatfs][test_env=UT_T1_SDMODE ]" )
8383{
8484 test_setup ();
8585 test_fatfs_create_file_with_text (test_filename , fatfs_test_hello_str );
@@ -88,64 +88,64 @@ TEST_CASE("(SD) can read file", "[fatfs][ignore]")
8888}
8989
9090
91- TEST_CASE ("(SD) overwrite and append file" , "[fatfs][sdcard][ignore ]" )
91+ TEST_CASE ("(SD) overwrite and append file" , "[fatfs][sd][test_env=UT_T1_SDMODE ]" )
9292{
9393 test_setup ();
9494 test_fatfs_overwrite_append (test_filename );
9595 test_teardown ();
9696}
9797
9898
99- TEST_CASE ("(SD) can lseek" , "[fatfs][sdcard][ignore ]" )
99+ TEST_CASE ("(SD) can lseek" , "[fatfs][sd][test_env=UT_T1_SDMODE ]" )
100100{
101101 test_setup ();
102102 test_fatfs_lseek ("/sdcard/seek.txt" );
103103 test_teardown ();
104104}
105105
106- TEST_CASE ("(SD) stat returns correct values" , "[fatfs][ignore ]" )
106+ TEST_CASE ("(SD) stat returns correct values" , "[fatfs][test_env=UT_T1_SDMODE ]" )
107107{
108108 test_setup ();
109109 test_fatfs_stat ("/sdcard/stat.txt" , "/sdcard" );
110110 test_teardown ();
111111}
112112
113- TEST_CASE ("(SD) unlink removes a file" , "[fatfs][ignore ]" )
113+ TEST_CASE ("(SD) unlink removes a file" , "[fatfs][test_env=UT_T1_SDMODE ]" )
114114{
115115 test_setup ();
116116 test_fatfs_unlink ("/sdcard/unlink.txt" );
117117 test_teardown ();
118118}
119119
120- TEST_CASE ("(SD) link copies a file, rename moves a file" , "[fatfs][ignore ]" )
120+ TEST_CASE ("(SD) link copies a file, rename moves a file" , "[fatfs][test_env=UT_T1_SDMODE ]" )
121121{
122122 test_setup ();
123123 test_fatfs_link_rename ("/sdcard/link" );
124124 test_teardown ();
125125}
126126
127- TEST_CASE ("(SD) can create and remove directories" , "[fatfs][ignore ]" )
127+ TEST_CASE ("(SD) can create and remove directories" , "[fatfs][test_env=UT_T1_SDMODE ]" )
128128{
129129 test_setup ();
130130 test_fatfs_mkdir_rmdir ("/sdcard/dir" );
131131 test_teardown ();
132132}
133133
134- TEST_CASE ("(SD) can opendir root directory of FS" , "[fatfs][ignore ]" )
134+ TEST_CASE ("(SD) can opendir root directory of FS" , "[fatfs][test_env=UT_T1_SDMODE ]" )
135135{
136136 test_setup ();
137137 test_fatfs_can_opendir ("/sdcard" );
138138 test_teardown ();
139139}
140140
141- TEST_CASE ("(SD) opendir, readdir, rewinddir, seekdir work as expected" , "[fatfs][ignore ]" )
141+ TEST_CASE ("(SD) opendir, readdir, rewinddir, seekdir work as expected" , "[fatfs][test_env=UT_T1_SDMODE ]" )
142142{
143143 test_setup ();
144144 test_fatfs_opendir_readdir_rewinddir ("/sdcard/dir" );
145145 test_teardown ();
146146}
147147
148- TEST_CASE ("(SD) multiple tasks can use same volume" , "[fatfs][ignore ]" )
148+ TEST_CASE ("(SD) multiple tasks can use same volume" , "[fatfs][test_env=UT_T1_SDMODE ]" )
149149{
150150 test_setup ();
151151 test_fatfs_concurrent ("/sdcard/f" );
@@ -154,7 +154,7 @@ TEST_CASE("(SD) multiple tasks can use same volume", "[fatfs][ignore]")
154154
155155static void speed_test (void * buf , size_t buf_size , size_t file_size , bool write );
156156
157- TEST_CASE ("(SD) write/read speed test" , "[fatfs][sdcard][ignore ]" )
157+ TEST_CASE ("(SD) write/read speed test" , "[fatfs][sd][test_env=UT_T1_SDMODE ]" )
158158{
159159 size_t heap_size ;
160160 HEAP_SIZE_CAPTURE (heap_size );
@@ -164,7 +164,7 @@ TEST_CASE("(SD) write/read speed test", "[fatfs][sdcard][ignore]")
164164 for (size_t i = 0 ; i < buf_size / 4 ; ++ i ) {
165165 buf [i ] = esp_random ();
166166 }
167- const size_t file_size = 4 * 1024 * 1024 ;
167+ const size_t file_size = 1 * 1024 * 1024 ;
168168
169169 speed_test (buf , 4 * 1024 , file_size , true);
170170 speed_test (buf , 8 * 1024 , file_size , true);
@@ -196,7 +196,7 @@ static void speed_test(void* buf, size_t buf_size, size_t file_size, bool write)
196196 TEST_ESP_OK (esp_vfs_fat_sdmmc_unmount ());
197197}
198198
199- TEST_CASE ("(SD) mount two FAT partitions, SDMMC and WL, at the same time" , "[fatfs][sdcard][ignore ]" )
199+ TEST_CASE ("(SD) mount two FAT partitions, SDMMC and WL, at the same time" , "[fatfs][sd][test_env=UT_T1_SDMODE ]" )
200200{
201201 esp_vfs_fat_sdmmc_mount_config_t mount_config = {
202202 .format_if_mount_failed = true,
@@ -247,7 +247,10 @@ TEST_CASE("(SD) mount two FAT partitions, SDMMC and WL, at the same time", "[fat
247247 * Ensure that the text editor is UTF-8 compatible when compiling these tests.
248248 */
249249#if defined(CONFIG_FATFS_API_ENCODING_UTF_8 ) && (CONFIG_FATFS_CODEPAGE == 936 )
250- TEST_CASE ("(SD) can read file using UTF-8 encoded strings" , "[fatfs][ignore]" )
250+
251+ static const char * test_filename_utf_8 = "/sdcard/测试文件.txt" ;
252+
253+ TEST_CASE ("(SD) can read file using UTF-8 encoded strings" , "[fatfs][sd][test_env=UT_T1_SDMODE]" )
251254{
252255 test_setup ();
253256 test_fatfs_create_file_with_text (test_filename_utf_8 , fatfs_test_hello_str_utf );
@@ -261,4 +264,4 @@ TEST_CASE("(SD) opendir, readdir, rewinddir, seekdir work as expected using UTF-
261264 test_fatfs_opendir_readdir_rewinddir_utf_8 ("/sdcard/目录" );
262265 test_teardown ();
263266}
264- #endif
267+ #endif // CONFIG_FATFS_API_ENCODING_UTF_8 && CONFIG_FATFS_CODEPAGE == 936
0 commit comments