[libgnome-keyring] Add option for building with code coverage
- From: Stefan Walter <stefw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgnome-keyring] Add option for building with code coverage
- Date: Tue, 30 Apr 2013 16:16:27 +0000 (UTC)
commit 200ae6effde7d0be7181b4946f945c5cb6a32beb
Author: Stef Walter <stefw gnome org>
Date: Sat Apr 27 21:53:13 2013 +0200
Add option for building with code coverage
.gitignore | 2 ++
configure.ac | 29 +++++++++++++++++++++++++++++
egg/Makefile.am | 3 +++
egg/tests/Makefile.am | 3 +++
library/Makefile.am | 3 ++-
library/tests/Makefile.am | 3 +++
6 files changed, 42 insertions(+), 1 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 106a11a..176330b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,6 +12,8 @@ run-auto-test.h
*.stamp
*~
*.bak
+*.gcda
+*.gcno
*.tmp
*.prj
*.pws
diff --git a/configure.ac b/configure.ac
index d58485c..f0a35f2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -228,6 +228,34 @@ AC_MSG_RESULT($strict_status)
AC_SUBST(INTROSPECTION_FLAGS)
AC_SUBST(TEST_MODE)
+AC_MSG_CHECKING([whether to build with gcov testing])
+AC_ARG_ENABLE([coverage],
+ [AS_HELP_STRING([--enable-coverage], [Whether to enable coverage testing ])],
+ [],
+ [enable_coverage=no])
+
+AC_MSG_RESULT([$enable_coverage])
+
+AC_MSG_CHECKING([code coverage])
+
+if test "$enable_coverage" = "yes"; then
+ if test "$GCC" != "yes"; then
+ AC_MSG_ERROR(Coverage testing requires GCC)
+ fi
+
+ AC_PATH_PROG(GCOV, gcov, no)
+ if test "$GCOV" = "no" ; then
+ AC_MSG_ERROR(gcov tool is not available)
+ fi
+
+ CFLAGS="$CFLAGS -O0 -g --coverage"
+ LDFLAGS="$LDFLAGS --coverage"
+fi
+
+AM_CONDITIONAL([WITH_COVERAGE], [test "$enable_coverage" = "yes"])
+
+AC_MSG_RESULT($enable_coverage)
+
# ----------------------------------------------------------------------
# Status
@@ -260,4 +288,5 @@ echo " Introspection: $found_introspection"
echo " Vala: $enable_vala"
echo " Debug Build: $debug_status"
echo " Strict Build: $strict_status"
+echo " Code Coverage: $enable_coverage"
echo
diff --git a/egg/Makefile.am b/egg/Makefile.am
index dedb37c..8bf97ec 100644
--- a/egg/Makefile.am
+++ b/egg/Makefile.am
@@ -20,6 +20,9 @@ libegg_la_SOURCES = \
egg-secure-memory.c egg-secure-memory.h \
egg-testing.c egg-testing.h
+CLEANFILES = \
+ *.gcda *.gcno
+
# -------------------------------------------------------------------
SUBDIRS = . tests
diff --git a/egg/tests/Makefile.am b/egg/tests/Makefile.am
index 010cfd4..cf1a883 100644
--- a/egg/tests/Makefile.am
+++ b/egg/tests/Makefile.am
@@ -15,6 +15,9 @@ TEST_PROGS = \
check_PROGRAMS = $(TEST_PROGS)
+CLEANFILES = \
+ *.gcda *.gcno
+
test: ${TEST_PROGS}
gtester -k --verbose ${TEST_PROGS}
diff --git a/library/Makefile.am b/library/Makefile.am
index f4b1578..273844a 100644
--- a/library/Makefile.am
+++ b/library/Makefile.am
@@ -59,7 +59,8 @@ EXTRA_DIST = \
GnomeKeyring-1.0.metadata \
GnomeKeyring-1.0-custom.vala
-CLEANFILES=
+CLEANFILES = \
+ *.gcda *.gcno
# build introspection typelib
-include $(INTROSPECTION_MAKEFILE)
diff --git a/library/tests/Makefile.am b/library/tests/Makefile.am
index f992569..14ed08f 100644
--- a/library/tests/Makefile.am
+++ b/library/tests/Makefile.am
@@ -47,6 +47,9 @@ EXTRA_DIST = \
mock-service-normal.py \
mock-service-cancel.py
+CLEANFILES = \
+ *.gcda *.gcno
+
test: $(TEST_PROGS)
gtester -k --verbose $(TEST_PROGS)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]