From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ] build: Add coverage support
Date: Tue, 17 Dec 2013 14:25:07 +0200 [thread overview]
Message-ID: <1387283107-4356-1-git-send-email-luiz.dentz@gmail.com> (raw)
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Coverage is enabled with --enable-maintainer-mode, 2 new targets are
added 'coverage' and 'clean-coverage', the first generate the reports
using lcov and depend on the second to cleanup previous generated
reports and .gcda files.
---
.gitignore | 4 ++++
Makefile.am | 18 ++++++++++++++++++
acinclude.m4 | 4 ++++
configure.ac | 4 ++++
4 files changed, 30 insertions(+)
diff --git a/.gitignore b/.gitignore
index c570728..21dbe26 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,8 @@
*.lo
*.la
*.so
+*.gcno
+*.gcda
.deps
.libs
.dirstamp
@@ -27,7 +29,9 @@ stamp-h1
autom4te.cache
test-driver
test-suite.log
+coverage.info
+coverage
lib/bluez.pc
lib/bluetooth
src/builtin.h
diff --git a/Makefile.am b/Makefile.am
index 15cc149..337d849 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -331,5 +331,23 @@ lib/bluetooth/%.h: lib/%.h
$(AM_V_at)$(MKDIR_P) lib/bluetooth
$(AM_V_GEN)$(LN_S) -f "$(abs_top_builddir)"/$< $@
+if MAINTAINER_MODE
+clean-coverage:
+ -find $(top_builddir) -name "*.gcda" -delete
+ @lcov --directory $(top_builddir) --zerocounters
+ $(RM) -r coverage
+
+coverage: clean-coverage check
+ @lcov --compat-libtool --directory $(top_builddir) --capture \
+ --output-file $(top_builddir)/coverage.info
+ $(AM_V_at)$(MKDIR_P) -p coverage
+ @genhtml -o coverage/ $(top_builddir)/coverage.info
+
+clean-local: clean-coverage
+ -find $(top_builddir) -name "*.gcno" -delete
+ $(RM) -r lib/bluetooth
+
+else
clean-local:
$(RM) -r lib/bluetooth
+endif
diff --git a/acinclude.m4 b/acinclude.m4
index 2065852..afc7c6d 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -51,6 +51,10 @@ AC_DEFUN([MISC_FLAGS], [
misc_ldflags="$misc_ldflags -pie"
fi
])
+ if (test "$USE_MAINTAINER_MODE" = "yes"); then
+ misc_cflags="$misc_cflags --coverage"
+ misc_ldflags="$misc_ldflags --coverage"
+ fi
AC_SUBST([MISC_CFLAGS], $misc_cflags)
AC_SUBST([MISC_LDFLAGS], $misc_ldflags)
])
diff --git a/configure.ac b/configure.ac
index 18d0b55..4f36355 100644
--- a/configure.ac
+++ b/configure.ac
@@ -252,4 +252,8 @@ AC_ARG_ENABLE(android, AC_HELP_STRING([--enable-android],
[enable_android=${enableval}])
AM_CONDITIONAL(ANDROID, test "${enable_android}" = "yes")
+if (test "$USE_MAINTAINER_MODE" = "yes"); then
+ AC_CHECK_PROG([LCOV], [lcov], [yes], AC_MSG_ERROR(lcov is required))
+fi
+
AC_OUTPUT(Makefile src/bluetoothd.8 lib/bluez.pc)
--
1.8.3.1
next reply other threads:[~2013-12-17 12:25 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-17 12:25 Luiz Augusto von Dentz [this message]
2013-12-17 13:07 ` [PATCH BlueZ] build: Add coverage support Anderson Lizardo
-- strict thread matches above, loose matches on Subject: below --
2014-09-22 7:37 Luiz Augusto von Dentz
2013-12-11 10:55 Luiz Augusto von Dentz
2013-12-11 12:00 ` Marcel Holtmann
2013-12-11 12:55 ` Luiz Augusto von Dentz
2013-12-11 13:36 ` Marcel Holtmann
2013-12-11 22:31 ` Anderson Lizardo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1387283107-4356-1-git-send-email-luiz.dentz@gmail.com \
--to=luiz.dentz@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).