diff --git a/.gitignore b/.gitignore index b06e96be46..4257350d57 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ *.dirstamp *.gcda *.gcno +*.gcov *.la *.lo *.log diff --git a/.travis-ci.sh b/.travis-ci.sh index 4f73ddb880..86de6bdf63 100755 --- a/.travis-ci.sh +++ b/.travis-ci.sh @@ -31,12 +31,10 @@ elif [[ $TASK = 'doxygen' ]]; then else echo "Found $warnings doxygen warnings" fi; +elif [[ $TASK = 'coverage' ]]; then + # Compile with coverage for coveralls + autoreconf -i && ./configure --enable-gcov && make && make check else - if [ "$CXX" = "g++-4.8" ]; then - # Compile with coverage for coveralls - autoreconf -i && ./configure --enable-gcov && make distcheck - else - # Otherwise compile and check as normal - autoreconf -i && ./configure && make distcheck - fi; + # Otherwise compile and check as normal + autoreconf -i && ./configure && make distcheck fi diff --git a/.travis.yml b/.travis.yml index 3e6f1a7d5a..2183385df6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,29 +10,34 @@ matrix: env: TASK='compile' - compiler: gcc env: TASK='compile' + - compiler: gcc + env: TASK='coverage' - env: TASK='doxygen' - env: TASK='lint' - env: TASK='check-licences' + allow_failures: + - compiler: gcc + env: TASK='coverage' cache: apt before_install: - sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y - sudo apt-get update -qq - - sudo apt-cache search microhttpd - sudo apt-get install -qq protobuf-compiler libprotobuf-lite7 libprotobuf-dev libprotoc-dev bison flex libftdi-dev libftdi1 libusb-1.0-0-dev liblo-dev libavahi-client-dev uuid-dev libcppunit-dev libcppunit-1.12-1 libncurses5-dev python-protobuf libmicrohttpd-dev #g++-4.9 won't work on Ubuntu 12.04 that Travis currently uses - if [ "$CXX" = "g++" ]; then sudo apt-get install -qq g++-4.8; fi - if [ "$CXX" = "g++" ]; then export CXX="g++-4.8" CC="gcc-4.8"; fi #Remove the old g++/gcc to ensure we're using the latest ones - if [ "$CXX" = "g++-4.8" ]; then sudo rm /usr/bin/g++; sudo rm /usr/bin/gcc; fi -#Install coveralls - - if [ "$CXX" = "g++-4.8" ]; then sudo pip install cpp-coveralls; fi +#Install coveralls if required + - if [ "$TASK" = "coverage" ]; then sudo pip install -qq cpp-coveralls; fi #Install doxygen if required - if [ "$TASK" = "doxygen" ]; then sudo apt-get install -qq doxygen; fi + - pwd after_success: - - coveralls --exclude lib --exclude tests --gcov-options '\-lp' + - if [ "$TASK" = "coverage" ]; then coveralls --gcov /usr/bin/gcov-4.8 -b . -E 'Test.cpp$' --gcov-options '\-lp' > /dev/null; fi notifications: irc: diff --git a/configure.ac b/configure.ac index 50915450e2..7f5e65adf7 100644 --- a/configure.ac +++ b/configure.ac @@ -463,9 +463,10 @@ AM_CONDITIONAL([FATAL_WARNINGS], [test "x$enable_fatal_warnings" != xno]) AC_ARG_ENABLE( [gcov], [AS_HELP_STRING([--enable-gcov], [Turn on code coverage analysis tools])]) -AS_IF([test "x$enable_gov" = xyes], +AS_IF([test "x$enable_gcov" = xyes], [CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage" - CXXFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage"]) + CXXFLAGS="$CXXFLAGS -fprofile-arcs -ftest-coverage" + LIBS="$LIBS -lgcov"]) # Enable HTTP support. This requires libmicrohttpd. AC_ARG_ENABLE(