Merge lp:~vrruiz/gnome-control-center-signon/coverage-fixes into lp:gnome-control-center-signon

Proposed by Víctor R. Ruiz
Status: Needs review
Proposed branch: lp:~vrruiz/gnome-control-center-signon/coverage-fixes
Merge into: lp:gnome-control-center-signon
Diff against target: 121 lines (+41/-27)
3 files modified
Makefile.am (+7/-20)
Makefile.am.coverage (+26/-0)
configure.ac (+8/-7)
To merge this branch: bzr merge lp:~vrruiz/gnome-control-center-signon/coverage-fixes
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
David King (community) Needs Fixing
Review via email: mp+137972@code.launchpad.net

Description of the change

Move from --enable-lcov to --enable-gcov and make coverage-xml

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
David King (amigadave) wrote :

I do not see the Makefile.am.coverage file being added, and when I run autogen.sh from a clean checkout I get:

automake-1.11: cannot open < Makefile.am.coverage: No such file or directory

Did you test this? Additionally, you have provided no justification for this change in the description. Is it to match other webapps or Product Strategy projects, and if so, is the coverage Makefile.am snippet in a common repository anywhere?

review: Needs Fixing
126. By Víctor R. Ruiz

Add Makefile.am.coverage

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Víctor R. Ruiz (vrruiz) wrote :

Yes, I tested this, but I forgot to add the file. Already done. Makefile.am.coverage is the file we are using in PS QA with standard rules, available at lp:coverage-tutorial

Revision history for this message
David King (amigadave) wrote :

OK, but there are a few problems with this that should be fixed:

* it does not support the automake silent rule predefined variables (for example, AM_V_at and AM_V_GEN)
* it adds a dependency on gcovr and does not check for it in configure.ac
* it redefines the "clean-local" and ".PHONY" targets that are already defined in Makefile.am
* find does not need to use xargs, it can call rm directly
* "pwd" is used in the "generate-coverage-xml" rule, when one of the standard automake variables should be used (either "top_builddir" or "top_srcdir" I guess)
* it uses echo to print some messages to stdout, which ignores the silent rules setting. if those are desired, some custom verbosity rules should be added instead, much like the automake silent rule predefined variables

review: Needs Fixing
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
127. By Víctor R. Ruiz

Fix make rule clean-gcda

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
128. By Víctor R. Ruiz

Silent support for Makefile.am.coverage

129. By Víctor R. Ruiz

Add gcovr check to configure.ac

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

Unmerged revisions

129. By Víctor R. Ruiz

Add gcovr check to configure.ac

128. By Víctor R. Ruiz

Silent support for Makefile.am.coverage

127. By Víctor R. Ruiz

Fix make rule clean-gcda

126. By Víctor R. Ruiz

Add Makefile.am.coverage

125. By Víctor R. Ruiz

Standardized coverage make rules

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-10-29 22:59:14 +0000
3+++ Makefile.am 2012-12-05 17:32:29 +0000
4@@ -323,28 +323,16 @@
5 OtherService.service)
6
7 # Code coverage reporting.
8-if CREDENTIALS_ENABLE_LCOV
9+if CREDENTIALS_ENABLE_GCOV
10 # Depend on full-report so that all the tests are run.
11-lcov: full-report
12- $(AM_V_at)$(LCOV) --base-directory $(top_builddir) \
13- --directory $(top_builddir)/src --capture \
14- --output-file credentials-lcov.info --test-name CREDENTIALS \
15- --no-checksum --compat-libtool
16- $(AM_V_at)LANG=C $(LCOV_GENHTML) --prefix $(top_builddir) \
17- --output-directory credentials-lcov \
18- --title "Credentials code coverage" --legend --show-details \
19- credentials-lcov.info
20+include $(top_srcdir)/Makefile.am.coverage
21
22-lcov-clean:
23- $(AM_V_at)$(LCOV) --directory $(top_builddir) -z
24- $(AM_V_at)rm -rf credentials-lcov.info credentials-lcov
25- $(AM_V_at)find -name '*.gcda' -exec rm -f {} +
26-else # !CREDENTIALS_ENABLE_LCOV
27-lcov:
28+else # !CREDENTIALS_ENABLE_GCOV
29+coverage:
30 $(AM_V_at)echo "Code coverage reporting not available"
31
32-lcov-clean:
33- $(AM_V_at)rm -rf credentials-lcov.info credentials-lcov
34+clean-gcda:
35+ $(AM_V_at)rm -rf coverage.info coverage.xml coverage-html
36 $(AM_V_at)find -name '*.gcda' -exec rm -f {} +
37 endif
38
39@@ -420,7 +408,7 @@
40 cd $(gtkdoc_builddir) && $(MAKE) $(AM_MAKEFLAGS) all
41 check-local: test
42 cd $(gtkdoc_builddir) && $(MAKE) $(AM_MAKEFLAGS) check
43-clean-local: lcov-clean
44+clean-local: clean-gcda
45 cd $(gtkdoc_builddir) && $(MAKE) $(AM_MAKEFLAGS) clean
46 find -name '*.gcno' -exec rm -f {} +
47 distclean-local:
48@@ -536,4 +524,3 @@
49 .PHONY: docs
50 .PHONY: install-update-icon-cache uninstall-update-icon-cache
51 .PHONY: test test-report perf-report full-report
52-.PHONY: lcov lcov-clean
53
54=== added file 'Makefile.am.coverage'
55--- Makefile.am.coverage 1970-01-01 00:00:00 +0000
56+++ Makefile.am.coverage 2012-12-05 17:32:29 +0000
57@@ -0,0 +1,26 @@
58+
59+# Coverage targets
60+
61+.PHONY: clean-gcda
62+clean-gcda:
63+ $(AM_V_at)echo Removing old coverage
64+ $(AM_V_at)find -name '*.gcda' -print | xargs -r rm
65+
66+.PHONY: coverage-html coverage-xml generate-coverage-html clean-coverage-html
67+coverage-html: clean-gcda full-report
68+ $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) generate-coverage-html
69+
70+coverage-xml: clean-gcda full-report
71+ $(AM_V_at)gcovr --xml -r $(top_builddir) -o "$(top_builddir)/coverage.xml" --exclude='.*tests.*'
72+
73+generate-coverage-html:
74+ @echo Collecting coverage data
75+ $(AM_V_at)$(LCOV) --directory $(top_builddir) --capture --output-file coverage.info --no-checksum --compat-libtool
76+ $(AM_V_at)$(LCOV) --extract coverage.info "`pwd`/src/*" --extract coverage.info "`pwd`/libaccount-plugin/*" --output-file coverage-src.info
77+ $(AM_V_at)LANG=C $(LCOV_GENHTML) --prefix $(top_builddir) --output-directory coverage-html --title "Code Coverage" --legend --show-details coverage-src.info
78+
79+clean-coverage-html: clean-gcda
80+ $(AM_V_at)$(LCOV) --directory $(top_builddir) -z
81+ $(AM_V_at)rm -rf coverage.info coverage-src.info coverage-html
82+
83+
84
85=== modified file 'configure.ac'
86--- configure.ac 2012-10-29 15:31:34 +0000
87+++ configure.ac 2012-12-05 17:32:29 +0000
88@@ -106,14 +106,15 @@
89 AC_SUBST([GTESTER_REPORT])])
90 AM_CONDITIONAL([CREDENTIALS_ENABLE_TESTS], [test "x$CREDENTIALS_ENABLE_TESTS" = "xtrue"])
91
92-# Check for lcov.
93-AC_ARG_ENABLE([lcov],
94- [AS_HELP_STRING([--disable-lcov], [Disable lcov code coverage testing])])
95+# Check for gcov.
96+AC_ARG_ENABLE([gcov],
97+ [AS_HELP_STRING([--disable-gcov], [Disable gcov code coverage testing])])
98
99-AS_IF([test "x$enable_lcov" != "xno"],
100+AS_IF([test "x$enable_gcov" != "xno"],
101 [AC_PATH_PROG([LCOV], [lcov], [notfound])
102+ AC_PATH_PROG([GCOVR], [gcovr], [notfound])
103 AC_PATH_PROG([LCOV_GENHTML], [genhtml], [notfound])
104- AS_IF([test "x$LCOV" = "xnotfound" -o "x$LCOV_GENHTML" = "xnotfound"],
105+ AS_IF([test "x$LCOV" = "xnotfound" -o "x$LCOV_GENHTML" = "xnotfound" -o "x$GCOVR" = "xnotfound" ],
106 [have_lcov=no],
107 [have_lcov=yes])],
108 [have_lcov=no])
109@@ -123,10 +124,10 @@
110 AC_SUBST([LCOV_GENHTML])
111 CFLAGS="$CFLAGS -O0 -fprofile-arcs -ftest-coverage"
112 LDFLAGS="$LDFLAGS -lgcov"],
113- [AS_IF([test "x$enable_lcov" = "xyes"],
114+ [AS_IF([test "x$enable_gcov" = "xyes"],
115 [AC_MSG_ERROR([lcov code coverage reporting requested but not found])])])
116
117-AM_CONDITIONAL([CREDENTIALS_ENABLE_LCOV], [test "x$have_lcov" = "xyes"])
118+AM_CONDITIONAL([CREDENTIALS_ENABLE_GCOV], [test "x$have_lcov" = "xyes"])
119
120 # Mallard help.
121 YELP_HELP_INIT

Subscribers

People subscribed via source and target branches