Merge lp:~vrruiz/coverage-tutorial/have-gcov into lp:coverage-tutorial

Proposed by Víctor R. Ruiz
Status: Merged
Approved by: Allan LeSage
Approved revision: 6
Merged at revision: 3
Proposed branch: lp:~vrruiz/coverage-tutorial/have-gcov
Merge into: lp:coverage-tutorial
Diff against target: 82 lines (+21/-18)
2 files modified
Makefile.am.coverage (+11/-11)
gcov.m4 (+10/-7)
To merge this branch: bzr merge lp:~vrruiz/coverage-tutorial/have-gcov
Reviewer Review Type Date Requested Status
Allan LeSage Approve
Review via email: mp+119995@code.launchpad.net
To post a comment you must log in.
4. By Víctor R. Ruiz

Oops. Fix flag names.

5. By Víctor R. Ruiz

* Substitute coverage flags with --coverage
* Fix use_gcov=yes
* Only call to shtool if installed

6. By Víctor R. Ruiz

Use top indentation for Makefile.am.coverage (makes vim happy)

Revision history for this message
Allan LeSage (allanlesage) wrote :

Approve, thanks for your diligence; need to update with a couple of other items which have come up since publication.

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 2012-01-27 20:37:05 +0000
3+++ Makefile.am.coverage 2012-08-17 00:13:20 +0000
4@@ -3,25 +3,25 @@
5
6 if HAVE_GCOV
7
8- .PHONY: clean-gcda
9- clean-gcda:
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+
18+.PHONY: coverage-html generate-coverage-html clean-coverage-html
19+coverage-html: clean-gcda
20 -$(MAKE) $(AM_MAKEFLAGS) -k check
21 $(MAKE) $(AM_MAKEFLAGS) generate-coverage-html
22-
23- generate-coverage-html:
24+
25+generate-coverage-html:
26 @echo Collecting coverage data
27 $(LCOV) --directory $(top_builddir) --capture --output-file coverage.info --no-checksum --compat-libtool
28 LANG=C $(GENHTML) --prefix $(top_builddir) --output-directory coveragereport --title "Code Coverage" --legend --show-details coverage.info
29-
30- clean-coverage-html: clean-gcda
31+
32+clean-coverage-html: clean-gcda
33 -$(LCOV) --directory $(top_builddir) -z
34 -rm -rf coverage.info coveragereport
35-
36- clean-local: clean-coverage-html
37+
38+clean-local: clean-coverage-html
39
40 endif # HAVE_GCOV
41
42=== modified file 'gcov.m4'
43--- gcov.m4 2012-01-27 20:37:05 +0000
44+++ gcov.m4 2012-08-17 00:13:20 +0000
45@@ -11,7 +11,9 @@
46 AC_ARG_ENABLE(gcov,
47 AS_HELP_STRING([--enable-gcov],
48 [enable coverage testing with gcov]),
49- [use_gcov=$enableval], [use_gcov=no])
50+ [use_gcov=yes], [use_gcov=no])
51+
52+ AM_CONDITIONAL(HAVE_GCOV, test "x$use_gcov" = "xyes")
53
54 if test "x$use_gcov" = "xyes"; then
55 # we need gcc:
56@@ -21,10 +23,11 @@
57
58 # Check if ccache is being used
59 AC_CHECK_PROG(SHTOOL, shtool, shtool)
60- case `$SHTOOL path $CC` in
61- *ccache*[)] gcc_ccache=yes;;
62- *[)] gcc_ccache=no;;
63- esac
64+ if test "$SHTOOL"; then
65+ AS_CASE([`$SHTOOL path $CC`],
66+ [*ccache*], [gcc_ccache=yes],
67+ [gcc_ccache=no])
68+ fi
69
70 if test "$gcc_ccache" = "yes" && (test -z "$CCACHE_DISABLE" || test "$CCACHE_DISABLE" != "1"); then
71 AC_MSG_ERROR([ccache must be disabled when --enable-gcov option is used. You can disable ccache by setting environment variable CCACHE_DISABLE=1.])
72@@ -67,8 +70,8 @@
73 changequote([,])
74
75 # Add the special gcc flags
76- COVERAGE_CFLAGS="-O0 -fprofile-arcs -ftest-coverage"
77- COVERAGE_CXXFLAGS="-O0 -fprofile-arcs -ftest-coverage"
78+ COVERAGE_CFLAGS="--coverage"
79+ COVERAGE_CXXFLAGS="--coverage"
80 COVERAGE_LDFLAGS="-lgcov"
81
82 fi

Subscribers

People subscribed via source and target branches

to all changes: