diff options
author | Jakub Sitnicki <jsitnicki@gmail.com> | 2015-01-11 15:07:22 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2015-01-11 19:32:43 +0100 |
commit | 7552030ef90004857b4535f835e19fe734b22a39 (patch) | |
tree | 8565c8684d90213d38888fed7f108ea24eb1dd4a | |
parent | ffe2106d4e556526119b89eedb62047fd8eab7de (diff) |
build: add code coverage support
Build all targets, except for CLI tools (mmcli, uml290), with special
flags needed for collecting code coverage information when the build has
been configured with --enable-code-coverage.
Three new targets are available in the top build directory:
- `check-code-coverage' runs the test suite and generates a code
coverage report,
- `code-coverage-capture' generates a code coverage report from already
collected data, which can come in handy when one wants to see code
paths touched by a particular test,
- `code-coverage-clean' removes the collected coverage data and the
generated reports.
-rw-r--r-- | .gitignore | 5 | ||||
-rw-r--r-- | Makefile.am | 7 | ||||
-rw-r--r-- | configure.ac | 9 | ||||
-rw-r--r-- | libmm-glib/Makefile.am | 6 | ||||
-rw-r--r-- | libmm-glib/generated/Makefile.am | 3 | ||||
-rw-r--r-- | libmm-glib/generated/tests/Makefile.am | 3 | ||||
-rw-r--r-- | libmm-glib/tests/Makefile.am | 3 | ||||
-rw-r--r-- | libqcdm/src/Makefile.am | 4 | ||||
-rw-r--r-- | libqcdm/tests/Makefile.am | 3 | ||||
-rw-r--r-- | libwmc/src/Makefile.am | 4 | ||||
-rw-r--r-- | libwmc/tests/Makefile.am | 3 | ||||
-rw-r--r-- | plugins/Makefile.am | 9 | ||||
-rw-r--r-- | src/Makefile.am | 3 | ||||
-rw-r--r-- | src/tests/Makefile.am | 3 |
14 files changed, 59 insertions, 6 deletions
@@ -18,6 +18,8 @@ gtk-doc.make *.lo *.la *.loT +*.gcno +*.gcda libtool .deps .libs @@ -165,3 +167,6 @@ plugins/test-service-* TAGS ABOUT-NLS + +ModemManager-*-coverage.info +ModemManager-*-coverage/ diff --git a/Makefile.am b/Makefile.am index f6bea8e1..762306ff 100644 --- a/Makefile.am +++ b/Makefile.am @@ -24,3 +24,10 @@ EXTRA_DIST = \ COPYING.LIB ACLOCAL_AMFLAGS = -I m4 + +@CODE_COVERAGE_RULES@ + +if CODE_COVERAGE_ENABLED +clean-local: + -find $(top_builddir) -name "*.gcno" -delete +endif diff --git a/configure.ac b/configure.ac index 9e8587dc..22417cc1 100644 --- a/configure.ac +++ b/configure.ac @@ -110,6 +110,9 @@ AC_SUBST(GLIB_MKENUMS) GDBUS_CODEGEN=`$PKG_CONFIG --variable=gdbus_codegen gio-2.0` AC_SUBST(GDBUS_CODEGEN) +# Code coverage (disabled by default) +AX_CODE_COVERAGE + # GObject Introspection GOBJECT_INTROSPECTION_CHECK([0.9.6]) @@ -302,7 +305,13 @@ echo " compiler: ${CC} cflags: ${CFLAGS} Maintainer mode: ${USE_MAINTAINER_MODE} + Code coverage: ${CODE_COVERAGE_ENABLED}" +if test "x${CODE_COVERAGE_ENABLED}" = "xyes"; then + echo " Code coverage cflags: ${CODE_COVERAGE_CFLAGS}" + echo " Code coverage ldflags: ${CODE_COVERAGE_LDFLAGS}" +fi +echo " D-Bus system directory: ${DBUS_SYS_DIR} udev base directory: ${UDEV_BASE_DIR} systemd unit directory: ${with_systemdsystemunitdir} diff --git a/libmm-glib/Makefile.am b/libmm-glib/Makefile.am index 54e79fc9..da1f5d4a 100644 --- a/libmm-glib/Makefile.am +++ b/libmm-glib/Makefile.am @@ -1,5 +1,8 @@ SUBDIRS = generated . tests +AM_CFLAGS = $(CODE_COVERAGE_CFLAGS) +AM_LDFLAGS = $(CODE_COVERAGE_LDFLAGS) + lib_LTLIBRARIES = libmm-glib.la libmm_glib_la_SOURCES = \ @@ -91,7 +94,8 @@ libmm_glib_la_LIBADD = \ $(LIBMM_GLIB_LIBS) libmm_glib_la_LDFLAGS = \ - -version-info $(MM_GLIB_LT_CURRENT):$(MM_GLIB_LT_REVISION):$(MM_GLIB_LT_AGE) + -version-info $(MM_GLIB_LT_CURRENT):$(MM_GLIB_LT_REVISION):$(MM_GLIB_LT_AGE) \ + $(AM_LDFLAGS) includedir = @includedir@/libmm-glib include_HEADERS = \ diff --git a/libmm-glib/generated/Makefile.am b/libmm-glib/generated/Makefile.am index 2a608fc1..5a90b90d 100644 --- a/libmm-glib/generated/Makefile.am +++ b/libmm-glib/generated/Makefile.am @@ -1,6 +1,9 @@ SUBDIRS = . tests +AM_CFLAGS = $(CODE_COVERAGE_CFLAGS) +AM_LDFLAGS = $(CODE_COVERAGE_LDFLAGS) + noinst_LTLIBRARIES = libmm-generated.la GENERATED_H = \ diff --git a/libmm-glib/generated/tests/Makefile.am b/libmm-glib/generated/tests/Makefile.am index a4bed421..0cebb720 100644 --- a/libmm-glib/generated/tests/Makefile.am +++ b/libmm-glib/generated/tests/Makefile.am @@ -1,4 +1,5 @@ - +AM_CFLAGS = $(CODE_COVERAGE_CFLAGS) +AM_LDFLAGS = $(CODE_COVERAGE_LDFLAGS) noinst_LTLIBRARIES = libmm-test-generated.la diff --git a/libmm-glib/tests/Makefile.am b/libmm-glib/tests/Makefile.am index be93d4c6..f98f9d7c 100644 --- a/libmm-glib/tests/Makefile.am +++ b/libmm-glib/tests/Makefile.am @@ -1,5 +1,8 @@ include $(top_srcdir)/gtester.make +AM_CFLAGS = $(CODE_COVERAGE_CFLAGS) +AM_LDFLAGS = $(CODE_COVERAGE_LDFLAGS) + noinst_PROGRAMS = test-common-helpers TEST_PROGS += $(noinst_PROGRAMS) diff --git a/libqcdm/src/Makefile.am b/libqcdm/src/Makefile.am index 9aa9500f..2caaf008 100644 --- a/libqcdm/src/Makefile.am +++ b/libqcdm/src/Makefile.am @@ -1,5 +1,7 @@ -noinst_LTLIBRARIES = libqcdm.la libqcdm-test.la +AM_CFLAGS = $(CODE_COVERAGE_CFLAGS) +AM_LDFLAGS = $(CODE_COVERAGE_LDFLAGS) +noinst_LTLIBRARIES = libqcdm.la libqcdm-test.la libqcdm_la_CPPFLAGS = \ $(MM_CFLAGS) diff --git a/libqcdm/tests/Makefile.am b/libqcdm/tests/Makefile.am index 32599068..c00f1b01 100644 --- a/libqcdm/tests/Makefile.am +++ b/libqcdm/tests/Makefile.am @@ -1,5 +1,8 @@ include $(top_srcdir)/gtester.make +AM_CFLAGS = $(CODE_COVERAGE_CFLAGS) +AM_LDFLAGS = $(CODE_COVERAGE_LDFLAGS) + noinst_PROGRAMS = test-qcdm modepref ipv6pref reset TEST_PROGS += test-qcdm diff --git a/libwmc/src/Makefile.am b/libwmc/src/Makefile.am index 46205016..b662f892 100644 --- a/libwmc/src/Makefile.am +++ b/libwmc/src/Makefile.am @@ -1,5 +1,7 @@ -noinst_LTLIBRARIES = libwmc.la +AM_CFLAGS = $(CODE_COVERAGE_CFLAGS) +AM_LDFLAGS = $(CODE_COVERAGE_LDFLAGS) +noinst_LTLIBRARIES = libwmc.la libwmc_la_CPPFLAGS = \ $(MM_CFLAGS) diff --git a/libwmc/tests/Makefile.am b/libwmc/tests/Makefile.am index 33eaf3de..4622fbcf 100644 --- a/libwmc/tests/Makefile.am +++ b/libwmc/tests/Makefile.am @@ -1,5 +1,8 @@ include $(top_srcdir)/gtester.make +AM_CFLAGS = $(CODE_COVERAGE_CFLAGS) +AM_LDFLAGS = $(CODE_COVERAGE_LDFLAGS) + noinst_PROGRAMS = test-wmc TEST_PROGS += $(noinst_PROGRAMS) diff --git a/plugins/Makefile.am b/plugins/Makefile.am index d2cbcb1c..c29364db 100644 --- a/plugins/Makefile.am +++ b/plugins/Makefile.am @@ -3,6 +3,9 @@ include $(top_srcdir)/gtester.make # Common CPPFLAGS and LDFLAGS +AM_CFLAGS = $(CODE_COVERAGE_CFLAGS) +AM_LDFLAGS = $(CODE_COVERAGE_LDFLAGS) + PLUGIN_COMMON_COMPILER_FLAGS = \ $(MM_CFLAGS) \ $(GUDEV_CFLAGS) \ @@ -13,13 +16,15 @@ PLUGIN_COMMON_COMPILER_FLAGS = \ -I$(top_builddir)/include \ -I$(top_srcdir)/libmm-glib \ -I$(top_srcdir)/libmm-glib/generated \ - -I$(top_builddir)/libmm-glib/generated + -I$(top_builddir)/libmm-glib/generated \ + $(AM_CFLAGS) PLUGIN_COMMON_LINKER_FLAGS = \ $(GUDEV_LIBS) \ $(MM_LIBS) \ -module \ - -avoid-version + -avoid-version \ + $(AM_LDFLAGS) if WITH_QMI PLUGIN_COMMON_COMPILER_FLAGS += $(QMI_CFLAGS) diff --git a/src/Makefile.am b/src/Makefile.am index 6912b00e..3b545ee2 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -8,6 +8,9 @@ udevrules_DATA = \ 77-mm-usb-serial-adapters-greylist.rules \ 80-mm-candidate.rules +AM_CFLAGS = $(CODE_COVERAGE_CFLAGS) +AM_LDFLAGS = $(CODE_COVERAGE_LDFLAGS) + noinst_LTLIBRARIES = libmodem-helpers.la libport.la libmodem_helpers_la_CPPFLAGS = \ diff --git a/src/tests/Makefile.am b/src/tests/Makefile.am index c52e4d1d..0804b14f 100644 --- a/src/tests/Makefile.am +++ b/src/tests/Makefile.am @@ -1,5 +1,8 @@ include $(top_srcdir)/gtester.make +AM_CFLAGS = $(CODE_COVERAGE_CFLAGS) +AM_LDFLAGS = $(CODE_COVERAGE_LDFLAGS) + noinst_PROGRAMS = \ test-modem-helpers \ test-charsets \ |