language: c
+compiler:
+ - gcc
+ - clang
+
+matrix:
+ include:
+ - compiler: gcc
+ env: COVERAGE="--disable-valgrind --enable-gcov"
+
addons:
apt:
packages:
- 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
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
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
# 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
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]))
])
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])