Merge branch 'feature/ut-fatfs-not-ignore-leading-spaces' into 'master'

fatfs/unittest: fatfs ignores leading spaces

Closes IDF-5896

See merge request espressif/esp-idf!20152
This commit is contained in:
Martin Vychodil 2022-09-30 14:38:56 +08:00
commit 27601eed24
3 changed files with 22 additions and 0 deletions

View File

@ -891,6 +891,15 @@ void test_fatfs_concurrent(const char* filename_prefix)
vSemaphoreDelete(args4.done);
}
void test_leading_spaces(void){
// fatfs should ignore leading and trailing whitespaces
// and files "/spiflash/ thelongfile.txt " and "/spiflash/thelongfile.txt" should be equivalent
// this feature is currently not implemented
FILE* f = fopen( "/spiflash/ thelongfile.txt ", "wb");
fclose(f);
TEST_ASSERT_NULL(fopen("/spiflash/thelongfile.txt", "r"));
}
void test_fatfs_rw_speed(const char* filename, void* buf, size_t buf_size, size_t file_size, bool is_write)
{
const size_t buf_count = file_size / buf_size;

View File

@ -65,6 +65,8 @@ void test_fatfs_opendir_readdir_rewinddir(const char* dir_prefix);
void test_fatfs_opendir_readdir_rewinddir_utf_8(const char* dir_prefix);
void test_leading_spaces(void);
void test_fatfs_rw_speed(const char* filename, void* buf, size_t buf_size, size_t file_size, bool write);
void test_fatfs_info(const char* base_path, const char* filepath);

View File

@ -176,6 +176,17 @@ TEST_CASE("(WL) multiple tasks can use same volume", "[fatfs][wear_levelling]")
test_teardown();
}
TEST_CASE("(WL) fatfs does not ignore leading spaces", "[fatfs][wear_levelling]")
{
// the functionality of ignoring leading and trailing whitespaces is not implemented yet
// when the feature is implemented, this test will fail
// please, remove the test and implement the functionality in fatfsgen.py to preserve the consistency
test_setup();
test_leading_spaces();
test_teardown();
}
TEST_CASE("(WL) write/read speed test", "[fatfs][wear_levelling][timeout=60]")
{
/* Erase partition before running the test to get consistent results */