Merge lp:~mikemc/unity-scope-click/fix-coverage into lp:unity-scope-click

Proposed by Mike McCracken
Status: Merged
Approved by: dobey
Approved revision: 102
Merged at revision: 103
Proposed branch: lp:~mikemc/unity-scope-click/fix-coverage
Merge into: lp:unity-scope-click
Diff against target: 186 lines (+64/-50)
4 files modified
Makefile.am.coverage (+37/-40)
acinclude.m4 (+24/-10)
configure.ac (+1/-0)
src/Makefile.am (+2/-0)
To merge this branch: bzr merge lp:~mikemc/unity-scope-click/fix-coverage
Reviewer Review Type Date Requested Status
dobey (community) Approve
PS Jenkins bot continuous-integration Approve
Roberto Alsina (community) Approve
Review via email: mp+200424@code.launchpad.net

Commit message

- Add coverage reporting for non-test vala files only.

Description of the change

- Add coverage reporting for non-test vala files only.

also removes gcovr support that doesn't work well with vala anyway

build with this to get coverage HTML
./autogen.sh --enable-gcov && make coverage-html

To post a comment you must log in.
Revision history for this message
Roberto Alsina (ralsina) wrote :

Looks good

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
dobey (dobey) wrote :

You mentioned you were going to update this to not strip the gcovr bits out, to keep it from diverging too much from upstream (where this really belongs, and which needs to be properly packaged).

review: Needs Information
101. By Mike McCracken

bring coverage support more into sync with 'upstream' at lp:~allanlesage/+junk/coverage-tools , so using that directly in the future will be easier

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
102. By Mike McCracken

add back check for HAVE_GCOVR

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
dobey (dobey) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Makefile.am.coverage'
2--- Makefile.am.coverage 2013-07-18 18:05:15 +0000
3+++ Makefile.am.coverage 2014-01-09 14:51:47 +0000
4@@ -1,48 +1,45 @@
5
6 # Coverage targets
7
8-.PHONY: clean-gcno clean-gcda \
9- coverage-html generate-coverage-html clean-coverage-html \
10- coverage-gcovr generate-coverage-gcovr clean-coverage-gcovr
11-
12-clean-local: clean-gcno clean-coverage-html clean-coverage-gcovr
13-
14 if HAVE_GCOV
15
16-clean-gcno:
17- @echo Removing old coverage instrumentation
18- -find -name '*.gcno' -print | xargs -r rm
19-
20-clean-gcda:
21+ .PHONY: clean-data
22+ clean-data:
23 @echo Removing old coverage results
24- -find -name '*.gcda' -print | xargs -r rm
25-
26-coverage-html: clean-gcda
27- -$(MAKE) $(AM_MAKEFLAGS) -k check
28- $(MAKE) $(AM_MAKEFLAGS) generate-coverage-html
29-
30-generate-coverage-html:
31- @echo Collecting coverage data
32- $(LCOV) --directory $(top_builddir) --capture --output-file coverage.info --no-checksum --compat-libtool
33- LANG=C $(GENHTML) --prefix $(top_builddir) --output-directory coveragereport --title "Code Coverage" --legend --show-details coverage.info
34-
35-clean-coverage-html: clean-gcda
36- -$(LCOV) --directory $(top_builddir) -z
37- -rm -rf coverage.info coveragereport
38-
39-if HAVE_GCOVR
40-
41-coverage-gcovr: clean-gcda
42- -$(MAKE) $(AM_MAKEFLAGS) -k check
43- $(MAKE) $(AM_MAKEFLAGS) generate-coverage-gcovr
44-
45-generate-coverage-gcovr:
46- @echo Generating coverage GCOVR report
47- $(GCOVR) -x -r $(top_builddir) -o $(top_builddir)/coverage.xml
48-
49-clean-coverage-gcovr: clean-gcda
50- -rm -rf $(top_builddir)/coverage.xml
51-
52-endif # HAVE_GCOVR
53+ $(AM_V_at)-find -name '*.gcda' -print0 | xargs -0 -r rm
54+ $(AM_V_at)-find -name '*.gcno' -print0 | xargs -0 -r rm
55+
56+ .PHONY: coverage-html generate-coverage-html clean-coverage-html
57+ coverage-html: clean-data
58+ $(AM_V_at)-$(MAKE) $(AM_MAKEFLAGS) -k check
59+ $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) generate-coverage-html
60+
61+ collect-coverage-data:
62+ $(LCOV_verbose) --directory $(top_builddir) --capture --output-file coverage.info --no-checksum --compat-libtool
63+
64+ generate-coverage-html: collect-coverage-data
65+ $(LCOV_verbose) --output-file $(top_builddir)/coverage.info --remove $(top_builddir)/coverage.info "*.c" "*.h" "*.vapi" "/usr/share/vala*" "test-*"
66+ $(GENHTML_verbose) --prefix $(top_builddir) --output-directory coveragereport --title "Code Coverage" --legend --show-details --demangle-cpp coverage.info
67+
68+ clean-coverage-html: clean-data
69+ @echo Removing coverage HTML report
70+ $(AM_V_at)-$(LCOV_verbose) --directory $(top_builddir) -z
71+ $(AM_V_at)-rm -rf coverage.info coveragereport
72+
73+ .PHONY: coverage-xml generate-coverage-xml clean-coverage-xml
74+ coverage-xml: clean-data
75+ @echo Running test suite
76+ $(AM_V_at)-$(MAKE) $(AM_MAKEFLAGS) -k check
77+ $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) generate-coverage-xml
78+
79+ generate-coverage-xml:
80+ @echo " GEN coverage.xml"
81+ $(AM_V_at)$(GCOVR_verbose) -x -r $(top_builddir) -o $(top_builddir)/coverage.xml --object-directory=$(abs_builddir)/.libs
82+
83+ clean-coverage-xml: clean-data
84+ @echo Removing coverage XML report
85+ $(AM_V_at)-rm -rf $(top_builddir)/coverage.xml
86+
87+ clean-local: clean-coverage-html clean-coverage-xml
88
89 endif # HAVE_GCOV
90
91=== modified file 'acinclude.m4'
92--- acinclude.m4 2013-12-17 17:30:12 +0000
93+++ acinclude.m4 2014-01-09 14:51:47 +0000
94@@ -70,9 +70,10 @@
95 AC_MSG_ERROR([ccache must be disabled when --enable-gcov option is used. You can disable ccache by setting environment variable CCACHE_DISABLE=1.])
96 fi
97
98- lcov_version_list="1.6 1.7 1.8 1.9"
99+ lcov_version_list="1.6 1.7 1.8 1.9 1.10"
100 AC_CHECK_PROG(LCOV, lcov, lcov)
101 AC_CHECK_PROG(GENHTML, genhtml, genhtml)
102+ AC_CHECK_PROG(GCOVR, gcovr, gcovr)
103
104 if test "$LCOV"; then
105 AC_CACHE_CHECK([for lcov version], glib_cv_lcov_version, [
106@@ -101,26 +102,39 @@
107 AC_MSG_ERROR([Could not find genhtml from the lcov package])
108 fi
109
110+ if test -z "$GCOVR"; then
111+ AC_MSG_ERROR([Could not find gcovr; easy_install (or pip) gcovr])
112+ fi
113+
114 ac_cv_check_gcov=yes
115- ac_cv_check_lcov=yes
116
117 # Remove all optimization flags from CFLAGS
118 changequote({,})
119 CFLAGS=`echo "$CFLAGS" | $SED -e 's/-O[0-9]*//g'`
120+ CXXFLAGS=`echo "$CXXFLAGS" | $SED -e 's/-O[0-9]*//g'`
121 changequote([,])
122
123 # Add the special gcc flags
124 COVERAGE_CFLAGS="-O0 -fprofile-arcs -ftest-coverage"
125 COVERAGE_CXXFLAGS="-O0 -fprofile-arcs -ftest-coverage"
126 COVERAGE_LDFLAGS="-lgcov"
127-
128- # Check availability of gcovr
129- AC_CHECK_PROG(GCOVR, gcovr, gcovr)
130- if test -z "$GCOVR"; then
131- ac_cv_check_gcovr=no
132- else
133- ac_cv_check_gcovr=yes
134- fi
135+ COVERAGE_VALAFLAGS="--debug"
136+
137+ # Define verbose versions of the tools
138+ AC_SUBST(LCOV_verbose, '$(LCOV_verbose_$(V))')
139+ AC_SUBST(LCOV_verbose_, '$(LCOV_verbose_$(AM_DEFAULT_VERBOSITY))')
140+ AC_SUBST(LCOV_verbose_0, '@$(LCOV) --quiet')
141+ AC_SUBST(LCOV_verbose_1, '$(LCOV)')
142+
143+ AC_SUBST(GENHTML_verbose, '$(GENHTML_verbose_$(V))')
144+ AC_SUBST(GENHTML_verbose_, '$(GENHTML_verbose_$(AM_DEFAULT_VERBOSITY))')
145+ AC_SUBST(GENHTML_verbose_0, '@LANG=C $(GENHTML) --quiet')
146+ AC_SUBST(GENHTML_verbose_1, 'LANG=C $(GENHTML)')
147+
148+ AC_SUBST(GCOVR_verbose, '$(GCOVR_verbose_$())')
149+ AC_SUBST(GCOVR_verbose_, '$(GCOVR_verbose_$(AM_DEFAULT_VERBOSITY))')
150+ AC_SUBST(GCOVR_verbose_0, '@$(GCOVR)')
151+ AC_SUBST(GCOVR_verbose_1, '$(GCOVR) -v')
152
153 fi
154 ]) # AC_TDD_GCOV
155
156=== modified file 'configure.ac'
157--- configure.ac 2013-12-17 17:30:12 +0000
158+++ configure.ac 2014-01-09 14:51:47 +0000
159@@ -34,6 +34,7 @@
160 AM_CONDITIONAL([HAVE_GCOVR], [test "x$ac_cv_check_gcovr" = xyes])
161 AC_SUBST(COVERAGE_CFLAGS)
162 AC_SUBST(COVERAGE_LDFLAGS)
163+AC_SUBST(COVERAGE_VALAFLAGS)
164
165 #####################################################
166 # Check for module and library dependancies
167
168=== modified file 'src/Makefile.am'
169--- src/Makefile.am 2013-12-18 19:19:12 +0000
170+++ src/Makefile.am 2014-01-09 14:51:47 +0000
171@@ -21,6 +21,7 @@
172 libclickscope.la
173
174 libclickscope_la_VALAFLAGS = \
175+ $(COVERAGE_VALAFLAGS) \
176 --thread \
177 --vapidir $(srcdir) \
178 --vapidir $(builddir) \
179@@ -67,6 +68,7 @@
180 click-scope-main.vala
181
182 test_click_scope_VALAFLAGS = \
183+ $(COVERAGE_VALAFLAGS) \
184 --thread \
185 --pkg oauth \
186 --pkg signon \

Subscribers

People subscribed via source and target branches

to all changes: