Merge lp:~allanlesage/indicator-power/TDD into lp:indicator-power/1.0

Proposed by Allan LeSage
Status: Merged
Approved by: Charles Kerr
Approved revision: 132
Merged at revision: 139
Proposed branch: lp:~allanlesage/indicator-power/TDD
Merge into: lp:indicator-power/1.0
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-power/TDD
Reviewer Review Type Date Requested Status
Charles Kerr (community) Approve
Review via email: mp+100435@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
=== modified file 'Makefile.am'
--- Makefile.am 2012-02-14 22:06:04 +0000
+++ Makefile.am 2012-04-02 14:44:19 +0000
@@ -61,38 +61,4 @@
61 echo Failed to generate AUTHORS: not a branch >&2; \61 echo Failed to generate AUTHORS: not a branch >&2; \
62 fi62 fi
6363
6464include $(top_srcdir)/Makefile.am.coverage
65# Coverage targets
66
67.PHONY: clean-gcda
68clean-gcda:
69 @echo Removing old coverage results
70 -find -name '*.gcda' -print | xargs -r rm
71
72.PHONY: coverage-html generate-coverage-html clean-coverage-html
73coverage-html: clean-gcda
74 -$(MAKE) $(AM_MAKEFLAGS) -k check
75 $(MAKE) $(AM_MAKEFLAGS) generate-coverage-html
76
77generate-coverage-html:
78 @echo Collecting coverage data
79 $(LCOV) --directory $(top_builddir) --capture --output-file coverage.info --no-checksum --compat-libtool
80 LANG=C $(GENHTML) --prefix $(top_builddir) --output-directory coveragereport --title "Code Coverage" --legend --show-details coverage.info
81
82clean-coverage-html: clean-gcda
83 -$(LCOV) --directory $(top_builddir) -z
84 -rm -rf coverage.info coveragereport
85
86.PHONY: coverage-xml generate-coverage-xml clean-coverage-xml
87coverage-xml: clean-gcda
88 -$(MAKE) $(AM_MAKEFLAGS) -k check
89 $(MAKE) $(AM_MAKEFLAGS) generate-coverage-xml
90
91generate-coverage-xml:
92 @echo Generating coverage XML report
93 $(GCOVR) -x -r $(top_builddir) -o $(top_builddir)/coverage.xml
94
95clean-coverage-xml: clean-gcda
96 -rm -rf $(top_builddir)/coverage.xml
97
98clean-local: clean-coverage-html clean-coverage-xml
9965
=== added file 'Makefile.am.coverage'
--- Makefile.am.coverage 1970-01-01 00:00:00 +0000
+++ Makefile.am.coverage 2012-04-02 14:44:19 +0000
@@ -0,0 +1,48 @@
1
2# Coverage targets
3
4.PHONY: clean-gcno clean-gcda \
5 coverage-html generate-coverage-html clean-coverage-html \
6 coverage-gcovr generate-coverage-gcovr clean-coverage-gcovr
7
8clean-local: clean-gcno clean-coverage-html clean-coverage-gcovr
9
10if HAVE_GCOV
11
12clean-gcno:
13 @echo Removing old coverage instrumentation
14 -find -name '*.gcno' -print | xargs -r rm
15
16clean-gcda:
17 @echo Removing old coverage results
18 -find -name '*.gcda' -print | xargs -r rm
19
20coverage-html: clean-gcda
21 -$(MAKE) $(AM_MAKEFLAGS) -k check
22 $(MAKE) $(AM_MAKEFLAGS) generate-coverage-html
23
24generate-coverage-html:
25 @echo Collecting coverage data
26 $(LCOV) --directory $(top_builddir) --capture --output-file coverage.info --no-checksum --compat-libtool
27 LANG=C $(GENHTML) --prefix $(top_builddir) --output-directory coveragereport --title "Code Coverage" --legend --show-details coverage.info
28
29clean-coverage-html: clean-gcda
30 -$(LCOV) --directory $(top_builddir) -z
31 -rm -rf coverage.info coveragereport
32
33if HAVE_GCOVR
34
35coverage-gcovr: clean-gcda
36 -$(MAKE) $(AM_MAKEFLAGS) -k check
37 $(MAKE) $(AM_MAKEFLAGS) generate-coverage-gcovr
38
39generate-coverage-gcovr:
40 @echo Generating coverage GCOVR report
41 $(GCOVR) -x -r $(top_builddir) -o $(top_builddir)/coverage.xml
42
43clean-coverage-gcovr: clean-gcda
44 -rm -rf $(top_builddir)/coverage.xml
45
46endif # HAVE_GCOVR
47
48endif # HAVE_GCOV
049
=== modified file 'configure.ac'
--- configure.ac 2012-03-21 17:34:38 +0000
+++ configure.ac 2012-04-02 14:44:19 +0000
@@ -53,6 +53,9 @@
5353
54m4_include([m4/gcov.m4])54m4_include([m4/gcov.m4])
55AC_TDD_GCOV55AC_TDD_GCOV
56AM_CONDITIONAL([HAVE_GCOV], [test "x$ac_cv_check_gcov" = xyes])
57AM_CONDITIONAL([HAVE_LCOV], [test "x$ac_cv_check_lcov" = xyes])
58AM_CONDITIONAL([HAVE_GCOVR], [test "x$ac_cv_check_gcovr" = xyes])
56AC_SUBST(COVERAGE_CFLAGS)59AC_SUBST(COVERAGE_CFLAGS)
57AC_SUBST(COVERAGE_CXXFLAGS)60AC_SUBST(COVERAGE_CXXFLAGS)
58AC_SUBST(COVERAGE_LDFLAGS)61AC_SUBST(COVERAGE_LDFLAGS)
5962
=== modified file 'm4/gcov.m4'
--- m4/gcov.m4 2011-12-07 01:04:27 +0000
+++ m4/gcov.m4 2012-04-02 14:44:19 +0000
@@ -5,11 +5,10 @@
5# * gcovr5# * gcovr
6# 6#
7# Sets ac_cv_check_gcov to yes if tooling is present7# Sets ac_cv_check_gcov to yes if tooling is present
8# and reports the executables to the variables LCOV, GCOVR and GENHTML. 8# and reports the executables to the variables LCOV, GCOVR and GENHTML.
9AC_DEFUN([AC_TDD_GCOV],9AC_DEFUN([AC_TDD_GCOV],
10[AC_CACHE_CHECK([whether code coverage tools are available], ac_cv_check_gcov,
11[10[
12AC_ARG_ENABLE(gcov,11 AC_ARG_ENABLE(gcov,
13 AS_HELP_STRING([--enable-gcov],12 AS_HELP_STRING([--enable-gcov],
14 [enable coverage testing with gcov]),13 [enable coverage testing with gcov]),
15 [use_gcov=$enableval], [use_gcov=no])14 [use_gcov=$enableval], [use_gcov=no])
@@ -34,7 +33,6 @@
34 lcov_version_list="1.6 1.7 1.8 1.9"33 lcov_version_list="1.6 1.7 1.8 1.9"
35 AC_CHECK_PROG(LCOV, lcov, lcov)34 AC_CHECK_PROG(LCOV, lcov, lcov)
36 AC_CHECK_PROG(GENHTML, genhtml, genhtml)35 AC_CHECK_PROG(GENHTML, genhtml, genhtml)
37 AC_CHECK_PROG(GCOVR, gcovr, gcovr)
3836
39 if test "$LCOV"; then37 if test "$LCOV"; then
40 AC_CACHE_CHECK([for lcov version], glib_cv_lcov_version, [38 AC_CACHE_CHECK([for lcov version], glib_cv_lcov_version, [
@@ -63,10 +61,8 @@
63 AC_MSG_ERROR([Could not find genhtml from the lcov package])61 AC_MSG_ERROR([Could not find genhtml from the lcov package])
64 fi62 fi
6563
66 if test -z "$GCOVR"; then64 ac_cv_check_gcov=yes
67 AC_MSG_ERROR([Could not find gcovr; easy_install (or pip) gcovr])65 ac_cv_check_lcov=yes
68 fi
69
7066
71 # Remove all optimization flags from CFLAGS67 # Remove all optimization flags from CFLAGS
72 changequote({,})68 changequote({,})
@@ -78,6 +74,13 @@
78 COVERAGE_CXXFLAGS="-O0 -fprofile-arcs -ftest-coverage" 74 COVERAGE_CXXFLAGS="-O0 -fprofile-arcs -ftest-coverage"
79 COVERAGE_LDFLAGS="-lgcov"75 COVERAGE_LDFLAGS="-lgcov"
8076
77 # Check availability of gcovr
78 AC_CHECK_PROG(GCOVR, gcovr, gcovr)
79 if test -z "$GCOVR"; then
80 ac_cv_check_gcovr=no
81 else
82 ac_cv_check_gcovr=yes
83 fi
84
81fi85fi
82])]) # AC_TDD_GCOV86]) # AC_TDD_GCOV
83

Subscribers

People subscribed via source and target branches