linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH BlueZ] build: Add coverage support
@ 2013-12-11 10:55 Luiz Augusto von Dentz
  2013-12-11 12:00 ` Marcel Holtmann
  2013-12-11 22:31 ` Anderson Lizardo
  0 siblings, 2 replies; 8+ messages in thread
From: Luiz Augusto von Dentz @ 2013-12-11 10:55 UTC (permalink / raw)
  To: linux-bluetooth

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


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH BlueZ] build: Add coverage support
  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 22:31 ` Anderson Lizardo
  1 sibling, 1 reply; 8+ messages in thread
From: Marcel Holtmann @ 2013-12-11 12:00 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: linux-bluetooth@vger.kernel.org development

Hi Luiz,

> 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

maybe we should just make this depend on maintainer-mode.

> +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”])

I do not like this one. The test should check enable_xxx variables. I rather have configure abort with error if some programs or dependencies are not found.

Regards

Marcel


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH BlueZ] build: Add coverage support
  2013-12-11 12:00 ` Marcel Holtmann
@ 2013-12-11 12:55   ` Luiz Augusto von Dentz
  2013-12-11 13:36     ` Marcel Holtmann
  0 siblings, 1 reply; 8+ messages in thread
From: Luiz Augusto von Dentz @ 2013-12-11 12:55 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: linux-bluetooth@vger.kernel.org development

Hi Marcel,

On Wed, Dec 11, 2013 at 2:00 PM, Marcel Holtmann <marcel@holtmann.org> wrot=
e:
> Hi Luiz,
>
>> 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
>
> maybe we should just make this depend on maintainer-mode.

We could, but I suggest you do a quick run with this version to see if
it is acceptable for maintainer-mode since it does increase quite a
bit the build time for me so perhaps we should keep it separately.

>> +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.inf=
o
>> +     @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=3D"$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}" =3D "yes"); then
>> +                     misc_cflags=3D"$misc_cflags -ftest-coverage"
>> +                     misc_cflags=3D"$misc_cflags -fprofile-arcs"
>> +                     misc_ldflags=3D"$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-andr=
oid],
>>                                       [enable_android=3D${enableval}])
>> AM_CONDITIONAL(ANDROID, test "${enable_android}" =3D "yes")
>>
>> +AM_CONDITIONAL([COVERAGE], [test "$LCOV=94])
>
> I do not like this one. The test should check enable_xxx variables. I rat=
her have configure abort with error if some programs or dependencies are no=
t found.

Okay, Ive named it LCOV because it actually checks for lcov binary and
then uses it in Makefile.am at check-coverage and clean-coverage, it
comes from AC_PATH_PROG([LCOV], [lcov]). I can do AC_MSG_ERROR if lcov
is not found, is that how you want it? I couldn't make AM_CONDITIONAL
within MISC_FLAGS that why Ive moved it to configure.ac.
--=20
Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH BlueZ] build: Add coverage support
  2013-12-11 12:55   ` Luiz Augusto von Dentz
@ 2013-12-11 13:36     ` Marcel Holtmann
  0 siblings, 0 replies; 8+ messages in thread
From: Marcel Holtmann @ 2013-12-11 13:36 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: linux-bluetooth@vger.kernel.org development

Hi Luiz,

>>> 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
>> 
>> maybe we should just make this depend on maintainer-mode.
> 
> We could, but I suggest you do a quick run with this version to see if
> it is acceptable for maintainer-mode since it does increase quite a
> bit the build time for me so perhaps we should keep it separately.

let see how bad it actually is.

>>> +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”])
>> 
>> I do not like this one. The test should check enable_xxx variables. I rather have configure abort with error if some programs or dependencies are not found.
> 
> Okay, Ive named it LCOV because it actually checks for lcov binary and
> then uses it in Makefile.am at check-coverage and clean-coverage, it
> comes from AC_PATH_PROG([LCOV], [lcov]). I can do AC_MSG_ERROR if lcov
> is not found, is that how you want it? I couldn't make AM_CONDITIONAL
> within MISC_FLAGS that why Ive moved it to configure.ac.

Yes. Just error out and abort configure.

Regards

Marcel


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH BlueZ] build: Add coverage support
  2013-12-11 10:55 Luiz Augusto von Dentz
  2013-12-11 12:00 ` Marcel Holtmann
@ 2013-12-11 22:31 ` Anderson Lizardo
  1 sibling, 0 replies; 8+ messages in thread
From: Anderson Lizardo @ 2013-12-11 22:31 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: BlueZ development

Hi Luiz,

On Wed, Dec 11, 2013 at 7:55 AM, Luiz Augusto von Dentz
<luiz.dentz@gmail.com> wrote:
> --- 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
> +       ])

I believe the current recommended (or at least simpler) way to enable
coverage is to use "--coverage" option (both as CFLAGS and LDFLAGS),
instead of separate -ftest-coverage/-fprofile-arcs/-gcov options.
Check "man gcc" for details.

>         AC_SUBST([MISC_CFLAGS], $misc_cflags)
>         AC_SUBST([MISC_LDFLAGS], $misc_ldflags)
>  ])

Best Regards,
-- 
Anderson Lizardo
Instituto Nokia de Tecnologia - INdT
Manaus - Brazil

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH BlueZ] build: Add coverage support
@ 2013-12-17 12:25 Luiz Augusto von Dentz
  2013-12-17 13:07 ` Anderson Lizardo
  0 siblings, 1 reply; 8+ messages in thread
From: Luiz Augusto von Dentz @ 2013-12-17 12:25 UTC (permalink / raw)
  To: linux-bluetooth

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


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH BlueZ] build: Add coverage support
  2013-12-17 12:25 Luiz Augusto von Dentz
@ 2013-12-17 13:07 ` Anderson Lizardo
  0 siblings, 0 replies; 8+ messages in thread
From: Anderson Lizardo @ 2013-12-17 13:07 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: BlueZ development

Hi Luiz,

On Tue, Dec 17, 2013 at 8:25 AM, Luiz Augusto von Dentz
<luiz.dentz@gmail.com> wrote:
> 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

You may want to remove coverage.info as well.

> +
> +coverage: clean-coverage check
> +       @lcov --compat-libtool --directory $(top_builddir) --capture \
> +                               --output-file $(top_builddir)/coverage.info
> +       $(AM_V_at)$(MKDIR_P) -p coverage

MKDIR_P already includes the "-p" option, so it should be
"$(AM_V_at)$(MKDIR_P) coverage" above.

> +       @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

Best Regards,
-- 
Anderson Lizardo
Instituto Nokia de Tecnologia - INdT
Manaus - Brazil

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH BlueZ] build: Add coverage support
@ 2014-09-22  7:37 Luiz Augusto von Dentz
  0 siblings, 0 replies; 8+ messages in thread
From: Luiz Augusto von Dentz @ 2014-09-22  7:37 UTC (permalink / raw)
  To: linux-bluetooth

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  | 17 +++++++++++++++++
 acinclude.m4 |  4 ++++
 configure.ac |  4 ++++
 4 files changed, 29 insertions(+)

diff --git a/.gitignore b/.gitignore
index e22274f..ecd4a3b 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 14b4f55..483933d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -409,5 +409,22 @@ 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 "*.gcno" -delete
+	-find $(top_builddir) -name "*.gcda" -delete
+	@lcov --directory $(top_builddir) --zerocounters
+	$(RM) -r coverage $(top_builddir)/coverage.info
+
+coverage: check
+	@lcov --compat-libtool --directory $(top_builddir) --capture \
+				--output-file $(top_builddir)/coverage.info
+	$(AM_V_at)$(MKDIR_P) coverage
+	@genhtml -o coverage/ $(top_builddir)/coverage.info
+
+clean-local: clean-coverage
+	$(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 9bdd239..144b8de 100644
--- a/configure.ac
+++ b/configure.ac
@@ -274,4 +274,8 @@ fi
 AC_DEFINE_UNQUOTED(ANDROID_STORAGEDIR, "${storagedir}/android",
 			[Directory for the Android daemon storage files])
 
+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.9.3


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-09-22  7:37 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-22  7:37 [PATCH BlueZ] build: Add coverage support Luiz Augusto von Dentz
  -- 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
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

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).