diff --git a/.travis.yml b/.travis.yml index 9fee85178..02343e4ca 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,13 +13,28 @@ before_install: install: - cd ci-build - - ../configure --enable-maintainer-mode + - if [ -n "$COVERAGE" ]; then pip install --user cpp-coveralls; fi + - ../configure --enable-maintainer-mode $COVERAGE - make -j3 script: - if [ x${COVERITY_SCAN_BRANCH} != x1 ]; then make check; fi compiler: clang +after_script: + - if [ -n "$COVERAGE" ]; then coveralls --gcov-options; fi + +matrix: + # Add a gcov build + include: + - compiler: gcc + env: COVERAGE="--enable-gcov" + os: linux + # The gcov build is not working quite yet + allow_failures: + compiler: gcc + env: COVERAGE="--enable-gcov" + os: linux notifications: email: diff --git a/Makefile.am b/Makefile.am index 55417eb63..f2bb5ac11 100644 --- a/Makefile.am +++ b/Makefile.am @@ -64,3 +64,9 @@ EXTRA_DIST = \ print-distdir: @echo $(distdir) + +clean-local-gcov: + find . '(' -name '*.gcno' -o -name '*.gcda' -o -name '*.gcov' ')' -a -print|xargs rm -f + +.PHONY: clean-local-gcov + diff --git a/cf/Makefile.am.common b/cf/Makefile.am.common index ece1cf576..de34f69ee 100644 --- a/cf/Makefile.am.common +++ b/cf/Makefile.am.common @@ -293,3 +293,7 @@ distdir-in-tree: $(DISTFILES) $(INFO_DEPS) heim_verbose = $(heim_verbose_$(V)) heim_verbose_ = $(heim_verbose_$(AM_DEFAULT_VERBOSITY)) heim_verbose_0 = @echo " GEN "$@; + +if ENABLE_GCOV +AM_CFLAGS += --coverage --no-inline +endif diff --git a/configure.ac b/configure.ac index 01bf32032..806b63973 100644 --- a/configure.ac +++ b/configure.ac @@ -72,6 +72,12 @@ AC_C___ATTRIBUTE__ AM_CONDITIONAL(ENABLE_SHARED, test "$enable_shared" = "yes") rk_VERSIONSCRIPT +dnl Code coverage +AC_ARG_ENABLE([gcov], + AC_HELP_STRING([--enable-gcov], [enable gcov code coverage tool])) +AM_CONDITIONAL([ENABLE_GCOV], [test "x$enable_gcov" = xyes]) + + dnl dnl Helper bits for cross compiling dnl