From 65844f68914eaf5a911badc75299bac70d71ccf7 Mon Sep 17 00:00:00 2001 From: Magnus Ivarsson Date: Mon, 7 Nov 2016 10:53:01 +0100 Subject: [PATCH 1/2] Add code coverage measurement when building on travis and publish results to coveralls.io --- .travis.sh | 9 ++++++++- .travis.yml | 7 +++++++ README.md | 4 ++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/.travis.sh b/.travis.sh index 1e90137c37..98702415ab 100755 --- a/.travis.sh +++ b/.travis.sh @@ -64,7 +64,14 @@ elif [ $TARGET ] ; then fi elif [ $GOAL ] ; then - make V=0 $GOAL + make V=0 $GOAL || exit $? + + if [ "test" == "$GOAL" ] ; then + lcov --directory . -b src/test --capture --output-file coverage.info # capture coverage info + lcov --remove coverage.info 'lib/test/*' 'src/test/*' '/usr/*' --output-file coverage.info # filter out system and test code + lcov --list coverage.info # debug before upload + coveralls-lcov coverage.info # uploads to coveralls + fi else make V=0 all diff --git a/.travis.yml b/.travis.yml index ad6f252afc..c2442b6cfd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,6 +27,9 @@ git: addons: apt: packages: + - lcov + - build-essential + - git - libc6-i386 - time @@ -34,6 +37,10 @@ addons: language: cpp compiler: clang +before_install: + - pip install --user cpp-coveralls + - gem install coveralls-lcov + install: - make arm_sdk_install diff --git a/README.md b/README.md index 06b2741d05..a51db0a91b 100644 --- a/README.md +++ b/README.md @@ -71,6 +71,10 @@ https://travis-ci.org/betaflight/betaflight [![Build Status](https://travis-ci.org/betaflight/betaflight.svg?branch=master)](https://travis-ci.org/betaflight/betaflight) +Coveralls is used to monitor code coverage: https://coveralls.io/github/betaflight/betaflight + +[![Coverage Status](https://coveralls.io/repos/github/betaflight/betaflight/badge.svg?branch=master)](https://coveralls.io/github/betaflight/betaflight?branch=master) + ## Betaflight Releases https://github.com/betaflight/betaflight/releases From 959f981ac47260f2762a53e3c08e838d21fb21b4 Mon Sep 17 00:00:00 2001 From: Magnus Ivarsson Date: Tue, 7 Mar 2017 20:29:48 +0100 Subject: [PATCH 2/2] try to reduce noise --- .travis.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.sh b/.travis.sh index 98702415ab..8b67a65e58 100755 --- a/.travis.sh +++ b/.travis.sh @@ -67,7 +67,7 @@ elif [ $GOAL ] ; then make V=0 $GOAL || exit $? if [ "test" == "$GOAL" ] ; then - lcov --directory . -b src/test --capture --output-file coverage.info # capture coverage info + lcov --directory . -b src/test --capture --output-file coverage.info 2>&1 | grep -E ":version '402\*', prefer.*'406\*" --invert-match lcov --remove coverage.info 'lib/test/*' 'src/test/*' '/usr/*' --output-file coverage.info # filter out system and test code lcov --list coverage.info # debug before upload coveralls-lcov coverage.info # uploads to coveralls