Merge lp:~allanlesage/libindicate/TDD into lp:libindicate/0.7

Proposed by Allan LeSage
Status: Merged
Approved by: Charles Kerr
Approved revision: 447
Merged at revision: 453
Proposed branch: lp:~allanlesage/libindicate/TDD
Merge into: lp:libindicate/0.7
Diff against target: 164 lines (+65/-44)
4 files modified
Makefile.am (+1/-34)
Makefile.am.coverage (+48/-0)
configure.ac (+3/-0)
m4/gcov.m4 (+13/-10)
To merge this branch: bzr merge lp:~allanlesage/libindicate/TDD
Reviewer Review Type Date Requested Status
Charles Kerr (community) Approve
Review via email: mp+100433@code.launchpad.net

Description of the change

This revision of autotools code-coverage reporting removes a dependency on gcovr, moves gcov targets to their own makefile, and cleans up .gcno files.

To post a comment you must log in.
Revision history for this message
Charles Kerr (charlesk) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Makefile.am'
2--- Makefile.am 2012-02-10 03:27:57 +0000
3+++ Makefile.am 2012-04-02 14:42:44 +0000
4@@ -59,37 +59,4 @@
5 fi
6
7
8-# Coverage targets
9-
10-.PHONY: clean-gcda
11-clean-gcda:
12- @echo Removing old coverage results
13- -find -name '*.gcda' -print | xargs -r rm
14-
15-.PHONY: coverage-html generate-coverage-html clean-coverage-html
16-coverage-html: clean-gcda
17- -$(MAKE) $(AM_MAKEFLAGS) -k check
18- $(MAKE) $(AM_MAKEFLAGS) generate-coverage-html
19-
20-generate-coverage-html:
21- @echo Collecting coverage data
22- $(LCOV) --directory $(top_builddir) --capture --output-file coverage.info --no-checksum --compat-libtool
23- LANG=C $(GENHTML) --prefix $(top_builddir) --output-directory coveragereport --title "Code Coverage" --legend --show-details coverage.info
24-
25-clean-coverage-html: clean-gcda
26- -$(LCOV) --directory $(top_builddir) -z
27- -rm -rf coverage.info coveragereport
28-
29-.PHONY: coverage-xml generate-coverage-xml clean-coverage-xml
30-coverage-xml: clean-gcda
31- -$(MAKE) $(AM_MAKEFLAGS) -k check
32- $(MAKE) $(AM_MAKEFLAGS) generate-coverage-xml
33-
34-generate-coverage-xml:
35- @echo Generating coverage XML report
36- $(GCOVR) -x -r $(top_builddir) -o $(top_builddir)/coverage.xml
37-
38-clean-coverage-xml: clean-gcda
39- -rm -rf $(top_builddir)/coverage.xml
40-
41-clean-local: clean-coverage-html clean-coverage-xml
42+include $(top_srcdir)/Makefile.am.coverage
43
44=== added file 'Makefile.am.coverage'
45--- Makefile.am.coverage 1970-01-01 00:00:00 +0000
46+++ Makefile.am.coverage 2012-04-02 14:42:44 +0000
47@@ -0,0 +1,48 @@
48+
49+# Coverage targets
50+
51+.PHONY: clean-gcno clean-gcda \
52+ coverage-html generate-coverage-html clean-coverage-html \
53+ coverage-gcovr generate-coverage-gcovr clean-coverage-gcovr
54+
55+clean-local: clean-gcno clean-coverage-html clean-coverage-gcovr
56+
57+if HAVE_GCOV
58+
59+clean-gcno:
60+ @echo Removing old coverage instrumentation
61+ -find -name '*.gcno' -print | xargs -r rm
62+
63+clean-gcda:
64+ @echo Removing old coverage results
65+ -find -name '*.gcda' -print | xargs -r rm
66+
67+coverage-html: clean-gcda
68+ -$(MAKE) $(AM_MAKEFLAGS) -k check
69+ $(MAKE) $(AM_MAKEFLAGS) generate-coverage-html
70+
71+generate-coverage-html:
72+ @echo Collecting coverage data
73+ $(LCOV) --directory $(top_builddir) --capture --output-file coverage.info --no-checksum --compat-libtool
74+ LANG=C $(GENHTML) --prefix $(top_builddir) --output-directory coveragereport --title "Code Coverage" --legend --show-details coverage.info
75+
76+clean-coverage-html: clean-gcda
77+ -$(LCOV) --directory $(top_builddir) -z
78+ -rm -rf coverage.info coveragereport
79+
80+if HAVE_GCOVR
81+
82+coverage-gcovr: clean-gcda
83+ -$(MAKE) $(AM_MAKEFLAGS) -k check
84+ $(MAKE) $(AM_MAKEFLAGS) generate-coverage-gcovr
85+
86+generate-coverage-gcovr:
87+ @echo Generating coverage GCOVR report
88+ $(GCOVR) -x -r $(top_builddir) -o $(top_builddir)/coverage.xml
89+
90+clean-coverage-gcovr: clean-gcda
91+ -rm -rf $(top_builddir)/coverage.xml
92+
93+endif # HAVE_GCOVR
94+
95+endif # HAVE_GCOV
96
97=== modified file 'configure.ac'
98--- configure.ac 2012-03-21 20:40:12 +0000
99+++ configure.ac 2012-04-02 14:42:44 +0000
100@@ -117,6 +117,9 @@
101
102 m4_include([m4/gcov.m4])
103 AC_TDD_GCOV
104+AM_CONDITIONAL([HAVE_GCOV], [test "x$ac_cv_check_gcov" = xyes])
105+AM_CONDITIONAL([HAVE_LCOV], [test "x$ac_cv_check_lcov" = xyes])
106+AM_CONDITIONAL([HAVE_GCOVR], [test "x$ac_cv_check_gcovr" = xyes])
107 AC_SUBST(COVERAGE_CFLAGS)
108 AC_SUBST(COVERAGE_CXXFLAGS)
109 AC_SUBST(COVERAGE_LDFLAGS)
110
111=== modified file 'm4/gcov.m4'
112--- m4/gcov.m4 2011-12-08 16:17:34 +0000
113+++ m4/gcov.m4 2012-04-02 14:42:44 +0000
114@@ -5,11 +5,10 @@
115 # * gcovr
116 #
117 # Sets ac_cv_check_gcov to yes if tooling is present
118-# and reports the executables to the variables LCOV, GCOVR and GENHTML.
119+# and reports the executables to the variables LCOV, GCOVR and GENHTML.
120 AC_DEFUN([AC_TDD_GCOV],
121-[AC_CACHE_CHECK([whether code coverage tools are available], ac_cv_check_gcov,
122 [
123-AC_ARG_ENABLE(gcov,
124+ AC_ARG_ENABLE(gcov,
125 AS_HELP_STRING([--enable-gcov],
126 [enable coverage testing with gcov]),
127 [use_gcov=$enableval], [use_gcov=no])
128@@ -34,7 +33,6 @@
129 lcov_version_list="1.6 1.7 1.8 1.9"
130 AC_CHECK_PROG(LCOV, lcov, lcov)
131 AC_CHECK_PROG(GENHTML, genhtml, genhtml)
132- AC_CHECK_PROG(GCOVR, gcovr, gcovr)
133
134 if test "$LCOV"; then
135 AC_CACHE_CHECK([for lcov version], glib_cv_lcov_version, [
136@@ -63,10 +61,8 @@
137 AC_MSG_ERROR([Could not find genhtml from the lcov package])
138 fi
139
140- if test -z "$GCOVR"; then
141- AC_MSG_ERROR([Could not find gcovr; easy_install (or pip) gcovr])
142- fi
143-
144+ ac_cv_check_gcov=yes
145+ ac_cv_check_lcov=yes
146
147 # Remove all optimization flags from CFLAGS
148 changequote({,})
149@@ -78,6 +74,13 @@
150 COVERAGE_CXXFLAGS="-O0 -fprofile-arcs -ftest-coverage"
151 COVERAGE_LDFLAGS="-lgcov"
152
153+ # Check availability of gcovr
154+ AC_CHECK_PROG(GCOVR, gcovr, gcovr)
155+ if test -z "$GCOVR"; then
156+ ac_cv_check_gcovr=no
157+ else
158+ ac_cv_check_gcovr=yes
159+ fi
160+
161 fi
162-])]) # AC_TDD_GCOV
163-
164+]) # AC_TDD_GCOV

Subscribers

People subscribed via source and target branches