linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ] build: Add coverage support
Date: Wed, 11 Dec 2013 12:55:41 +0200	[thread overview]
Message-ID: <1386759341-14346-1-git-send-email-luiz.dentz@gmail.com> (raw)

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

---
 Makefile.am         | 18 ++++++++++++++++++
 acinclude.m4        |  9 +++++++++
 bootstrap-configure |  1 +
 configure.ac        |  2 ++
 4 files changed, 30 insertions(+)

diff --git a/Makefile.am b/Makefile.am
index 15cc149..1a59532 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 COVERAGE
+clean-coverage:
+	$(RM) -r coverage
+	@find . -name "*.gcda" -exec $(RM) {} \;
+	$(LCOV) --directory . --zerocounters
+
+check-coverage:
+	@make check
+	$(AM_V_at)$(MKDIR_P) -p coverage
+	$(LCOV) --compat-libtool --directory . --capture --output-file \
+							coverage/check.info
+	@genhtml -o coverage/ coverage/check.info
+
 clean-local:
+	@make clean-coverage
 	$(RM) -r lib/bluetooth
+else
+clean-local:
+	$(RM) -r lib/bluetooth
+endif
diff --git a/acinclude.m4 b/acinclude.m4
index 2065852..e5eb481 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -51,6 +51,15 @@ AC_DEFUN([MISC_FLAGS], [
 			misc_ldflags="$misc_ldflags -pie"
 		fi
 	])
+	AC_ARG_ENABLE(coverage, AC_HELP_STRING([--enable-coverage],
+			[enable coverage flags]), [
+		AC_PATH_PROG([LCOV], [lcov])
+		if (test "$LCOV" && test "${enableval}" = "yes"); then
+			misc_cflags="$misc_cflags -ftest-coverage"
+			misc_cflags="$misc_cflags -fprofile-arcs"
+			misc_ldflags="$misc_ldflags -gcov"
+		fi
+	])
 	AC_SUBST([MISC_CFLAGS], $misc_cflags)
 	AC_SUBST([MISC_LDFLAGS], $misc_ldflags)
 ])
diff --git a/bootstrap-configure b/bootstrap-configure
index c7f08ed..35aa98b 100755
--- a/bootstrap-configure
+++ b/bootstrap-configure
@@ -14,4 +14,5 @@ fi
 		--enable-experimental \
 		--enable-android \
 		--enable-sixaxis \
+		--enable-coverage \
 		--disable-datafiles $*
diff --git a/configure.ac b/configure.ac
index 18d0b55..c55924f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -252,4 +252,6 @@ AC_ARG_ENABLE(android, AC_HELP_STRING([--enable-android],
 					[enable_android=${enableval}])
 AM_CONDITIONAL(ANDROID, test "${enable_android}" = "yes")
 
+AM_CONDITIONAL([COVERAGE], [test "$LCOV"])
+
 AC_OUTPUT(Makefile src/bluetoothd.8 lib/bluez.pc)
-- 
1.8.3.1


             reply	other threads:[~2013-12-11 10:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-11 10:55 Luiz Augusto von Dentz [this message]
2013-12-11 12:00 ` [PATCH BlueZ] build: Add coverage support 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
  -- strict thread matches above, loose matches on Subject: below --
2013-12-17 12:25 Luiz Augusto von Dentz
2013-12-17 13:07 ` Anderson Lizardo
2014-09-22  7:37 Luiz Augusto von Dentz

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=1386759341-14346-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).