Merge lp:~allanlesage/indicator-appmenu/TDD into lp:indicator-appmenu/0.4

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

Subscribers

People subscribed via source and target branches