Merge lp:~allanlesage/indicator-application/TDD into lp:indicator-application/0.5

Proposed by Allan LeSage on 2012-04-02
Status: Merged
Approved by: Charles Kerr on 2012-04-11
Approved revision: 231
Merged at revision: 231
Proposed branch: lp:~allanlesage/indicator-application/TDD
Merge into: lp:indicator-application/0.5
Diff against target: 175 lines (+65/-47)
4 files modified
Makefile.am (+1/-34)
Makefile.am.coverage (+48/-0)
configure.ac (+3/-3)
m4/gcov.m4 (+13/-10)
To merge this branch: bzr merge lp:~allanlesage/indicator-application/TDD
Reviewer Review Type Date Requested Status
Charles Kerr (community) 2012-04-02 Approve on 2012-04-11
Review via email: mp+100430@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.
Charles Kerr (charlesk) wrote :

This patch looks familiar.

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 2011-12-06 21:49:39 +0000
3+++ Makefile.am 2012-04-02 14:40:28 +0000
4@@ -34,37 +34,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:40:28 +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 21:24:53 +0000
99+++ configure.ac 2012-04-02 14:40:28 +0000
100@@ -75,17 +75,17 @@
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 AC_SUBST(INDICATOR_CFLAGS)
112 AC_SUBST(INDICATOR_LIBS)
113-
114 AC_SUBST(APPINDICATOR_CFLAGS)
115 AC_SUBST(APPINDICATOR_LIBS)
116
117-
118 ###########################
119 # Check to see if we're local
120 ###########################
121
122=== modified file 'm4/gcov.m4'
123--- m4/gcov.m4 2011-12-06 21:49:39 +0000
124+++ m4/gcov.m4 2012-04-02 14:40:28 +0000
125@@ -5,11 +5,10 @@
126 # * gcovr
127 #
128 # Sets ac_cv_check_gcov to yes if tooling is present
129-# and reports the executables to the variables LCOV, GCOVR and GENHTML.
130+# and reports the executables to the variables LCOV, GCOVR and GENHTML.
131 AC_DEFUN([AC_TDD_GCOV],
132-[AC_CACHE_CHECK([whether code coverage tools are available], ac_cv_check_gcov,
133 [
134-AC_ARG_ENABLE(gcov,
135+ AC_ARG_ENABLE(gcov,
136 AS_HELP_STRING([--enable-gcov],
137 [enable coverage testing with gcov]),
138 [use_gcov=$enableval], [use_gcov=no])
139@@ -34,7 +33,6 @@
140 lcov_version_list="1.6 1.7 1.8 1.9"
141 AC_CHECK_PROG(LCOV, lcov, lcov)
142 AC_CHECK_PROG(GENHTML, genhtml, genhtml)
143- AC_CHECK_PROG(GCOVR, gcovr, gcovr)
144
145 if test "$LCOV"; then
146 AC_CACHE_CHECK([for lcov version], glib_cv_lcov_version, [
147@@ -63,10 +61,8 @@
148 AC_MSG_ERROR([Could not find genhtml from the lcov package])
149 fi
150
151- if test -z "$GCOVR"; then
152- AC_MSG_ERROR([Could not find gcovr; easy_install (or pip) gcovr])
153- fi
154-
155+ ac_cv_check_gcov=yes
156+ ac_cv_check_lcov=yes
157
158 # Remove all optimization flags from CFLAGS
159 changequote({,})
160@@ -78,6 +74,13 @@
161 COVERAGE_CXXFLAGS="-O0 -fprofile-arcs -ftest-coverage"
162 COVERAGE_LDFLAGS="-lgcov"
163
164+ # Check availability of gcovr
165+ AC_CHECK_PROG(GCOVR, gcovr, gcovr)
166+ if test -z "$GCOVR"; then
167+ ac_cv_check_gcovr=no
168+ else
169+ ac_cv_check_gcovr=yes
170+ fi
171+
172 fi
173-])]) # AC_TDD_GCOV
174-
175+]) # AC_TDD_GCOV

Subscribers

People subscribed via source and target branches