Merge lp:~jpakkane/unity-lens-video/coverage into lp:~stolowski/unity-lens-video/vala-rewrite

Proposed by Jussi Pakkanen
Status: Merged
Approved by: Paweł Stołowski
Approved revision: 157
Merged at revision: 156
Proposed branch: lp:~jpakkane/unity-lens-video/coverage
Merge into: lp:~stolowski/unity-lens-video/vala-rewrite
Diff against target: 269 lines (+171/-7)
7 files modified
Makefile.am (+2/-0)
Makefile.am.coverage (+48/-0)
configure.ac (+16/-0)
m4/gcov.m4 (+86/-0)
src/Makefile.am (+3/-0)
tests/unit/Makefile.am (+15/-7)
tests/unit/config-tests.vala.in (+1/-0)
To merge this branch: bzr merge lp:~jpakkane/unity-lens-video/coverage
Reviewer Review Type Date Requested Status
Paweł Stołowski Approve
Review via email: mp+148700@code.launchpad.net

Commit message

Coverage support.

Description of the change

Coverage support.

To post a comment you must log in.
Revision history for this message
Paweł Stołowski (stolowski) wrote :

Please also update sources in tests/unit/Makefile.am to include all vala files from src/ (except for config.vala, main.vala and mocked class(es)). That way coverage report will be more accurate.

Apart from that it works fine.

review: Needs Fixing
156. By Jussi Pakkanen

Merged changes.

157. By Jussi Pakkanen

Added vala sources to list so they show up in coverage measurements.

Revision history for this message
Paweł Stołowski (stolowski) wrote :

LGTM. +1

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-11-22 12:23:14 +0000
+++ Makefile.am 2013-02-19 12:24:23 +0000
@@ -1,3 +1,5 @@
1SUBDIRS = src po tests/unit vapi data1SUBDIRS = src po tests/unit vapi data
22
3DISTCHECK_CONFIGURE_FLAGS = --enable-localinstall3DISTCHECK_CONFIGURE_FLAGS = --enable-localinstall
4
5include $(top_srcdir)/Makefile.am.coverage
46
=== added file 'Makefile.am.coverage'
--- Makefile.am.coverage 1970-01-01 00:00:00 +0000
+++ Makefile.am.coverage 2013-02-19 12:24:23 +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 2013-02-18 11:14:01 +0000
+++ configure.ac 2013-02-19 12:24:23 +0000
@@ -51,6 +51,17 @@
51INTLTOOL_LENS_RULE='%.lens: %.lens.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'51INTLTOOL_LENS_RULE='%.lens: %.lens.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
52AC_SUBST(INTLTOOL_LENS_RULE)52AC_SUBST(INTLTOOL_LENS_RULE)
5353
54###########################
55# gcov coverage reporting
56###########################
57m4_include([m4/gcov.m4])
58AC_TDD_GCOV
59AM_CONDITIONAL([HAVE_GCOV], [test "x$ac_cv_check_gcov" = xyes])
60AM_CONDITIONAL([HAVE_LCOV], [test "x$ac_cv_check_lcov" = xyes])
61AM_CONDITIONAL([HAVE_GCOVR], [test "x$ac_cv_check_gcovr" = xyes])
62AC_SUBST(COVERAGE_CFLAGS)
63AC_SUBST(COVERAGE_LDFLAGS)
64
54#####################################################65#####################################################
55# Check for module and library dependancies66# Check for module and library dependancies
56#####################################################67#####################################################
@@ -189,4 +200,9 @@
189 Extra ValaFlags : ${CPPFLAGS} $MAINTAINER_VALAFLAGS200 Extra ValaFlags : ${CPPFLAGS} $MAINTAINER_VALAFLAGS
190201
191 Lenses Directory: ${LENSESDIR}202 Lenses Directory: ${LENSESDIR}
203
204 Testing
205 Headless tests : ${enable_headless_tests}
206 Coverage reporting : ${use_gcov}
207
192])208])
193209
=== added directory 'm4'
=== added file 'm4/gcov.m4'
--- m4/gcov.m4 1970-01-01 00:00:00 +0000
+++ m4/gcov.m4 2013-02-19 12:24:23 +0000
@@ -0,0 +1,86 @@
1# Checks for existence of coverage tools:
2# * gcov
3# * lcov
4# * genhtml
5# * gcovr
6#
7# Sets ac_cv_check_gcov to yes if tooling is present
8# and reports the executables to the variables LCOV, GCOVR and GENHTML.
9AC_DEFUN([AC_TDD_GCOV],
10[
11 AC_ARG_ENABLE(gcov,
12 AS_HELP_STRING([--enable-gcov],
13 [enable coverage testing with gcov]),
14 [use_gcov=$enableval], [use_gcov=no])
15
16 if test "x$use_gcov" = "xyes"; then
17 # we need gcc:
18 if test "$GCC" != "yes"; then
19 AC_MSG_ERROR([GCC is required for --enable-gcov])
20 fi
21
22 # Check if ccache is being used
23 AC_CHECK_PROG(SHTOOL, shtool, shtool)
24 case `$SHTOOL path $CC` in
25 *ccache*[)] gcc_ccache=yes;;
26 *[)] gcc_ccache=no;;
27 esac
28
29 if test "$gcc_ccache" = "yes" && (test -z "$CCACHE_DISABLE" || test "$CCACHE_DISABLE" != "1"); then
30 AC_MSG_ERROR([ccache must be disabled when --enable-gcov option is used. You can disable ccache by setting environment variable CCACHE_DISABLE=1.])
31 fi
32
33 lcov_version_list="1.6 1.7 1.8 1.9"
34 AC_CHECK_PROG(LCOV, lcov, lcov)
35 AC_CHECK_PROG(GENHTML, genhtml, genhtml)
36
37 if test "$LCOV"; then
38 AC_CACHE_CHECK([for lcov version], glib_cv_lcov_version, [
39 glib_cv_lcov_version=invalid
40 lcov_version=`$LCOV -v 2>/dev/null | $SED -e 's/^.* //'`
41 for lcov_check_version in $lcov_version_list; do
42 if test "$lcov_version" = "$lcov_check_version"; then
43 glib_cv_lcov_version="$lcov_check_version (ok)"
44 fi
45 done
46 ])
47 else
48 lcov_msg="To enable code coverage reporting you must have one of the following lcov versions installed: $lcov_version_list"
49 AC_MSG_ERROR([$lcov_msg])
50 fi
51
52 case $glib_cv_lcov_version in
53 ""|invalid[)]
54 lcov_msg="You must have one of the following versions of lcov: $lcov_version_list (found: $lcov_version)."
55 AC_MSG_ERROR([$lcov_msg])
56 LCOV="exit 0;"
57 ;;
58 esac
59
60 if test -z "$GENHTML"; then
61 AC_MSG_ERROR([Could not find genhtml from the lcov package])
62 fi
63
64 ac_cv_check_gcov=yes
65 ac_cv_check_lcov=yes
66
67 # Remove all optimization flags from CFLAGS
68 changequote({,})
69 CFLAGS=`echo "$CFLAGS" | $SED -e 's/-O[0-9]*//g'`
70 changequote([,])
71
72 # Add the special gcc flags
73 COVERAGE_CFLAGS="-O0 -fprofile-arcs -ftest-coverage"
74 COVERAGE_CXXFLAGS="-O0 -fprofile-arcs -ftest-coverage"
75 COVERAGE_LDFLAGS="-lgcov"
76
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
85fi
86]) # AC_TDD_GCOV
087
=== modified file 'src/Makefile.am'
--- src/Makefile.am 2013-02-18 11:14:01 +0000
+++ src/Makefile.am 2013-02-19 12:24:23 +0000
@@ -5,6 +5,9 @@
55
6DATADIR = $(datadir)6DATADIR = $(datadir)
77
8AM_CPPFLAGS = $(COVERAGE_CFLAGS)
9AM_LDFLAGS = $(COVERAGE_LDFLAGS)
10
8pkglibexec_PROGRAMS = \11pkglibexec_PROGRAMS = \
9 unity-video-lens-daemon \12 unity-video-lens-daemon \
10 unity-scope-video-remote \13 unity-scope-video-remote \
1114
=== modified file 'tests/unit/Makefile.am'
--- tests/unit/Makefile.am 2012-11-27 12:17:56 +0000
+++ tests/unit/Makefile.am 2013-02-19 12:24:23 +0000
@@ -17,6 +17,8 @@
17 --pkg json-glib-1.0 \17 --pkg json-glib-1.0 \
18 --pkg glib-2.0 \18 --pkg glib-2.0 \
19 --pkg zeitgeist-1.0 \19 --pkg zeitgeist-1.0 \
20 --pkg libsoup-gnome-2.4 \
21 --pkg libsoup-2.4 \
20 --vapidir $(srcdir) \22 --vapidir $(srcdir) \
21 --vapidir $(top_srcdir)/vapi \23 --vapidir $(top_srcdir)/vapi \
22 --target-glib=2.26 \24 --target-glib=2.26 \
@@ -31,8 +33,11 @@
31 -I$(srcdir) \33 -I$(srcdir) \
32 -I$(top_srcdir)/src \34 -I$(top_srcdir)/src \
33 -DGETTEXT_PACKAGE=\"$(GETTEXT_PACKAGE)\" \35 -DGETTEXT_PACKAGE=\"$(GETTEXT_PACKAGE)\" \
36 $(COVERAGE_CFLAGS) \
34 $(NULL)37 $(NULL)
3538
39AM_LDFLAGS = $(COVERAGE_LDFLAGS)
40
36if !ENABLE_C_WARNINGS41if !ENABLE_C_WARNINGS
37 AM_CPPFLAGS += -w42 AM_CPPFLAGS += -w
38endif43endif
@@ -41,23 +46,26 @@
41 test-locate.vala \46 test-locate.vala \
42 thumbnailer-mock.vala \47 thumbnailer-mock.vala \
43 config-tests.vala \48 config-tests.vala \
44 ../../src/locate.vala \49 $(top_srcdir)/src/locate.vala \
45 ../../src/utils.vala \50 $(top_srcdir)/src/utils.vala \
46 ../../src/video-file.vala \51 $(top_srcdir)/src/video-file.vala \
47 $(NULL)52 $(NULL)
4853
49test_utils_VALASOURCES = \54test_utils_VALASOURCES = \
50 test-utils.vala \55 test-utils.vala \
51 config-tests.vala \56 config-tests.vala \
52 ../../src/utils.vala \57 $(top_srcdir)/src/utils.vala \
53 $(NULL)58 $(NULL)
5459
55test_ubuntu_video_search_VALASOURCES = \60test_ubuntu_video_search_VALASOURCES = \
56 test-ubuntu-video-search.vala \61 test-ubuntu-video-search.vala \
57 config-tests.vala \62 config-tests.vala \
58 ../../src/remote-scope-globals.vala \63 $(top_srcdir)/src/remote-scope-globals.vala \
59 ../../src/ubuntu-video-search.vala \64 $(top_srcdir)/src/ubuntu-video-search.vala \
60 ../../src/video-file.vala \65 $(top_srcdir)/src/video-file.vala \
66 $(top_srcdir)/src/remote-scope.vala \
67 $(top_srcdir)/src/remote-uri.vala \
68 $(top_srcdir)/src/utils.vala \
61 $(NULL)69 $(NULL)
6270
63nodist_test_locate_SOURCES = $(test_locate_VALASOURCES:.vala=.c)71nodist_test_locate_SOURCES = $(test_locate_VALASOURCES:.vala=.c)
6472
=== modified file 'tests/unit/config-tests.vala.in'
--- tests/unit/config-tests.vala.in 2012-11-27 12:17:56 +0000
+++ tests/unit/config-tests.vala.in 2013-02-19 12:24:23 +0000
@@ -2,4 +2,5 @@
2 const string TESTDATADIR = "@abs_top_srcdir@/tests/unit/data";2 const string TESTDATADIR = "@abs_top_srcdir@/tests/unit/data";
3 const string LOCALEDIR = "@DATADIR@/locale";3 const string LOCALEDIR = "@DATADIR@/locale";
4 const string PACKAGE = "@PACKAGE@";4 const string PACKAGE = "@PACKAGE@";
5 const string VERSION = "@VERSION@";
5}6}

Subscribers

People subscribed via source and target branches