2018-12-11 09:16:12 +00:00
# Copyright (c) 2013-2018 Arm Limited. All rights reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the License); you may
# not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an AS IS BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
2017-12-19 16:29:04 +00:00
language : python
2018-03-22 20:03:57 +00:00
python : 2.7
2017-11-22 18:42:45 +00:00
2017-11-28 01:49:35 +00:00
env :
global :
- >
2018-02-16 21:47:33 +00:00
STATUS=$'curl -so/dev/null --user "$MBED_BOT" --request POST
2017-11-28 01:49:35 +00:00
https://api.github.com/repos/$TRAVIS_REPO_SLUG/statuses/${TRAVIS_PULL_REQUEST_SHA:-$TRAVIS_COMMIT}
--data @- << DATA\n{
"state": "$0" ,
"description": "$1" ,
2018-02-23 21:56:50 +00:00
"context": "travis-ci/$NAME" ,
2017-11-28 01:49:35 +00:00
"target_url": "https://travis-ci.org/$TRAVIS_REPO_SLUG/jobs/$TRAVIS_JOB_ID"
}\nDATA'
2017-11-22 18:42:45 +00:00
2017-12-08 20:21:26 +00:00
cache :
pip : true
directories :
- $HOME/.cache/apt
2017-12-20 08:22:08 +00:00
- $HOME/gcc-arm-none-eabi-6-2017-q2-update
2017-12-08 20:21:26 +00:00
2016-05-26 09:13:45 +00:00
before_install :
2017-11-28 01:49:35 +00:00
- bash -c "$STATUS" pending "Local $NAME testing is in progress"
# Make sure pipefail
- set -o pipefail
2017-12-08 20:21:26 +00:00
# Setup apt to cache
- mkdir -p $HOME/.cache/apt/partial
- sudo rm -rf /var/cache/apt/archives
- sudo ln -s $HOME/.cache/apt /var/cache/apt/archives
2019-01-04 16:21:17 +00:00
# Setup ppa to make sure arm-none-eabi-gcc is correct version
- sudo add-apt-repository -y ppa:team-gcc-arm-embedded/ppa
- sudo add-apt-repository -y ppa:deadsnakes/ppa
2019-01-08 12:52:08 +00:00
# workaround for https://travis-ci.community/t/then-sudo-apt-get-update-failed-public-key-is-not-available-no-pubkey-6b05f25d762e3157-in-ubuntu-xenial/1728
- sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 762E3157
2018-02-16 21:44:36 +00:00
# Loop until update succeeds (timeouts can occur)
2018-03-22 20:08:21 +00:00
- travis_retry $(! sudo apt-get update 2>&1 |grep Failed)
2017-11-22 18:42:45 +00:00
2017-11-28 01:49:35 +00:00
after_success :
- bash -c "$STATUS" success "Local $NAME testing has passed"
after_failure :
- bash -c "$STATUS" failure "Local $NAME testing has failed"
matrix :
include :
2017-12-19 16:29:04 +00:00
- env :
2017-12-08 21:05:05 +00:00
- NAME=docs
install :
# Install dependencies
- sudo apt-get install doxygen
# Print versions we use
- doxygen --version
before_script :
2018-10-30 16:41:07 +00:00
# Build doxygen
- >
(git clone --depth=1 --single-branch --branch Release_1_8_14 https://github.com/doxygen/doxygen;
cd doxygen;
mkdir build;
cd build;
cmake -G "Unix Makefiles" ..;
make;
sudo make install)
2017-12-08 21:05:05 +00:00
# Create BUILD directory for tests
- mkdir BUILD
script :
# Assert that the Doxygen build produced no warnings.
# The strange command below asserts that the Doxygen command had an
# output of zero length
2018-10-30 16:41:07 +00:00
- doxygen doxyfile_options 2>&1
# Once Mbed OS has been fixed, enable the full test by replacing the top line with this:
2018-10-30 16:45:41 +00:00
# - ( ! doxygen doxyfile_options 2>&1 | grep . )
2017-12-08 21:05:05 +00:00
# Assert that all binary libraries are named correctly
# The strange command below asserts that there are exactly 0 libraries
# that do not start with lib
- >
find "(" -name "*.a" -or -name "*.ar" ")" -and -not -name "lib*" |
tee BUILD/badlibs |
sed -e "s/^/Bad library name found: /" && [ ! -s BUILD/badlibs ]
# Assert that all assebler files are named correctly
# The strange command below asserts that there are exactly 0 libraries
# that do end with .s
- >
find -name "*.s" | tee BUILD/badasm |
sed -e "s/^/Bad Assembler file name found: /" && [ ! -s BUILD/badasm ]
2018-03-22 20:03:57 +00:00
- &tools-pytest
env : NAME=tools-py2.7
python : 2.7
2017-11-28 01:49:35 +00:00
install :
# Install dependencies
2017-12-08 21:05:05 +00:00
- sudo apt-get install gcc-arm-embedded
2017-12-19 16:29:04 +00:00
- pip install -r requirements.txt
2019-01-14 15:42:22 +00:00
- pip install pytest pylint hypothesis==3.88.3 mock coverage coveralls
2017-11-28 01:49:35 +00:00
# Print versions we use
2018-03-22 20:03:57 +00:00
2017-11-28 01:49:35 +00:00
- arm-none-eabi-gcc --version
- python --version
2018-10-16 22:33:56 +00:00
- pip list --verbose
2017-11-28 01:49:35 +00:00
script :
# Run local testing on tools
- PYTHONPATH=. coverage run -a -m pytest tools/test
2018-02-23 21:56:50 +00:00
- python tools/test/pylint.py
2017-11-28 01:49:35 +00:00
- coverage run -a tools/project.py -S | sed -n '/^Total/p'
- coverage html
after_success :
# Coverage for tools
- coveralls
2018-11-30 23:56:11 +00:00
# Report success since we have overridden default behavior
- bash -c "$STATUS" success "Local $NAME testing has passed"
- env :
- NAME=doxy-spellcheck
install :
- sudo apt-get install aspell
script :
# Run local testing on header file doxy
- ./tools/test/travis-ci/doxy-spellchecker/spell.sh drivers
- ./tools/test/travis-ci/doxy-spellchecker/spell.sh platform
- ./tools/test/travis-ci/doxy-spellchecker/spell.sh events
- ./tools/test/travis-ci/doxy-spellchecker/spell.sh rtos
- ./tools/test/travis-ci/doxy-spellchecker/spell.sh features/netsocket
after_success :
# Coverage for tools
- coveralls
# Report success since we have overridden default behavior
2017-11-28 01:49:35 +00:00
- bash -c "$STATUS" success "Local $NAME testing has passed"
2018-03-22 20:03:57 +00:00
# - <<: *tools-pytest
# env: NAME=tools-py3.5
# python: 3.5
#
# - <<: *tools-pytest
# env: NAME=tools-py3.6
# python: 3.6
2018-02-05 13:53:17 +00:00
- env :
- NAME=astyle
install :
2018-12-14 21:34:23 +00:00
- >-
curl -L0 https://mbed-os.s3-eu-west-1.amazonaws.com/builds/deps/astyle_3.1_linux.tar.gz --output astyle.tar.gz;
mkdir -p BUILD && tar xf astyle.tar.gz -C BUILD;
cd BUILD/astyle/build/gcc;
make;
export PATH=$PWD/bin:$PATH;
cd -
- astyle --version
2019-01-11 04:28:51 +00:00
# Fetch remaining information needed for branch comparison
- git fetch --all --unshallow --tags
- git fetch origin "${TRAVIS_BRANCH}"
2018-02-05 13:53:17 +00:00
script :
2018-12-14 21:34:23 +00:00
- >-
2019-01-11 04:28:51 +00:00
git diff --name-only --diff-filter=d FETCH_HEAD..HEAD \
2018-12-14 21:34:23 +00:00
| ( grep '.\(c\|cpp\|h\|hpp\)$' || true ) \
2019-01-06 11:58:17 +00:00
| ( fgrep -v -f .astyleignore || true ) \
2018-12-14 21:34:23 +00:00
| while read file; do astyle -n --options=.astylerc "${file}"; done
2018-12-18 22:04:39 +00:00
- git diff --exit-code --diff-filter=d --color
2018-03-14 18:13:32 +00:00
2017-12-19 16:29:04 +00:00
- env :
2017-11-28 01:49:35 +00:00
- NAME=events
- EVENTS=events
install :
# Install dependencies
- sudo apt-get install gcc-arm-embedded
2017-12-19 16:29:04 +00:00
- pip install -r requirements.txt
2017-11-28 01:49:35 +00:00
# Print versions we use
- arm-none-eabi-gcc --version
- gcc --version
- python --version
script :
# Check that example compiles
- sed -n '/``` cpp/,/```/{/```$/Q;/```/d;p;}' $EVENTS/README.md > main.cpp
- python tools/make.py -t GCC_ARM -m K64F --source=. --build=BUILD/K64F/GCC_ARM -j0
2018-02-15 16:21:10 +00:00
# Check that example compiles without rtos
- sed -n '/``` cpp/,/```/{/```$/Q;/```/d;p;}' $EVENTS/README.md > main.cpp
2018-08-20 08:16:37 +00:00
- rm -r rtos features/cellular features/netsocket features/nanostack features/lwipstack features/frameworks/greentea-client features/frameworks/utest features/frameworks/unity components BUILD
2018-02-15 16:21:10 +00:00
- python tools/make.py -t GCC_ARM -m DISCO_F401VC --source=. --build=BUILD/DISCO_F401VC/GCC_ARM -j0
2017-11-28 01:49:35 +00:00
# Run local equeue tests
- make -C $EVENTS/equeue test
2018-03-15 21:19:04 +00:00
# Run profiling tests
- make -C $EVENTS/equeue prof | tee prof
after_success :
# update status if we succeeded, compare with master if possible
- |
CURR=$(grep -o '[0-9]\+ cycles' prof | awk '{sum += $1} END {print sum}')
2018-04-07 18:04:47 +00:00
PREV=$(curl -u "$MBED_BOT" https://api.github.com/repos/$TRAVIS_REPO_SLUG/status/master \
2018-03-15 21:19:04 +00:00
| jq -re "select(.sha != \"$TRAVIS_COMMIT\")
| .statuses[] | select(.context == \"travis-ci/$NAME\").description
| capture(\"runtime is (?<runtime>[0-9]+)\").runtime" \
|| echo 0)
STATUSM="Passed, runtime is ${CURR} cycles"
if [ "$PREV" -ne 0 ]
then
STATUSM="$STATUSM ($(python -c "print '%+d' % ($CURR-$PREV)") cycles)"
fi
- bash -c "$STATUS" success "$STATUSM"
2017-11-28 01:49:35 +00:00
2017-12-19 16:29:04 +00:00
- env :
2017-11-28 01:49:35 +00:00
- NAME=littlefs
2018-07-29 15:55:40 +00:00
- LITTLEFS=features/storage/filesystem/littlefs
2017-11-28 01:49:35 +00:00
install :
# Install dependencies
- sudo apt-get install gcc-arm-embedded fuse libfuse-dev
2017-12-19 16:29:04 +00:00
- pip install -r requirements.txt
2017-11-28 01:49:35 +00:00
# Print versions
- arm-none-eabi-gcc --version
- gcc --version
- python --version
- fusermount --version
before_script :
# Setup and patch littlefs-fuse
2018-08-06 19:30:29 +00:00
- git clone https://github.com/armmbed/littlefs-fuse littlefs_fuse
2018-01-25 00:27:47 +00:00
- git -C littlefs_fuse checkout 3f1ed6e37799e49e3710830dc6abb926d5503cf2
2017-11-28 01:49:35 +00:00
- echo '*' > littlefs_fuse/.mbedignore
- rm -rf littlefs_fuse/littlefs/*
- cp -r $(git ls-tree --name-only HEAD $LITTLEFS/littlefs/) littlefs_fuse/littlefs
# Create file-backed disk
- mkdir MOUNT
- sudo chmod a+rw /dev/loop0
- dd if=/dev/zero bs=512 count=2048 of=DISK
- losetup /dev/loop0 DISK
2018-02-24 00:09:57 +00:00
- CFLAGS="-Werror -Wno-format"
2017-11-28 01:49:35 +00:00
script :
# Check that example compiles
2018-02-24 00:09:57 +00:00
- export CFLAGS="-Werror -Wno-format"
2017-11-28 01:49:35 +00:00
- sed -n '/``` c++/,/```/{/```/d;p;}' $LITTLEFS/README.md > main.cpp
- python tools/make.py -t GCC_ARM -m K82F --source=. --build=BUILD/K82F/GCC_ARM -j0
# Run local littlefs tests
2018-02-24 00:09:57 +00:00
- make -C$LITTLEFS/littlefs test QUIET=1
2017-11-28 01:49:35 +00:00
# Run local littlefs tests with set of variations
2018-02-24 00:09:57 +00:00
- make -C$LITTLEFS/littlefs test QUIET=1 CFLAGS+="-DLFS_READ_SIZE=64 -DLFS_PROG_SIZE=64"
- make -C$LITTLEFS/littlefs test QUIET=1 CFLAGS+="-DLFS_READ_SIZE=1 -DLFS_PROG_SIZE=1"
- make -C$LITTLEFS/littlefs test QUIET=1 CFLAGS+="-DLFS_READ_SIZE=512 -DLFS_PROG_SIZE=512"
- make -C$LITTLEFS/littlefs test QUIET=1 CFLAGS+="-DLFS_BLOCK_COUNT=1023 -DLFS_LOOKAHEAD=2048"
- make -C$LITTLEFS/littlefs clean test QUIET=1 CFLAGS+="-DLFS_NO_INTRINSICS"
2017-11-28 01:49:35 +00:00
# Self-hosting littlefs fuzz test with littlefs-fuse
- make -Clittlefs_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 $LITTLEFS/littlefs/) MOUNT/littlefs
- ls MOUNT/littlefs
2018-02-24 00:09:57 +00:00
- CFLAGS="-Wno-format" make -CMOUNT/littlefs -B test_dirs test_files QUIET=1
# Compile and find the code size with smallest configuration
- cd $TRAVIS_BUILD_DIR/$LITTLEFS/littlefs
- make clean size
CC='arm-none-eabi-gcc -mthumb'
OBJ="$(ls lfs*.o | tr '\n' ' ')"
2018-08-06 19:30:29 +00:00
CFLAGS+="-DLFS_NO_ASSERT -DLFS_NO_DEBUG -DLFS_NO_WARN -DLFS_NO_ERROR"
2018-02-24 00:09:57 +00:00
| tee sizes
after_success :
# update status if we succeeded, compare with master if possible
- |
CURR=$(tail -n1 sizes | awk '{print $1}')
2018-04-07 18:04:47 +00:00
PREV=$(curl -u "$MBED_BOT" https://api.github.com/repos/$TRAVIS_REPO_SLUG/status/master \
2018-02-24 00:09:57 +00:00
| jq -re "select(.sha != \"$TRAVIS_COMMIT\")
| .statuses[] | select(.context == \"travis-ci/$NAME\").description
| capture(\"code size is (?<size>[0-9]+)\").size" \
|| echo 0)
STATUSM="Passed, code size is ${CURR}B"
if [ "$PREV" -ne 0 ]
then
STATUSM="$STATUSM ($(python -c "print '%+.2f' % (100*($CURR-$PREV)/$PREV.0)")%)"
fi
- bash -c "$STATUS" success "$STATUSM"
2018-04-03 10:43:24 +00:00
- env :
- NAME=gitattributestest
script :
# Check that no changes after clone. This check that .gitattributes is used right way.
- git diff --exit-code
2018-05-09 10:31:18 +00:00
- env :
- NAME=licence_check
script :
- echo 'Checking that there is no GPL licence text in code'
- ! git grep -q --ignore-case "gnu general public";
2018-08-28 13:43:10 +00:00
- ! git grep -q --ignore-case "gnu library general public";
2018-12-14 21:34:23 +00:00
2018-11-28 08:10:13 +00:00
- env :
- NAME=psa-autogen
script :
# Run SPM code generator and check that changes are not needed
- python tools/spm/generate_partition_code.py
- git diff --exit-code