Integrate initial make coverage target

This was essentially "borrowed" from Buxton

Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
This commit is contained in:
Ikey Doherty
2015-04-10 13:38:20 +01:00
parent 7f45eb28bf
commit 5ed72e9510
5 changed files with 46 additions and 3 deletions
+6 -1
View File
@@ -25,4 +25,9 @@ check_*.trs
test-*.log
.dirstamp
check_jira_plugin
check_packaging
check_packaging
coverage/
*.gcno
*.gcda
+10
View File
@@ -1,3 +1,5 @@
include $(top_srcdir)/common.mk
ACLOCAL_AMFLAGS = -I m4
EXTRA_DIST = ${top_srcdir}/README.md \
@@ -14,3 +16,11 @@ SUBDIRS = \
src \
tests \
docs
if COVERAGE
coverage:
mkdir -p coverage
lcov --compat-libtool --directory . --capture --output-file coverage/report
genhtml -o coverage/ coverage/report
AM_CFLAGS += --coverage
endif
+21
View File
@@ -23,6 +23,25 @@ PKG_CHECK_MODULES([CHECK], [check >= 0.9])
AC_CONFIG_MACRO_DIR([m4])
have_coverage=no
AC_ARG_ENABLE(coverage, AS_HELP_STRING([--enable-coverage], [enable test coverage]))
if test "x$enable_coverage" = "xyes" ; then
AC_CHECK_PROG(lcov_found, [lcov], [yes], [no])
if test "x$lcov_found" = xno ; then
AC_MSG_ERROR([*** lcov support requested but the program was not found])
else
lcov_version_major="`lcov --version | cut -d ' ' -f 4 | cut -d '.' -f 1`"
lcov_version_minor="`lcov --version | cut -d ' ' -f 4 | cut -d '.' -f 2`"
if test "$lcov_version_major" -eq 1 -a "$lcov_version_minor" -lt 10; then
AC_MSG_ERROR([*** lcov version is too old. 1.10 required])
else
have_coverage=yes
AC_DEFINE([COVERAGE], [1], [Coverage enabled])
fi
fi
fi
AM_CONDITIONAL([COVERAGE], [test "$have_coverage" = "yes"])
AC_CONFIG_FILES([Makefile
data/Makefile
@@ -43,6 +62,8 @@ AC_MSG_RESULT([
bindir: ${bindir}
datarootdir: ${datarootdir}
coverage: ${have_coverage}
compiler: ${CC}
cflags: ${CFLAGS}
ldflags: ${LDFLAGS}
+5 -1
View File
@@ -1,4 +1,8 @@
-include $(top_srcdir)/common.mk
include $(top_srcdir)/common.mk
if COVERAGE
AM_CFLAGS += --coverage
endif
bin_PROGRAMS = cve-check-tool
+4 -1
View File
@@ -1,5 +1,8 @@
-include $(top_srcdir)/common.mk
include $(top_srcdir)/common.mk
if COVERAGE
AM_CFLAGS += --coverage
endif
TESTS = \
check_core \