flag to enable gcov and coveralls

This commit is contained in:
David Tolnay committed 2015-06-27 11:25:01 -07:00
1 parent d7e35101c5
commit e6371712ff
3 files changed
+32 -7

No files matched your search

+15 -5
View File
@@ -2,6 +2,15 @@ sudo: false
language: c
compiler:
- gcc
- clang
matrix:
include:
- compiler: gcc
env: COVERAGE="--disable-valgrind --enable-gcov"
addons:
apt:
packages:
@@ -23,13 +32,14 @@ install:
- ar p libonig2_5.9.6-1_amd64.deb data.tar.xz | tar xJ
- mv usr/lib/x86_64-linux-gnu/libonig.so* usr/lib
- valgrind --version
- if [ -n "$COVERAGE" ]; then pip install --user cpp-coveralls; fi
before_script:
- autoreconf -i
- ./configure
--with-oniguruma=usr
YACC="usr/bin/bison -y"
$COVERAGE
script:
- make -j4
@@ -37,13 +47,13 @@ script:
BISON_PKGDATADIR=$(pwd)/usr/share/bison
- make check -j4
after_script:
- rm -rf .libs # don't care about coverage for libjq
- if [ -n "$COVERAGE" ]; then coveralls --gcov-options '\-lp'; fi
after_failure:
- cat test-suite.log
- cat tests/*.log
compiler:
- gcc
- clang
notifications:
email: false
+12 -2
View File
@@ -55,6 +55,12 @@ else
NO_VALGRIND = 1
endif
### Code coverage with gcov
if ENABLE_GCOV
AM_CFLAGS += --coverage --no-inline
endif
### Error injection for testing
if ENABLE_ERROR_INJECTION
@@ -176,11 +182,15 @@ dist-clean-local:
# Not sure why this doesn't get cleaned up automatically, guess
# automake used to man pages which are hand coded?
# 'make clean' doesn't delete the manpage if it can't be rebuilt
.PHONY: clean-local-docs
clean-local-docs:
if ENABLE_DOCS
rm -f jq.1
endif
clean-local: clean-local-docs
clean-local-gcov:
rm -f *.gcno *.gcda *.gcov
clean-local: clean-local-docs clean-local-gcov
rm -f version.h .remake-version-h
.PHONY: clean-local-docs clean-local-gcov
+5
View File
@@ -89,6 +89,10 @@ dnl fix leaks.
AC_ARG_ENABLE([valgrind],
AC_HELP_STRING([--disable-valgrind], [do not run tests under Valgrind]))
dnl Code coverage
AC_ARG_ENABLE([gcov],
AC_HELP_STRING([--enable-gcov], [enable gcov code coverage tool]))
dnl Don't attempt to build docs if there's no Ruby lying around
AC_ARG_ENABLE([docs],
AC_HELP_STRING([--disable-docs], [don't build docs]))
@@ -126,6 +130,7 @@ EOF
])
AM_CONDITIONAL([ENABLE_VALGRIND], [test "x$enable_valgrind" != xno])
AM_CONDITIONAL([ENABLE_GCOV], [test "x$enable_gcov" = xyes])
AM_CONDITIONAL([ENABLE_DOCS], [test "x$enable_docs" != xno])
AM_CONDITIONAL([ENABLE_ERROR_INJECTION], [test "x$enable_error_injection" = xyes])
AM_CONDITIONAL([ENABLE_ALL_STATIC], [test "x$enable_all_static" = xyes])