summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStef Walter <stefw@redhat.com>2013-04-24 10:52:42 +0200
committerRay Strode <rstrode@redhat.com>2013-10-15 16:18:54 -0400
commitd6223be50b7acc4f225c9bc9a7ee764fd2bcf63b (patch)
tree579689fccc11313373b7b143fe81bf91442b41c3
parentfee34e4a5e5d752baf74e2f7065e2d953d652d35 (diff)
Add --enable-coverage option for building with code coverage
Also clean coverage files on 'make clean' https://bugs.freedesktop.org/show_bug.cgi?id=63868
-rw-r--r--.gitignore2
-rw-r--r--configure.ac20
-rw-r--r--src/Makefile.am6
-rw-r--r--src/libaccountsservice/Makefile.am5
4 files changed, 31 insertions, 2 deletions
diff --git a/.gitignore b/.gitignore
index af47474..6885f41 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,8 @@
*-enum-types.h
*-generated.c
*-generated.h
+*.gcda
+*.gcno
*.gir
*.gmo
*.la
diff --git a/configure.ac b/configure.ac
index 47e9c67..cb1fcda 100644
--- a/configure.ac
+++ b/configure.ac
@@ -61,6 +61,26 @@ AC_ARG_ENABLE(user-heuristics,
fi])
dnl ---------------------------------------------------------------------------
+dnl - coverage
+dnl ---------------------------------------------------------------------------
+
+AC_MSG_CHECKING([whether to build with gcov testing])
+AC_ARG_ENABLE([coverage],
+ AS_HELP_STRING([--enable-coverage],
+ [Whether to enable gcov code coverage]),
+ [], [enable_coverage=no])
+AC_MSG_RESULT([$enable_coverage])
+
+if test "$enable_coverage" = "yes"; then
+ if test "$GCC" != "yes"; then
+ AC_MSG_ERROR(Coverage testing requires GCC)
+ fi
+ CFLAGS="$CFLAGS -O0 -g --coverage"
+fi
+
+AM_CONDITIONAL([WITH_COVERAGE], [test "$enable_coverage" = "yes"])
+
+dnl ---------------------------------------------------------------------------
dnl - Warnings
dnl ---------------------------------------------------------------------------
diff --git a/src/Makefile.am b/src/Makefile.am
index a5bfcf9..6940f2d 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -47,7 +47,11 @@ accounts_daemon_LDADD = \
libaccounts-generated.la \
$(POLKIT_LIBS)
-CLEANFILES = $(BUILT_SOURCES)
+CLEANFILES = \
+ $(BUILT_SOURCES) \
+ *.gcda \
+ *.gcno \
+ $(NULL)
install-data-hook:
$(MKDIR_P) "$(DESTDIR)$(localstatedir)/lib/AccountsService/users"
diff --git a/src/libaccountsservice/Makefile.am b/src/libaccountsservice/Makefile.am
index 5c1684e..408d91f 100644
--- a/src/libaccountsservice/Makefile.am
+++ b/src/libaccountsservice/Makefile.am
@@ -1,7 +1,10 @@
END_OF_LIST =
BUILT_SOURCES = $(END_OF_LIST)
-CLEANFILES = $(END_OF_LIST)
+CLEANFILES = \
+ *.gcda \
+ *.gcno \
+ $(END_OF_LIST)
AM_CPPFLAGS = \
-I. \