@@ -35,311 +35,51 @@ before_install:
3535
3636addons :
3737 apt :
38+ sources :
39+ - sourceline : ' deb https://apt.kitware.com/ubuntu/ xenial main'
40+ key_url : ' https://apt.kitware.com/keys/kitware-archive-latest.asc'
41+ - sourceline : ' deb https://apt.kitware.com/ubuntu/ xenial-rc main'
42+ - ubuntu-toolchain-r-test
3843 packages :
39- - ninja-build
44+ - cmake
45+ - ninja-build
46+ - g++-9
4047
4148matrix :
4249 include :
4350
44- # ## Basic Tests ###
45- - &basic-vm
46- stage : " Basic"
47- name : " file attributes"
48- env : NAME=gitattributestest
49- script :
50- - git diff --exit-code
51-
52- - << : *basic-vm
53- name : " license check"
54- env : NAME=licence_check
55- language : python
56- python : 3.6.8 # scancode-toolkit v3.1.1 requires v3.6.8
57- install :
58- # workaround for https://github.com/ARMmbed/mbed-os/issues/13322
59- - pip install pdfminer.six==20200517
60- - pip install scancode-toolkit==3.1.1
61- before_script :
62- - mkdir -p SCANCODE
63- - mkdir -p SCANCODE_NEW_FILES
64- # Fetch remaining information needed for branch comparison
65- - git fetch --all --unshallow --tags
66- - git fetch origin "${TRAVIS_BRANCH}"
67- script :
68- # scancode does not support list of files, only one file or directory
69- # we use SCANCODE directory for all changed files (their copies with full tree)
70- - >-
71- git diff --name-only --diff-filter=ad FETCH_HEAD..HEAD \
72- | ( grep '.\(c\|cpp\|h\|hpp\|py\)$' || true ) \
73- | ( grep -v '^tools/test/toolchains/api_test.py' || true ) \
74- | while read file; do cp --parents "${file}" SCANCODE; done
75- - scancode -l --json-pp scancode.json SCANCODE
76- - python ./tools/test/travis-ci/scancode-evaluate.py scancode.json || true
77- # run the same but for new files. All new files must have SPDX
78- - >-
79- git diff --name-only --diff-filter=A FETCH_HEAD..HEAD \
80- | ( grep '.\(c\|cpp\|h\|hpp\|py\)$' || true ) \
81- | ( grep -v '^tools/test/toolchains/api_test.py' || true ) \
82- | while read file; do cp --parents "${file}" SCANCODE_NEW_FILES; done
83- - scancode -l --json-pp scancode_new_files.json SCANCODE_NEW_FILES
84- - python ./tools/test/travis-ci/scancode-evaluate.py scancode_new_files.json || true
85- - cat scancode-evaluate.log
86- - COUNT=$(cat scancode-evaluate.log | grep 'File:' | grep -v 'SPDX' | wc -l) || true
87- - python ./tools/test/travis-ci/scancode-evaluate.py scancode_new_files.json
88- - cat scancode-evaluate.log
89- - COUNT_NEW_FILES=$(cat scancode-evaluate.log | grep 'File:' | grep -v 'SPDX' | wc -l) || true
90- - |
91- if [ $COUNT == 0 ] && [ $COUNT_NEW_FILES == 0 ]; then
92- echo "License check OK";
93- true;
94- elif [ $COUNT_NEW_FILES != 0 ]; then
95- echo "License check failed, new files with the license issues found";
96- false;
97- else
98- echo "License check failed, please review license issues found in modified files";
99- false;
100- fi
101-
102- - << : *basic-vm
103- name : " include check"
104- env : NAME=include_check
105- script :
106- - |
107- ! git grep '^#include\s["'"']mbed.h['"'"]$' -- '*.c' '*.h' '*.cpp' '*.hpp' \
108- ':!*platform_mbed.h' ':!*TESTS/*' ':!TEST_APPS/' ':!UNITTESTS/' \
109- ':!*tests/*' ':!*targets/*' ':!*TARGET_*' ':!*unsupported/*' \
110- ':!*events/tests/*' ':!*drivers/tests/*'
111-
112- # ## Docs Tests ###
113- - &docs-vm
114- stage : " Docs"
115- name : " astyle"
116- env : NAME=astyle
117- install :
118- - >-
119- curl -L0 https://mbed-os-ci-public.s3-eu-west-1.amazonaws.com/jenkins-ci/deps/astyle_3.1_linux.tar.gz --output astyle.tar.gz;
120- mkdir -p BUILD && tar xf astyle.tar.gz -C BUILD;
121- cd BUILD/astyle/build/gcc;
122- make;
123- export PATH="${PWD}/bin:${PATH}";
124- cd -
125- - astyle --version
126- # Fetch remaining information needed for branch comparison
127- - git fetch --all --unshallow --tags
128- - git fetch origin "${TRAVIS_BRANCH}"
129- script :
130- - >-
131- git diff --name-only --diff-filter=d FETCH_HEAD..HEAD \
132- | ( grep '.*\.\(c\|cpp\|h\|hpp\)$' || true ) \
133- | ( grep -v -f .codecheckignore || true ) \
134- | while read file; do astyle -n --options=.astylerc "${file}"; done
135- - git diff --exit-code --diff-filter=d --color
136-
137- - << : *docs-vm
138- name : " spellcheck"
139- env : NAME=doxy-spellcheck
140- install :
141- - source_pkg aspell
142- script :
143- # TODO: run checks on all directories once all mispellings are fixed
144- - ./tools/test/travis-ci/doxy-spellchecker/spell.sh drivers .codecheckignore
145- - ./tools/test/travis-ci/doxy-spellchecker/spell.sh platform .codecheckignore
146- - ./tools/test/travis-ci/doxy-spellchecker/spell.sh events .codecheckignore
147- - ./tools/test/travis-ci/doxy-spellchecker/spell.sh rtos .codecheckignore
148- - ./tools/test/travis-ci/doxy-spellchecker/spell.sh connectivity/netsocket .codecheckignore
149-
150- - << : *docs-vm
151- name : " doxygen"
152- env : NAME=docs
153- install :
154- # Build doxygen
155- - >
156- (git clone --depth=1 --single-branch --branch Release_1_8_14 https://github.com/doxygen/doxygen;
157- cd doxygen;
158- mkdir build;
159- cd build;
160- cmake -G "Unix Makefiles" ..;
161- make;
162- sudo make install)
163- # Create BUILD directory for tests
164- - ccache -s
165- - mkdir BUILD
166- script :
167- # Assert that the Doxygen build produced no warnings.
168- # The strange command below asserts that the Doxygen command had an
169- # output of zero length
170- - doxygen doxyfile_options 2>&1
171- # Once Mbed OS has been fixed, enable the full test by replacing the top line with this:
172- # - ( ! doxygen doxyfile_options 2>&1 | grep . )
173- # Assert that all binary libraries are named correctly
174- # The strange command below asserts that there are exactly 0 libraries
175- # that do not start with lib
176- - >
177- find "(" -name "*.a" -or -name "*.ar" ")" -and -not -name "lib*" |
178- tee BUILD/badlibs |
179- sed -e "s/^/Bad library name found: /" && [ ! -s BUILD/badlibs ]
180- # Assert that all assembler files are named correctly
181- # The strange command below asserts that there are exactly 0 libraries
182- # that do end with .s
183- - >
184- find -name "*.s" | tee BUILD/badasm |
185- sed -e "s/^/Bad Assembler file name found: /" && [ ! -s BUILD/badasm ]
186-
187- - << : *docs-vm
188- name : " Frozen tools check"
189- env : NAME=frozen_tools_check
190- script :
191- # Reject any changes to tools that would require a re-release of the
192- # tools for the online compiler.
193- - >-
194- frozen_files=`\
195- git diff --name-only --diff-filter=d FETCH_HEAD..HEAD \
196- | egrep \
197- -e "^tools/build_api*" \
198- -e "^tools/config*" \
199- -e "^tools/export*" \
200- -e "^tools/notifier*" \
201- -e "^tools/paths*" \
202- -e "^tools/resources*" \
203- -e "^tools/targets*" \
204- -e "^tools/toolchains*" \
205- -e "^tools/utils*" \
206- -e "^$"`
207- if [ -z "$frozen_files" ]; then
208- echo "Success!";
209- else
210- echo -e "Failure: Frozen files were modified\n$frozen_files";
211- echo -e "Please see https://os.mbed.com/blog/entry/Introducing-the-new-Mbed-Tools/" \
212- "\nfor why we've frozen the legacy tools.";
213- false;
214- fi
215-
216- # ## Python Tests ###
217- - &pytools-vm
218- stage : " Pytest"
219- name : " tools-py27"
220- env : NAME=tools-py2.7
51+ # ## Mbed OS unittest ###
52+ - &cmake-build-run-unittest
53+ stage : " CMake"
54+ name : " CMake unittest build"
55+ env : NAME=cmake_unittest MATRIX_EVAL="CC=gcc-9"
22156 language : python
222- python : 2.7
57+ python : 3.8
22358 install :
224- # Install gcc
225- - source_pkg gcc
226- - arm-none-eabi-gcc --version
227- # Install additional python modules
228- - python --version
229- - |-
230- tr -d ' ' >> requirements.txt <<< "
231- mock==2.0.0
232- attrs==19.1.0
233- pytest==3.3.0
234- pylint>=1.9,<2
235- hypothesis>=3,<4
236- coverage>=4.5,<5
237- "
238- - python -m pip install --upgrade pip==18.1
239- - python -m pip install --upgrade setuptools==40.4.3
240- - pip install -r requirements.txt
241- - pip list --verbose
242- script :
243- # Run local testing on tools
244- - PYTHONPATH=. coverage run -a -m pytest tools/test
245- - python tools/test/pylint.py
246- - coverage run -a tools/project.py -S | sed -n '/^Total/p'
247- - coverage html
248-
249- - << : *pytools-vm
250- name : " tools-py35"
251- env : NAME=tools-py3.5
252- python : 3.5
253-
254- - << : *pytools-vm
255- name : " tools-py36"
256- env : NAME=tools-py3.6
257- python : 3.6
258-
259- - << : *pytools-vm
260- name : " tools-py37"
261- env : NAME=tools-py3.7
262- python : 3.7
263-
264-
265- # ## Extended Tests ###
266- - &extended-vm
267- stage : " Extended"
268- name : " littlefs"
269- env : NAME=littlefs LITTLEFS=storage/filesystem/littlefs
270- language : python
271- python : 3.7
272- install :
273- # Install gcc
274- - source_pkg gcc
275- - arm-none-eabi-gcc --version
276- # Install python modules
277- - python -m pip install --upgrade pip==18.1
278- - python -m pip install --upgrade setuptools==40.4.3
279- - pip install -r requirements.txt
280- - pip list --verbose
281- # Install test-specific packages
282- - source_pkg fuse
283- - source_pkg libfuse-dev
284- - fusermount --version
285- before_script :
286- # Setup and patch littlefs-fuse
287- - git clone https://github.com/armmbed/littlefs-fuse littlefs_fuse
288- - git -C littlefs_fuse checkout 3f1ed6e37799e49e3710830dc6abb926d5503cf2
289- - echo '*' > littlefs_fuse/.mbedignore
290- - rm -rf littlefs_fuse/littlefs/*
291- - cp -r $(git ls-tree --name-only HEAD ${LITTLEFS}/littlefs/) littlefs_fuse/littlefs
292- # Create file-backed disk
293- - mkdir MOUNT
294- - sudo chmod a+rw /dev/loop0
295- - dd if=/dev/zero bs=512 count=2048 of=DISK
296- - losetup /dev/loop0 DISK
297- - CFLAGS="-Werror -Wno-format"
298- script :
299- # Run local littlefs tests
300- - make -C${LITTLEFS}/littlefs test QUIET=1
301- # Run local littlefs tests with set of variations
302- - make -C${LITTLEFS}/littlefs test QUIET=1 CFLAGS+="-DLFS_READ_SIZE=64 -DLFS_PROG_SIZE=64"
303- - make -C${LITTLEFS}/littlefs test QUIET=1 CFLAGS+="-DLFS_READ_SIZE=1 -DLFS_PROG_SIZE=1"
304- - make -C${LITTLEFS}/littlefs test QUIET=1 CFLAGS+="-DLFS_READ_SIZE=512 -DLFS_PROG_SIZE=512"
305- - make -C${LITTLEFS}/littlefs test QUIET=1 CFLAGS+="-DLFS_BLOCK_COUNT=1023 -DLFS_LOOKAHEAD=2048"
306- - make -C${LITTLEFS}/littlefs clean test QUIET=1 CFLAGS+="-DLFS_NO_INTRINSICS"
307- # Self-hosting littlefs fuzz test with littlefs-fuse
308- - make -Clittlefs_fuse
309- - littlefs_fuse/lfs --format /dev/loop0
310- - littlefs_fuse/lfs /dev/loop0 MOUNT
311- - ls MOUNT
312- - mkdir MOUNT/littlefs
313- - cp -r $(git ls-tree --name-only HEAD ${LITTLEFS}/littlefs/) MOUNT/littlefs
314- - ls MOUNT/littlefs
315- - CFLAGS="-Wno-format" make -CMOUNT/littlefs -B test_dirs test_files QUIET=1
316- # Compile and find the code size with smallest configuration
317- - cd ${TRAVIS_BUILD_DIR}/${LITTLEFS}/littlefs
318- - make clean size
319- CC='arm-none-eabi-gcc -mthumb'
320- OBJ="$(ls lfs*.o | tr '\n' ' ')"
321- CFLAGS+="-DLFS_NO_ASSERT -DLFS_NO_DEBUG -DLFS_NO_WARN -DLFS_NO_ERROR"
322- | tee sizes
59+ # Setup ccache
60+ - ccache -o compiler_check=content
61+ - ccache -M 1G
62+ - pushd /usr/lib/ccache
63+ - export PATH="/usr/lib/ccache:$PATH"
64+ - echo $PATH
65+ - which c++
66+ - c++ --version
67+ - ls -l /usr/lib/ccache
68+ - ls -l /usr/lib/ccache/c++
69+ - popd
70+ # Hide Travis-preinstalled CMake
71+ # The Travis-preinstalled CMake is unfortunately not installed via apt, so we
72+ # can't replace it with an apt-supplied version very easily. Additionally, we
73+ # can't permit the Travis-preinstalled copy to survive, as the Travis default
74+ # path lists the Travis CMake install location ahead of any place where apt
75+ # would install CMake to. Instead of apt removing or upgrading to a new CMake
76+ # version, we must instead delete the Travis copy of CMake.
77+ - sudo rm -rf /usr/local/cmake*
78+ script :
79+ - echo ctest --build-and-test . build --build-generator Ninja --build-options -DBUILD_TESTING=ON --test-command ctest
80+ - ctest --build-and-test . build --build-generator Ninja --build-options -DBUILD_TESTING=ON --test-command ctest
32381 - ccache -s
324- - << : extended-pinvalidate
325- stage : " Extended"
326- name : " pinvalidate"
327- env : NAME=pinvalidate
328- language : python
329- python : 3.7
330- install :
331- # Install python modules
332- - python -m pip install --upgrade pip==18.1
333- - python -m pip install --upgrade setuptools==40.4.3
334- - pip install tabulate argparse
335- - pip list --verbose
336- # Fetch remaining information needed for branch comparison
337- - git fetch --all --unshallow --tags
338- - git fetch origin "${TRAVIS_BRANCH}"
339- script :
340- - >-
341- git diff --name-only --diff-filter=d FETCH_HEAD..HEAD \
342- | ( grep '.*[\\|\/]PinNames.h$' || true ) \
343- | while read file; do python ./hal/tests/pinvalidate/pinvalidate.py -vfp "${file}"; done
344- - git diff --exit-code --diff-filter=d --color
34582
83+ - << : *cmake-build-run-unittest
84+ name : " CMake unittest build and run"
85+ env : NAME=cmake_unittest
0 commit comments