Before:
If an entry is found, lfs_dir_read returns 1
If at end of directory, lfs_dir_read returns 0
After:
If an entry is found, lfs_dir_read returns 0
If at end of directory, lfs_dir_read returns LFS_ERR_NOENT
---
lfs_dir_read is a bit of an odd function. It's supposed to match
lfs_file_read, but instead of reading bytes, it reads directory
entries.
Its POSIX equivalent, readdir, indicates whether or not we reached
the end of the directory by returning a NULL pointer:
struct dirent *readdir(DIR *dirp);
But this API needed to change for littlefs, since we don't use errno,
instead returning errors as signed integers through all API functions,
including lfs_dir_read. So, in an effort to match lfs_file_read,
lfs_dir_read returned the "number" of directory entries read, limited
to either 0 or 1.
Perhaps unsurprisingly, this turned out to be confusing to users,
and a better API was proposed hathach to instead return either 0
or LFS_ERR_NOENT, an error which can't occur for other reasons in
lfs_dir_read.
Suggested by hathach
Moved .travis.yml over to use the new test framework. A part of this
involved testing all of the configurations ran on the old framework
and deciding which to carry over. The new framework duplicates some of
the cases tested by the configurations so some configurations could be
dropped.
The .travis.yml includes some extreme ones, such as no inline files,
relocations every cycle, no intrinsics, power-loss every byte, unaligned
block_count and lookahead, and odd read_sizes.
There were several configurations were some tests failed because of
limitations in the tests themselves, so many conditions were added
to make sure the configurations can run on as many tests as possible.
- Removed old tests and test scripts
- Reorganize the block devices to live under one directory
- Plugged new test framework into Makefile
renamed:
- scripts/test_.py -> scripts/test.py
- tests_ -> tests
- {file,ram,test}bd/* -> bd/*
It took a surprising amount of effort to make the Makefile behave since
it turns out the "test_%" rule could override "tests/test_%.toml.test"
which is generated as part of test.py.