Commit Graph

53 Commits

Author SHA1 Message Date
Ivan Grokhotkov
507e273e1d fatfs: fix incorrect mtime returned for files created during DST
mktime function uses tm_isdst member as an indicator whether the time
stamp is expected to be in daylight saving time (1) or not (0).
FAT filesystem uses local time as mtime, so no information about DST
is available from the filesystem.

According to mktime documentation, tm_isdst can be set to -1, in which
case the C library will try to determine if DST was or wasn't in
effect at that time, and will set UTC time accordingly.

Note that the conversion from UTC to local time and then back to UTC
(time_t -> localtime_r -> FAT timestamp -> mktime -> time_t) does not
always recover the same UTC time. In particular, the local time in the
hour before DST comes into effect can be interpreted as "before DST"
or "after DST", which would correspond to different UTC values. In
this case which option the C library chooses is undefined.

Closes https://github.com/espressif/esp-idf/issues/9039
Originally reported in https://github.com/espressif/arduino-esp32/issues/6786
2022-06-09 22:02:46 +02:00
Vamshi Gajjela
ebb9cc3670 fatfs: Add ftruncate api support for VFS and FAT-VFS
Unit test cases added to verify ftruncate within fatfs tests.

Closes https://github.com/espressif/esp-idf/issues/8279
2022-05-02 04:37:56 +00:00
Matus Fabo
e64ae67888 fix: pin definitions for other boards
fix: re-enabled fatfs r/w test on sdspi
fix: copyright notice
add: pin definitions for esp32c3
fix: Changed fixed spi dma channel to a macro definition
2022-01-27 12:06:41 +01:00
Adam Múdry
4a6cc1d2a4 vfs/fatfs: fix failed tests by increasing timeout
Default 30s timeout is too low for a case when SD card formatting is triggered,
which could lead to tests failure. Timeout of tests is now set to 60s.

JIRA IDFCI-742
2021-08-25 19:04:34 +08:00
Marius Vikhammer
79b5dedeb1 CI: minor testcases fixes and disable some cases that cant run on S3 2021-06-15 13:39:48 +08:00
Armando
9b9ea71ff9 spi: remove HSPI macro on esp32c3 and esp32s3 2021-04-06 13:42:49 +08:00
morris
e9c131e174 fatfs: return EINVAL if truncate length is less than 0 2021-01-13 19:11:48 +08:00
Marius Vikhammer
9c8e4fd4c5 C3: build and run unit tests
Enable building and running of unit tests in CI for C3 as well as fix
related compile errors

Also enables building of C3 test apps
2021-01-11 11:34:37 +08:00
Angus Gratton
6ce34a227e Merge branch 'feature/fatfs_fast_seek' into 'master'
feature/fatfs: enable the usage of fast-seek algorithm

See merge request espressif/esp-idf!9916
2020-11-17 07:17:31 +08:00
Angus Gratton
66fb5a29bb Whitespace: Automated whitespace fixes (large commit)
Apply the pre-commit hook whitespace fixes to all files in the repo.

(Line endings, blank lines at end of file, trailing whitespace)
2020-11-11 07:36:35 +00:00
Felipe Neves
93ffc009ef vfs: restrict the fast seek for read-only files
Since the files under fast-seek cannot be expanded with further writes, it does not
make sense to enable fast-seek which may fail in write-mode files
2020-11-05 17:01:50 -03:00
Michael (XIAO Xufeng)
1966f00f0b soc: updates caps usage
We should define caps as 1 if true. When use the caps macros, #if and
 #if ! should be used instead of #ifdef/#ifndef.
2020-10-17 16:10:17 +08:00
Ivan Grokhotkov
c330def25a fatfs: fix SPIRAM allocation not used due to Kconfig option name error
Closes https://github.com/espressif/esp-idf/issues/5756
2020-09-14 18:30:31 +02:00
Jakob Hasse
20c068ef3b cmock: added cmock as component
* changing dependencies from unity->cmock
* added component.mk and Makefile.projbuild
* ignore test dir in gen_esp_err_to_name.py
* added some brief introduction of CMock in IDF
2020-09-02 16:38:37 +08:00
morris
2917651478 esp_rom: extract common ets apis into esp_rom_sys.h 2020-07-27 15:27:01 +08:00
Renz Bagaporo
3d0967a58a test: declare requirements and include dirs private 2020-03-23 10:58:50 +08:00
michael
d16ad4a67a ci: disable case witout runners 2020-02-15 18:28:25 +08:00
Michael (XIAO Xufeng)
067f3d21c9 sdspi, vfs_fat: allow sharing SPI bus among devices, and mounting multiple SD cards 2020-02-12 15:16:08 +08:00
michael
4220752aed ut: Move tests back from "esp32" subfolder
DISABLED_FOR_TARGETS macros are used

Partly revert "ci: disable unavailable tests for esp32s2beta"

This partly reverts commit 76a3a5fb48.

Partly revert "ci: disable UTs for esp32s2beta without runners"

This partly reverts commit eb158e9a22.

Partly revert "fix unit test and examples for s2beta"

This partly reverts commit 9baa7826be.

Partly revert "efuse: Add support for esp32s2beta"

This partly reverts commit db84ba868c.
2020-01-06 17:13:53 +08:00
Ivan Grokhotkov
28b7f11f93 fatfs: fix unit tests not included in the build
Regression from 9baa7826.
2019-11-15 15:04:57 +01:00
Michael (XIAO Xufeng)
9baa7826be fix unit test and examples for s2beta 2019-09-04 10:53:25 +10:00
Anton Maklakov
afbaf74007 tools: Mass fixing of empty prototypes (for -Wstrict-prototypes) 2019-08-01 16:28:56 +07:00
Roland Dobai
41062bea99 VFS: Implement pread() and pwrite()
Closes https://github.com/espressif/esp-idf/issues/3515
2019-07-11 06:20:21 +00:00
Ivan Grokhotkov
dbe3221969 fatfs: reduce rawflash tests run time
Don't flash fatfs.img on every test run. Comparing the content is
faster than flashing.
2019-06-25 23:07:07 +08:00
Ivan Grokhotkov
e181a40c9f fatfs: separate IDF-specific files from the original FatFS code
This is a breaking change: applications which used diskio.h to
call ff_diskio_register, will now need to include diskio_impl.h.
Including diskio.h will include the original diskio.h header from
FatFS library.
2019-06-25 23:05:16 +08:00
Renz Christian Bagaporo
9eccd7c082 components: use new component registration api 2019-06-21 19:53:29 +08:00
Ivan Grokhotkov
bb4f5617ab test: clean up "leaks" tags from most unit tests 2019-04-16 20:07:40 +08:00
Konstantin Kondrashov
5021129e71 Add support a [leaks] tag for UT 2019-04-12 09:31:23 +08:00
Ivan Grokhotkov
5339c56bc5 fatfs: bypass newlib buffering in performance test 2019-01-05 14:13:49 +08:00
Ivan Grokhotkov
6091021e83 unity: separate common and IDF specific functionality
New unity component can be used for testing other applications.
Upstream version of Unity is included as a submodule.
Utilities specific to ESP-IDF unit tests (partitions, leak checking
setup/teardown functions, etc) are kept only in unit-test-app.
Kconfig options are added to allow disabling certain Unity features.
2018-11-19 12:36:31 +08:00
Roland Dobai
fb334baa7c VFS: Implement utime() 2018-11-05 09:54:01 +01:00
Renz Bagaporo
cc774111bf cmake: Add support for test build 2018-10-20 12:07:24 +08:00
Angus Gratton
83a179abb0 esp32: Add esp_fill_random() function
Convenience function to fill a buffer with random bytes.

Add some unit tests (only sanity checks, really.)
2018-09-03 04:39:45 +00:00
Dmitry
76ee450c3d Erase flash before the first use added.
Пожалуйста, введите сообщение коммита для ваших изменений. Строки,
2018-07-31 08:45:43 +03:00
Sagar Bijwe
fd7b794e81 FATFS support without wear levelling
This change allows readonly FATFS to be mounted without wear levelling
support. This will provide the customers a simple way to mount FATFS images
generated on host and flashed onto the chip during factory provisioning.
Since NVS encryption is not supported yet and NVS entry size is limited,
the change will provide an easy alternative for securing the provisioning data
by just marking FATFS parition as encrypted.
2018-06-16 16:02:35 +08:00
Renz Bagaporo
ea711f2ee9 vfs, fatfs: Add file truncate for fatfs 2018-06-14 06:37:21 +08:00
Angus Gratton
e8525396dd test: Allow per-unit-test timeouts
Work around for "(WL) write/read speed test" taking >30s in some configs
2018-05-21 12:27:10 +00:00
Ivan Grokhotkov
cbd7431d94 fatfs/test: increase stack size in read-write unit test
2048 byte stack was not sufficient when some error was logged by SD
card driver, leading to stack overflows.
2018-04-18 14:35:21 +08:00
Roland Dobai
744c2dcdd9 Resolve problems found by enabling -Wwrite-strings compilation flag 2018-04-10 08:53:43 +02:00
Ivan Grokhotkov
d6b1d0bb3d fatfs/test: enable tests on SD card 2018-04-02 10:57:45 +08:00
Ivan Grokhotkov
e20e64ace9 fatfs/test: use 16k cluster size to speed up formatting 2018-03-30 18:49:42 +08:00
Darian Leung
99b8ae34c9 fatfs/add menuconfig options for different encodings
This commit adds character encoding configurations in for the fatfs component.
The FF_LFN_UNICODE definition in ffconf.h can now be changed to accept UTF-8 or
UTF-16 encoded filernames. Test cases using UTF-8 encoded file paths and names in
FatFs have also been added.

Closes #1183
2018-03-23 14:06:56 +08:00
Ivan Grokhotkov
59859fa53c fatfs: add configuration of allocation unit size
Closes https://github.com/espressif/esp-idf/issues/1382.
2018-02-11 13:03:36 +08:00
Ivan Grokhotkov
a63ace15bd vfs/fatfs: fix stat call failing when called for mount point
FATFS does not support f_stat call for drive root. When handling stat
for drive root, don't call f_stat and just return struct st with S_IFDIR
flag set.

Closes #984
2017-12-08 20:04:27 +08:00
Ivan Grokhotkov
cc67500d3e unit test: adapt tests to single core configuration 2017-10-19 21:35:21 +08:00
Ivan Grokhotkov
24c4bc9cc4 fatfs: fix duplicate unit test name 2017-06-23 14:59:21 +08:00
Ivan Grokhotkov
2ccfe3da96 vfs: fix opendir of a filesystem root directory
Previously opendir("/data") would fail if filesystem with "data" prefix
was registered in VFS, while opendir("/data/") would succeed.
This change fixes handling for the former case and adds relevant tests.
2017-06-21 01:21:14 +08:00
Ivan Grokhotkov
53d5c5f668 vfs, fatfs: fix support for two FATFS instances (SD and flash)
- fix null pointer dereference in VFS when VFS implementations are added
  and removed in different order

- vfs_fat_sdmmc, vfs_fat_spiflash: pass correct drive to mkfs
  (previously it would always do mkfs in the first drive)

- add test case
2017-05-05 15:21:38 +08:00
Ivan Grokhotkov
4e3ea66ec4 fatfs: run same fatfs tests for WL and SDMMC
This change moves actual test code into test_fatfs_common.c and
refactors setup/teardown code to be contained within separate functions.
For each SDMMC FATFS test, identical test is added which can run with
WL partition in flash.
2017-05-05 15:21:38 +08:00
Ivan Grokhotkov
c17e05040a vfs_fat_sdmmc: if card init fails, fail cleanly
This fixes the issue with sdmmc_host not returned to clean state after
a failed attempt to mount the card, with no SD card in the slot.
2017-02-24 21:04:22 +08:00