Skip to content

Commit 451c3d1

Browse files
committed
Squashed 'features/filesystem/littlefs/littlefs/' changes from 5ee20e8..b2124a5
b2124a5 Fixed multiple deploy steps in Travis 949015a Merge pull request #28 from geky/configurables 67daf9e Added cross-compile targets for testing a3fd2d4 Added more configurable utils a0a55fb Added conversion to/from little-endian on disk 4f08424 Added software implementations of bitwise instructions 59ce49f Merge pull request #26 from Sim4n6/master 2f8ae34 Added a git ignore file with .o .d blocks dir and lfs bin e611cf5 Fix incorrect lookahead population before ack a25743a Fixed some minor error code differences 6716b55 Fixed error check when truncating files to larger size 809ffde Merge pull request #24 from aldot/silence-shadow-warnings-1 dc513b1 Silenced more of aldot's warnings aa50e03 Commentary typo fix 6d55755 tests: Silence warnings in template 029361e Silence shadow warnings fd04ed4 Added autogenerated release notes from commits 3101bc9 Do not print command invocation if QUIET d82e34c Merge pull request #21 from aldot/doc-tweaks 436707c doc: Editorial tweaks 3457252 doc: Spelling fixes 6d8e0e2 Moved -Werror flag to CI only 88f678f Fixed self-assign warning in tests 3ef4847 Added remove step in tests to force rebuild f694b14 Merge pull request #16 from geky/versioning 5a38d00 Added deploy step in Travis to push new version as tags 035552a Add version info for software library and on-disk structures 997c2e5 Fixed incorrect reliance on errno in emubd d88f0ac Added lfs_file_truncate 2ad435e Added files test to littlefs-fuse tests in Travis 1fb6a19 Reduced ctz traverse runtime by 2x db88727 Added error code LFS_ERR_NOTEMPTY c2fab8f Added asserts on geometry and updated config documentation 472ccc4 Fixed file truncation without writes aea3d3d Fixed positive seek bounds checking be22d34 Updated links to Mbed OS 425aa3c Fixed issue with immediate exhaustion and small unaligned storage git-subtree-dir: features/filesystem/littlefs/littlefs git-subtree-split: b2124a5
1 parent b28dad6 commit 451c3d1

17 files changed

+949
-244
lines changed

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Compilation output
2+
*.o
3+
*.d
4+
*.a
5+
6+
# Testing things
7+
blocks/
8+
lfs
9+
test.c

.travis.yml

Lines changed: 207 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,223 @@
1+
# Environment variables
2+
env:
3+
global:
4+
- CFLAGS=-Werror
5+
6+
# Common test script
17
script:
2-
# make sure example can at least compile
3-
- sed -n '/``` c/,/```/{/```/d; p;}' README.md > test.c &&
4-
CFLAGS='
8+
# make sure example can at least compile
9+
- sed -n '/``` c/,/```/{/```/d; p;}' README.md > test.c &&
10+
make all CFLAGS+="
511
-Duser_provided_block_device_read=NULL
612
-Duser_provided_block_device_prog=NULL
713
-Duser_provided_block_device_erase=NULL
814
-Duser_provided_block_device_sync=NULL
9-
-include stdio.h -Werror' make all size
15+
-include stdio.h"
16+
17+
# run tests
18+
- make test QUIET=1
19+
20+
# run tests with a few different configurations
21+
- make test QUIET=1 CFLAGS+="-DLFS_READ_SIZE=1 -DLFS_PROG_SIZE=1"
22+
- make test QUIET=1 CFLAGS+="-DLFS_READ_SIZE=512 -DLFS_PROG_SIZE=512"
23+
- make test QUIET=1 CFLAGS+="-DLFS_BLOCK_COUNT=1023 -DLFS_LOOKAHEAD=2048"
24+
25+
- make clean test QUIET=1 CFLAGS+="-DLFS_NO_INTRINSICS"
26+
27+
# compile and find the code size with the smallest configuration
28+
- make clean size
29+
OBJ="$(ls lfs*.o | tr '\n' ' ')"
30+
CFLAGS+="-DLFS_NO{ASSERT,DEBUG,WARN,ERROR}"
31+
| tee sizes
32+
33+
# update status if we succeeded, compare with master if possible
34+
- |
35+
if [ "$TRAVIS_TEST_RESULT" -eq 0 ]
36+
then
37+
CURR=$(tail -n1 sizes | awk '{print $1}')
38+
PREV=$(curl https://api.github.com/repos/$TRAVIS_REPO_SLUG/status/master \
39+
| jq -re "select(.sha != \"$TRAVIS_COMMIT\")
40+
| .statuses[] | select(.context == \"$STAGE/$NAME\").description
41+
| capture(\"code size is (?<size>[0-9]+)\").size" \
42+
|| echo 0)
1043
11-
# run tests
12-
- make test QUIET=1
44+
STATUS="Passed, code size is ${CURR}B"
45+
if [ "$PREV" -ne 0 ]
46+
then
47+
STATUS="$STATUS ($(python -c "print '%+.2f' % (100*($CURR-$PREV)/$PREV.0)")%)"
48+
fi
49+
fi
1350
14-
# run tests with a few different configurations
15-
- CFLAGS="-DLFS_READ_SIZE=1 -DLFS_PROG_SIZE=1" make test QUIET=1
16-
- CFLAGS="-DLFS_READ_SIZE=512 -DLFS_PROG_SIZE=512" make test QUIET=1
17-
- CFLAGS="-DLFS_BLOCK_COUNT=1023" make test QUIET=1
18-
- CFLAGS="-DLFS_LOOKAHEAD=2048" make test QUIET=1
51+
# CI matrix
52+
jobs:
53+
include:
54+
# native testing
55+
- stage: test
56+
env:
57+
- STAGE=test
58+
- NAME=littlefs-x86
59+
60+
# cross-compile with ARM (thumb mode)
61+
- stage: test
62+
env:
63+
- STAGE=test
64+
- NAME=littlefs-arm
65+
- CC="arm-linux-gnueabi-gcc --static -mthumb"
66+
- EXEC="qemu-arm"
67+
install:
68+
- sudo apt-get install gcc-arm-linux-gnueabi qemu-user
69+
- arm-linux-gnueabi-gcc --version
70+
- qemu-arm -version
71+
72+
# cross-compile with PowerPC
73+
- stage: test
74+
env:
75+
- STAGE=test
76+
- NAME=littlefs-powerpc
77+
- CC="powerpc-linux-gnu-gcc --static"
78+
- EXEC="qemu-ppc"
79+
install:
80+
- sudo apt-get install gcc-powerpc-linux-gnu qemu-user
81+
- powerpc-linux-gnu-gcc --version
82+
- qemu-ppc -version
83+
84+
# cross-compile with MIPS
85+
- stage: test
86+
env:
87+
- STAGE=test
88+
- NAME=littlefs-mips
89+
- CC="mips-linux-gnu-gcc --static"
90+
- EXEC="qemu-mips"
91+
install:
92+
- sudo add-apt-repository -y "deb http://archive.ubuntu.com/ubuntu/ xenial main universe"
93+
- sudo apt-get -qq update
94+
- sudo apt-get install gcc-mips-linux-gnu qemu-user
95+
- mips-linux-gnu-gcc --version
96+
- qemu-mips -version
1997

2098
# self-host with littlefs-fuse for fuzz test
21-
- make -C littlefs-fuse
99+
- stage: test
100+
env:
101+
- STAGE=test
102+
- NAME=littlefs-fuse
103+
install:
104+
- sudo apt-get install libfuse-dev
105+
- git clone --depth 1 https://github.com/geky/littlefs-fuse
106+
- fusermount -V
107+
- gcc --version
108+
before_script:
109+
# setup disk for littlefs-fuse
110+
- rm -rf littlefs-fuse/littlefs/*
111+
- cp -r $(git ls-tree --name-only HEAD) littlefs-fuse/littlefs
112+
113+
- mkdir mount
114+
- sudo chmod a+rw /dev/loop0
115+
- dd if=/dev/zero bs=512 count=2048 of=disk
116+
- losetup /dev/loop0 disk
117+
script:
118+
# self-host test
119+
- make -C littlefs-fuse
120+
121+
- littlefs-fuse/lfs --format /dev/loop0
122+
- littlefs-fuse/lfs /dev/loop0 mount
22123

23-
- littlefs-fuse/lfs --format /dev/loop0
24-
- littlefs-fuse/lfs /dev/loop0 mount
124+
- ls mount
125+
- mkdir mount/littlefs
126+
- cp -r $(git ls-tree --name-only HEAD) mount/littlefs
127+
- cd mount/littlefs
128+
- ls
129+
- make -B test_dirs test_files QUIET=1
25130

26-
- ls mount
27-
- mkdir mount/littlefs
28-
- cp -r $(git ls-tree --name-only HEAD) mount/littlefs
29-
- cd mount/littlefs
30-
- ls
31-
- make -B test_dirs QUIET=1
131+
# Automatically update releases
132+
- stage: deploy
133+
env:
134+
- STAGE=deploy
135+
- NAME=deploy
136+
script:
137+
# Update tag for version defined in lfs.h
138+
- LFS_VERSION=$(grep -ox '#define LFS_VERSION .*' lfs.h | cut -d ' ' -f3)
139+
- LFS_VERSION_MAJOR=$((0xffff & ($LFS_VERSION >> 16)))
140+
- LFS_VERSION_MINOR=$((0xffff & ($LFS_VERSION >> 0)))
141+
- LFS_VERSION="v$LFS_VERSION_MAJOR.$LFS_VERSION_MINOR"
142+
- echo "littlefs version $LFS_VERSION"
143+
- |
144+
curl -u $GEKY_BOT_RELEASES -X POST \
145+
https://api.github.com/repos/$TRAVIS_REPO_SLUG/git/refs \
146+
-d "{
147+
\"ref\": \"refs/tags/$LFS_VERSION\",
148+
\"sha\": \"$TRAVIS_COMMIT\"
149+
}"
150+
- |
151+
curl -f -u $GEKY_BOT_RELEASES -X PATCH \
152+
https://api.github.com/repos/$TRAVIS_REPO_SLUG/git/refs/tags/$LFS_VERSION \
153+
-d "{
154+
\"sha\": \"$TRAVIS_COMMIT\"
155+
}"
156+
# Create release notes from commits
157+
- LFS_PREV_VERSION="v$LFS_VERSION_MAJOR.$(($LFS_VERSION_MINOR-1))"
158+
- |
159+
if [ $(git tag -l "$LFS_PREV_VERSION") ]
160+
then
161+
curl -u $GEKY_BOT_RELEASES -X POST \
162+
https://api.github.com/repos/$TRAVIS_REPO_SLUG/releases \
163+
-d "{
164+
\"tag_name\": \"$LFS_VERSION\",
165+
\"name\": \"$LFS_VERSION\"
166+
}"
167+
RELEASE=$(
168+
curl -f https://api.github.com/repos/$TRAVIS_REPO_SLUG/releases/tags/$LFS_VERSION
169+
)
170+
CHANGES=$(
171+
git log --oneline $LFS_PREV_VERSION.. --grep='^Merge' --invert-grep
172+
)
173+
curl -f -u $GEKY_BOT_RELEASES -X PATCH \
174+
https://api.github.com/repos/$TRAVIS_REPO_SLUG/releases/$(
175+
jq -r '.id' <<< "$RELEASE"
176+
) \
177+
-d "$(
178+
jq -s '{
179+
"body": ((.[0] // "" | sub("(?<=\n)#+ Changes.*"; ""; "mi"))
180+
+ "### Changes\n\n" + .[1])
181+
}' <(jq '.body' <<< "$RELEASE") <(jq -sR '.' <<< "$CHANGES")
182+
)"
183+
fi
32184
185+
# Manage statuses
33186
before_install:
34-
- fusermount -V
35-
- gcc --version
187+
- |
188+
curl -u $GEKY_BOT_STATUSES -X POST \
189+
https://api.github.com/repos/$TRAVIS_REPO_SLUG/statuses/${TRAVIS_PULL_REQUEST_SHA:-$TRAVIS_COMMIT} \
190+
-d "{
191+
\"context\": \"$STAGE/$NAME\",
192+
\"state\": \"pending\",
193+
\"description\": \"${STATUS:-In progress}\",
194+
\"target_url\": \"https://travis-ci.org/$TRAVIS_REPO_SLUG/jobs/$TRAVIS_JOB_ID\"
195+
}"
36196
37-
install:
38-
- sudo apt-get install libfuse-dev
39-
- git clone --depth 1 https://github.com/geky/littlefs-fuse
197+
after_failure:
198+
- |
199+
curl -u $GEKY_BOT_STATUSES -X POST \
200+
https://api.github.com/repos/$TRAVIS_REPO_SLUG/statuses/${TRAVIS_PULL_REQUEST_SHA:-$TRAVIS_COMMIT} \
201+
-d "{
202+
\"context\": \"$STAGE/$NAME\",
203+
\"state\": \"failure\",
204+
\"description\": \"${STATUS:-Failed}\",
205+
\"target_url\": \"https://travis-ci.org/$TRAVIS_REPO_SLUG/jobs/$TRAVIS_JOB_ID\"
206+
}"
40207
41-
before_script:
42-
- rm -rf littlefs-fuse/littlefs/*
43-
- cp -r $(git ls-tree --name-only HEAD) littlefs-fuse/littlefs
208+
after_success:
209+
- |
210+
curl -u $GEKY_BOT_STATUSES -X POST \
211+
https://api.github.com/repos/$TRAVIS_REPO_SLUG/statuses/${TRAVIS_PULL_REQUEST_SHA:-$TRAVIS_COMMIT} \
212+
-d "{
213+
\"context\": \"$STAGE/$NAME\",
214+
\"state\": \"success\",
215+
\"description\": \"${STATUS:-Passed}\",
216+
\"target_url\": \"https://travis-ci.org/$TRAVIS_REPO_SLUG/jobs/$TRAVIS_JOB_ID\"
217+
}"
44218
45-
- mkdir mount
46-
- sudo chmod a+rw /dev/loop0
47-
- dd if=/dev/zero bs=512 count=2048 of=disk
48-
- losetup /dev/loop0 disk
219+
# Job control
220+
stages:
221+
- name: test
222+
- name: deploy
223+
if: branch = master

0 commit comments

Comments
 (0)