[grilo-plugins] build: Add tests coveraging support
- From: Juan A. Suarez Romero <jasuarez src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grilo-plugins] build: Add tests coveraging support
- Date: Tue, 4 Jun 2013 07:18:14 +0000 (UTC)
commit fb8f25c3408ac5fe8a704c3a04c84f9592b60947
Author: Juan A. Suarez Romero <jasuarez igalia com>
Date: Fri May 31 15:21:26 2013 +0200
build: Add tests coveraging support
Add support for lcov.
On top of that, send results from Travis CI services to Coveralls.io.
.travis.yml | 11 +++++++++--
Makefile.am | 12 ++++++++++++
configure.ac | 25 +++++++++++++++++++++++++
3 files changed, 46 insertions(+), 2 deletions(-)
---
diff --git a/.travis.yml b/.travis.yml
index 2670bfc..1e3e2c4 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -4,5 +4,12 @@ before_install:
- sudo add-apt-repository ppa:grilo-team/ppa -y
- sudo apt-get update -qq
- sudo apt-get install -qq gnome-common gnome-doc-utils libgrilo-0.2-dev
- libjson-glib-dev libsoup2.4-dev
-script: ./autogen.sh && make && make check
+ libjson-glib-dev libsoup2.4-dev lcov
+ - sudo pip install cpp-coveralls --use-mirrors
+script:
+ - ./autogen.sh --enable-gcov
+ - make
+ - make check
+after_success:
+ - find . -path "*/.libs/*" -name "*.gc??" | while read -r p ; do mv "$p" "${p%%/.libs/*}" ; done
+ - coveralls --exclude test --exclude help
diff --git a/Makefile.am b/Makefile.am
index 2882544..ee64d98 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -70,3 +70,15 @@ dist-hook:
else \
echo A git clone is required to generate a ChangeLog >&2; \
fi
+
+if GCOV_ENABLED
+lcov-clean:
+ @rm -fr coverage
+ @find . -name "*.gcda" -exec rm {} \;
+ @lcov --directory . --zerocounters
+
+lcov:
+ @mkdir -p coverage
+ @lcov --compat-libtool --directory . --capture --output-file coverage/app.info
+ @genhtml -o coverage/ coverage/app.info
+endif
diff --git a/configure.ac b/configure.ac
index 27751d8..42bed9f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -197,6 +197,31 @@ if test "x$HAVE_GDATA" = "xyes"; then
fi
# ----------------------------------------------------------
+# TESTS COVERAGE
+# ----------------------------------------------------------
+
+AC_ARG_ENABLE(gcov,
+ AC_HELP_STRING([--enable-gcov],
+ [enable coverage testing (default: no)]),
+ [enable_gcov=$enableval],
+ [enable_gcov=no])
+
+if test "x$enable_gcov" = "xyes"; then
+ AC_PATH_PROG([enable_gcov], [lcov], [no])
+ if test "x$enable_gcov" = "xno"; then
+ AC_MSG_ERROR([You need lcov to build with coverage testing])
+ elif test "x$GCC" = "xno"; then
+ AC_MSG_ERROR([You need to use gcc to build with coverage testing])
+ else
+ enable_gcov=yes
+ CFLAGS="$CFLAGS -g -O0 -fprofile-arcs -ftest-coverage"
+ LDFLAGS="$LDFLAGS -lgcov"
+ fi
+fi
+
+AM_CONDITIONAL([GCOV_ENABLED], [test "x$enable_gcov" = "xyes"])
+
+# ----------------------------------------------------------
# BUILD FAKE METADATA PLUGIN
# ----------------------------------------------------------
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]