mirror of
https://github.com/eledio-devices/thirdparty-littlefs.git
synced 2025-11-01 00:38:29 +01:00
This was a small hole in the logic that handles initializing the lookahead buffer. To imitate exhaustion (so the block allocator will trigger a scan), the lookahead buffer is rewound a full lookahead and set up to look like it is exhausted. However, unlike normal allocation, this rewind was not kept aligned to a multiple of the scan size, which is limited by both the lookahead buffer and the total storage size. This bug went unnoticed for so long because it only causes problems when the block device is both: 1. Not aligned to the lookahead buffer (not a power of 2) 2. Smaller than the lookahead buffer While this seems like a strange corner case for a block device, this turned out to be very common for internal flash, especially when a handleful of blocks are reserved for code.
48 lines
1.4 KiB
YAML
48 lines
1.4 KiB
YAML
script:
|
|
# make sure example can at least compile
|
|
- sed -n '/``` c/,/```/{/```/d; p;}' README.md > test.c &&
|
|
CFLAGS='
|
|
-Duser_provided_block_device_read=NULL
|
|
-Duser_provided_block_device_prog=NULL
|
|
-Duser_provided_block_device_erase=NULL
|
|
-Duser_provided_block_device_sync=NULL
|
|
-include stdio.h -Werror' make all size
|
|
|
|
# run tests
|
|
- make test QUIET=1
|
|
|
|
# run tests with a few different configurations
|
|
- CFLAGS="-DLFS_READ_SIZE=1 -DLFS_PROG_SIZE=1" make test QUIET=1
|
|
- CFLAGS="-DLFS_READ_SIZE=512 -DLFS_PROG_SIZE=512" make test QUIET=1
|
|
- CFLAGS="-DLFS_BLOCK_COUNT=1023 -DLFS_LOOKAHEAD=2048" make test QUIET=1
|
|
|
|
# self-host with littlefs-fuse for fuzz test
|
|
- make -C littlefs-fuse
|
|
|
|
- littlefs-fuse/lfs --format /dev/loop0
|
|
- littlefs-fuse/lfs /dev/loop0 mount
|
|
|
|
- ls mount
|
|
- mkdir mount/littlefs
|
|
- cp -r $(git ls-tree --name-only HEAD) mount/littlefs
|
|
- cd mount/littlefs
|
|
- ls
|
|
- make -B test_dirs QUIET=1
|
|
|
|
before_install:
|
|
- fusermount -V
|
|
- gcc --version
|
|
|
|
install:
|
|
- sudo apt-get install libfuse-dev
|
|
- git clone --depth 1 https://github.com/geky/littlefs-fuse
|
|
|
|
before_script:
|
|
- rm -rf littlefs-fuse/littlefs/*
|
|
- cp -r $(git ls-tree --name-only HEAD) littlefs-fuse/littlefs
|
|
|
|
- mkdir mount
|
|
- sudo chmod a+rw /dev/loop0
|
|
- dd if=/dev/zero bs=512 count=2048 of=disk
|
|
- losetup /dev/loop0 disk
|