Merge lp:~dobey/indicator-location/fix-coverage into lp:indicator-location

Proposed by dobey
Status: Merged
Approved by: dobey
Approved revision: 166
Merged at revision: 164
Proposed branch: lp:~dobey/indicator-location/fix-coverage
Merge into: lp:indicator-location
Prerequisite: lp:~dobey/indicator-location/fix-gtest
Diff against target: 213 lines (+26/-124)
6 files modified
CMakeLists.txt (+10/-14)
cmake/GCov.cmake (+0/-53)
debian/control (+3/-1)
src/CMakeLists.txt (+1/-1)
tests/CMakeLists.txt (+12/-2)
trim-lcov.py (+0/-53)
To merge this branch: bzr merge lp:~dobey/indicator-location/fix-coverage
Reviewer Review Type Date Requested Status
Pete Woods (community) Approve
unity-api-1-bot continuous-integration Approve
Review via email: mp+316605@code.launchpad.net

Commit message

Make coverage reporting work.

To post a comment you must log in.
Revision history for this message
unity-api-1-bot (unity-api-1-bot) wrote :

PASSED: Continuous integration, rev:164
https://jenkins.canonical.com/unity-api-1/job/lp-indicator-location-ci/5/
Executed test runs:
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build/1619
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-0-fetch/1626
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1404
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1404/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=zesty/1404
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=zesty/1404/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1404
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1404/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=zesty/1404
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=zesty/1404/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/1404
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/1404/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=zesty/1404
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=zesty/1404/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/unity-api-1/job/lp-indicator-location-ci/5/rebuild

review: Approve (continuous-integration)
165. By dobey

Oops remove usage of GCOV variable.

Revision history for this message
unity-api-1-bot (unity-api-1-bot) wrote :

PASSED: Continuous integration, rev:165
https://jenkins.canonical.com/unity-api-1/job/lp-indicator-location-ci/8/
Executed test runs:
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build/1626
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-0-fetch/1633
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1411
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1411/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=zesty/1411
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=zesty/1411/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1411
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1411/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=zesty/1411
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=zesty/1411/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/1411
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/1411/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=zesty/1411
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=zesty/1411/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/unity-api-1/job/lp-indicator-location-ci/8/rebuild

review: Approve (continuous-integration)
Revision history for this message
Pete Woods (pete-woods) :
review: Needs Fixing
166. By dobey

Remove hard-coded -g compiler flag.

Revision history for this message
Pete Woods (pete-woods) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2017-02-10 16:19:35 +0000
3+++ CMakeLists.txt 2017-02-10 16:19:35 +0000
4@@ -10,9 +10,6 @@
5 set (SERVICE_LIB ${PACKAGE})
6 set (SERVICE_EXEC "${PACKAGE}-service")
7
8-option (enable_tests "Build the package's automatic tests." ON)
9-option (enable_lcov "Generate lcov code coverage reports." ON)
10-
11 ##
12 ## GNU standard paths
13 ##
14@@ -79,18 +76,17 @@
15 set (CMAKE_INCLUDE_CURRENT_DIR ON)
16 set (CC_WARNING_ARGS " -Wall -Wextra -Wno-missing-field-initializers")
17
18-# testing & coverage
19-if (${enable_tests})
20- enable_testing ()
21- if (${enable_lcov})
22- include(GCov)
23- endif ()
24-endif ()
25-
26 add_subdirectory (src)
27 add_subdirectory (data)
28 add_subdirectory (po)
29 add_subdirectory (tools)
30-if (${enable_tests})
31- add_subdirectory (tests)
32-endif ()
33+
34+# testing & coverage
35+enable_testing ()
36+add_subdirectory (tests)
37+find_package(CoverageReport)
38+ENABLE_COVERAGE_REPORT(
39+ TARGETS ${SERVICE_LIB} ${SERVICE_EXEC}
40+ TESTS ${COVERAGE_TEST_TARGETS}
41+ FILTER /usr/include ${CMAKE_BINARY_DIR}/*
42+)
43
44=== removed file 'cmake/GCov.cmake'
45--- cmake/GCov.cmake 2013-08-25 20:31:26 +0000
46+++ cmake/GCov.cmake 1970-01-01 00:00:00 +0000
47@@ -1,53 +0,0 @@
48-if (CMAKE_BUILD_TYPE MATCHES coverage)
49- set(LCOV_RAW_FILE "lcov-raw.info")
50- set(LCOV_FILE "lcov.info")
51- set(GCOV_FLAGS "${GCOV_FLAGS} --coverage")
52- set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${GCOV_FLAGS}")
53- set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${GCOV_FLAGS}")
54- set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${GCOV_FLAGS}")
55- set(GCOV_LIBS ${GCOV_LIBS} gcov)
56-
57- find_program(GCOVR_EXECUTABLE gcovr HINTS ${GCOVR_ROOT} "${GCOVR_ROOT}/bin")
58- if (NOT GCOVR_EXECUTABLE)
59- message(STATUS "Gcovr binary was not found, can not generate XML coverage info.")
60- else ()
61- message(STATUS "Gcovr found, can generate XML coverage info.")
62- add_custom_target (coverage-xml
63- WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
64- COMMAND "${GCOVR_EXECUTABLE}" --exclude="test.*" -x -r "${CMAKE_SOURCE_DIR}"
65- --object-directory=${CMAKE_BINARY_DIR} -o coverage.xml)
66- endif()
67-
68- find_program(LCOV_EXECUTABLE lcov HINTS ${LCOV_ROOT} "${GCOVR_ROOT}/bin")
69- find_program(GENHTML_EXECUTABLE genhtml HINTS ${GENHTML_ROOT})
70- if (NOT LCOV_EXECUTABLE)
71- message(STATUS "Lcov binary was not found, can not generate HTML coverage info.")
72- else ()
73- if(NOT GENHTML_EXECUTABLE)
74- message(STATUS "Genthml binary not found, can not generate HTML coverage info.")
75- else()
76- message(STATUS "Lcov and genhtml found, can generate HTML coverage info.")
77- add_custom_target (coverage-html
78- WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
79- COMMAND "${CMAKE_CTEST_COMMAND}" --force-new-ctest-process --verbose
80- # generate the raw lcov data
81- COMMAND "${LCOV_EXECUTABLE}" --directory ${CMAKE_BINARY_DIR} --capture -o ${LCOV_RAW_FILE}
82- # FIXME: when ubuntu gets lcov 1.10 we can use --no-external instead of the brittle --remove
83- COMMAND "${LCOV_EXECUTABLE}" --remove ${LCOV_RAW_FILE} "/usr/include/*" | ${CMAKE_SOURCE_DIR}/trim-lcov.py > ${LCOV_FILE}
84- COMMAND LANG=C "${GENHTML_EXECUTABLE}" --prefix ${CMAKE_BINARY_DIR} --output-directory lcov-html --legend --show-details ${LCOV_FILE}
85- COMMAND ${CMAKE_COMMAND} -E echo ""
86- COMMAND ${CMAKE_COMMAND} -E echo "file://${CMAKE_BINARY_DIR}/lcov-html/index.html"
87- COMMAND ${CMAKE_COMMAND} -E echo ""
88- VERBATIM) # VERBATIM is necessary here for the wildcard in --remove... again, when we go to lcov 1.10 we can drop this
89- #)
90- endif()
91- endif()
92-endif()
93-
94-
95- #$(MAKE) $(AM_MAKEFLAGS) check
96- #lcov --directory $(top_builddir) --capture --test-name dconf | $(top_srcdir)/trim-lcov.py > dconf-lcov.info
97- #LANG=C genhtml --prefix $(top_builddir) --output-directory lcov-html --legend --show-details dconf-lcov.info
98- #@echo
99- #@echo " file://$(abs_top_builddir)/lcov-html/index.html"
100- #@echo
101
102=== modified file 'debian/control'
103--- debian/control 2017-02-10 16:19:35 +0000
104+++ debian/control 2017-02-10 16:19:35 +0000
105@@ -7,8 +7,10 @@
106 dbus,
107 debhelper (>= 9),
108 dh-translations,
109+ gcovr,
110 googletest | google-mock,
111- intltool (>= 0.35.0),
112+ intltool (>= 0.35.0),
113+ lcov,
114 libglib2.0-dev (>= 2.36),
115 libubuntu-app-launch2-dev,
116 liburl-dispatcher1-dev,
117
118=== modified file 'src/CMakeLists.txt'
119--- src/CMakeLists.txt 2016-01-21 18:28:12 +0000
120+++ src/CMakeLists.txt 2017-02-10 16:19:35 +0000
121@@ -1,4 +1,4 @@
122-SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -g ${CXX_WARNING_ARGS} ${GCOV_FLAGS}")
123+SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 ${CXX_WARNING_ARGS}")
124
125 #set_property (DIRECTORY
126 # APPEND PROPERTY INCLUDE_DIRECTORIES ${SERVICE_INCLUDE_DIRS})
127
128=== modified file 'tests/CMakeLists.txt'
129--- tests/CMakeLists.txt 2017-02-10 16:19:35 +0000
130+++ tests/CMakeLists.txt 2017-02-10 16:19:35 +0000
131@@ -8,8 +8,8 @@
132 include_directories (${CMAKE_SOURCE_DIR})
133 #include_directories (${CMAKE_CURRENT_BINARY_DIR})
134
135-set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g ${CC_WARNING_ARGS}")
136-set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g ${CC_WARNING_ARGS} -std=c++11")
137+set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CC_WARNING_ARGS}")
138+set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CC_WARNING_ARGS} -std=c++11")
139
140 add_test(NAME formatcode
141 COMMAND "${CMAKE_SOURCE_DIR}/tools/format-test.sh" "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}/tools/formatcode")
142@@ -28,3 +28,13 @@
143
144 ${GMOCK_LIBRARIES}
145 )
146+
147+
148+###
149+### coverage
150+###
151+set(COVERAGE_TEST_TARGETS
152+ ${COVERAGE_TEST_TARGETS}
153+ ${TEST_NAME}
154+ PARENT_SCOPE
155+)
156
157=== removed file 'trim-lcov.py'
158--- trim-lcov.py 2013-08-25 20:31:26 +0000
159+++ trim-lcov.py 1970-01-01 00:00:00 +0000
160@@ -1,53 +0,0 @@
161-#!/usr/bin/python
162-
163-# This script removes branch and/or line coverage data for lines that
164-# contain a particular substring.
165-#
166-# In the interest of "fairness" it removes all branch or coverage data
167-# when a match is found -- not just negative data. It is therefore
168-# likely that running this script will actually reduce the total number
169-# of lines and branches that are marked as covered (in absolute terms).
170-#
171-# This script intentionally avoids checking for errors. Any exceptions
172-# will trigger make to fail.
173-#
174-# Author: Ryan Lortie <desrt@desrt.ca>
175-
176-import sys
177-
178-line_suppress = ['g_assert_not_reached']
179-branch_suppress = ['g_assert', 'g_return_if_fail', 'g_clear_object', 'g_clear_pointer', 'g_return_val_if_fail', 'G_DEFINE_TYPE']
180-
181-def check_suppress(suppressions, source, data):
182- line, _, rest = data.partition(',')
183- line = int(line) - 1
184-
185- assert line < len(source)
186-
187- for suppression in suppressions:
188- if suppression in source[line]:
189- return True
190-
191- return False
192-
193-source = []
194-for line in sys.stdin:
195- line = line[:-1]
196-
197- keyword, _, rest = line.partition(':')
198-
199- # Source file
200- if keyword == 'SF':
201- source = file(rest).readlines()
202-
203- # Branch coverage data
204- elif keyword == 'BRDA':
205- if check_suppress(branch_suppress, source, rest):
206- continue
207-
208- # Line coverage data
209- elif keyword == 'DA':
210- if check_suppress(line_suppress, source, rest):
211- continue
212-
213- print line

Subscribers

People subscribed via source and target branches