~charlesk/appmenu-gtk/lp-788640

« back to all changes in this revision

Viewing changes to Makefile.am.coverage

  • Committer: Charles Kerr
  • Date: 2012-04-04 02:24:41 UTC
  • mfrom: (147.1.1 appmenu-gtk)
  • Revision ID: charles.kerr@canonical.com-20120404022441-y5gtl1le61xc6jz2
merge lp:~allanlesage/appmenu-gtk/TDD to add gcov targets to autotools build for code-coverage reporting. For more information, see this blog post: http://qualityhour.wordpress.com/2012/01/29/test-coverage-tutorial-for-cc-autotools-projects/

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
 
8
clean-local: clean-gcno clean-coverage-html clean-coverage-gcovr
 
9
 
 
10
if HAVE_GCOV
 
11
 
 
12
clean-gcno:
 
13
        @echo Removing old coverage instrumentation
 
14
        -find -name '*.gcno' -print | xargs -r rm
 
15
 
 
16
clean-gcda:
 
17
        @echo Removing old coverage results
 
18
        -find -name '*.gcda' -print | xargs -r rm
 
19
  
 
20
coverage-html: clean-gcda
 
21
        -$(MAKE) $(AM_MAKEFLAGS) -k check
 
22
        $(MAKE) $(AM_MAKEFLAGS) generate-coverage-html
 
23
  
 
24
generate-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
  
 
29
clean-coverage-html: clean-gcda
 
30
        -$(LCOV) --directory $(top_builddir) -z
 
31
        -rm -rf coverage.info coveragereport
 
32
 
 
33
if HAVE_GCOVR
 
34
 
 
35
coverage-gcovr: clean-gcda
 
36
        -$(MAKE) $(AM_MAKEFLAGS) -k check
 
37
        $(MAKE) $(AM_MAKEFLAGS) generate-coverage-gcovr
 
38
        
 
39
generate-coverage-gcovr:
 
40
        @echo Generating coverage GCOVR report
 
41
        $(GCOVR) -x -r $(top_builddir) -o $(top_builddir)/coverage.xml
 
42
        
 
43
clean-coverage-gcovr: clean-gcda
 
44
        -rm -rf $(top_builddir)/coverage.xml
 
45
 
 
46
endif # HAVE_GCOVR
 
47
 
 
48
endif # HAVE_GCOV