From e68baa746395f4d5c7b8ab16093c044026b2d1fd Mon Sep 17 00:00:00 2001 From: Dan Nicholson Date: Fri, 28 Sep 2012 05:45:37 -0700 Subject: Add optional usage of gcov for test coverage Use gcov to find how much code coverage our current testing gets. This can be enabled by passing --with-gcov to configure and running "make gcov". This is limited to gcc. Here's a run from the current code (for some reason, gcov insists on profiling gstring.h). /usr/bin/gcov pkg.h pkg.c parse.h parse.c main.c File 'pkg.c' Lines executed:73.16% of 611 pkg.c:creating 'pkg.c.gcov' File '/usr/include/glib-2.0/glib/gstring.h' Lines executed:100.00% of 6 /usr/include/glib-2.0/glib/gstring.h:creating 'gstring.h.gcov' File 'parse.c' Lines executed:79.67% of 492 parse.c:creating 'parse.c.gcov' File 'main.c' Lines executed:57.34% of 293 main.c:creating 'main.c.gcov' --- Makefile.am | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'Makefile.am') diff --git a/Makefile.am b/Makefile.am index 0e58512..9c224ac 100644 --- a/Makefile.am +++ b/Makefile.am @@ -24,6 +24,7 @@ endif AM_CFLAGS = \ $(WARN_CFLAGS) \ + $(GCOV_CFLAGS) \ $(GLIB_CFLAGS) bin_PROGRAMS = pkg-config @@ -42,6 +43,12 @@ dist_doc_DATA = pkg-config-guide.html dist_man_MANS = pkg-config.1 EXTRA_DIST = README.win32 +# gcov test coverage +gcov: + -$(MAKE) $(AM_MAKEFLAGS) -k check + $(GCOV) $(pkg_config_SOURCES) +CLEANFILES = *.gcda *.gcno *.gcov + # Since we can't always have glib in DIST_SUBDIRS, we need to make sure # glib is configured when we want to run dist. Unfortunately, there's no # DIST_CONFIGURE_FLAGS. -- cgit v1.2.1