mirror of
https://git.kernel.org/pub/scm/bluetooth/bluez.git
synced 2024-11-15 00:04:29 +08:00
build: Add coverage support
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.
This commit is contained in:
parent
b1b312d4ec
commit
6a56b171b6
4
.gitignore
vendored
4
.gitignore
vendored
@ -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
|
||||
|
22
Makefile.am
22
Makefile.am
@ -442,5 +442,25 @@ lib/bluetooth/%.h: lib/%.h
|
||||
$(AM_V_at)$(MKDIR_P) lib/bluetooth
|
||||
$(AM_V_GEN)$(LN_S) -f "$(abs_top_builddir)"/$< $@
|
||||
|
||||
clean-local:
|
||||
if COVERAGE
|
||||
clean-coverage:
|
||||
@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
|
||||
-find $(top_builddir) -name "*.gcno" -delete
|
||||
-find $(top_builddir) -name "*.gcda" -delete
|
||||
$(RM) -r lib/bluetooth
|
||||
|
||||
else
|
||||
clean-local:
|
||||
-find $(top_builddir) -name "*.gcno" -delete
|
||||
-find $(top_builddir) -name "*.gcda" -delete
|
||||
$(RM) -r lib/bluetooth
|
||||
endif
|
||||
|
@ -52,6 +52,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)
|
||||
])
|
||||
|
@ -274,4 +274,9 @@ 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
|
||||
AM_CONDITIONAL(COVERAGE, test "$LCOV" = "yes")
|
||||
|
||||
AC_OUTPUT(Makefile src/bluetoothd.8 lib/bluez.pc)
|
||||
|
Loading…
Reference in New Issue
Block a user