test_fatfs_common.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. // Copyright 2015-2017 Espressif Systems (Shanghai) PTE LTD
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. #pragma once
  15. /**
  16. * @file test_fatfs_common.h
  17. * @brief Common routines for FAT-on-SDMMC and FAT-on-WL tests
  18. */
  19. #define HEAP_SIZE_CAPTURE(heap_size) \
  20. heap_size = esp_get_free_heap_size();
  21. #define HEAP_SIZE_CHECK(heap_size, tolerance) \
  22. do {\
  23. size_t final_heap_size = esp_get_free_heap_size(); \
  24. if (final_heap_size < heap_size - tolerance) { \
  25. printf("Initial heap size: %d, final: %d, diff=%d\n", heap_size, final_heap_size, heap_size - final_heap_size); \
  26. } \
  27. } while(0)
  28. const char* fatfs_test_hello_str;
  29. const char* fatfs_test_hello_str_utf;
  30. void test_fatfs_create_file_with_text(const char* name, const char* text);
  31. void test_fatfs_overwrite_append(const char* filename);
  32. void test_fatfs_read_file(const char* filename);
  33. void test_fatfs_read_file_utf_8(const char* filename);
  34. void test_fatfs_pread_file(const char* filename);
  35. void test_fatfs_pwrite_file(const char* filename);
  36. void test_fatfs_open_max_files(const char* filename_prefix, size_t files_count);
  37. void test_fatfs_lseek(const char* filename);
  38. void test_fatfs_truncate_file(const char* path);
  39. void test_fatfs_stat(const char* filename, const char* root_dir);
  40. void test_fatfs_utime(const char* filename, const char* root_dir);
  41. void test_fatfs_unlink(const char* filename);
  42. void test_fatfs_link_rename(const char* filename_prefix);
  43. void test_fatfs_concurrent(const char* filename_prefix);
  44. void test_fatfs_mkdir_rmdir(const char* filename_prefix);
  45. void test_fatfs_can_opendir(const char* path);
  46. void test_fatfs_opendir_readdir_rewinddir(const char* dir_prefix);
  47. void test_fatfs_opendir_readdir_rewinddir_utf_8(const char* dir_prefix);
  48. void test_fatfs_rw_speed(const char* filename, void* buf, size_t buf_size, size_t file_size, bool write);