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

Proposed by dobey
Status: Merged
Approved by: dobey
Approved revision: 27
Merged at revision: 28
Proposed branch: lp:~dobey/indicator-display/fix-coverage
Merge into: lp:indicator-display
Prerequisite: lp:~dobey/indicator-display/fix-i18n
Diff against target: 125 lines (+34/-18)
5 files modified
CMakeLists.txt (+15/-18)
debian/control (+1/-0)
tests/CMakeLists.txt (+5/-0)
tests/integration/CMakeLists.txt (+6/-0)
tests/unit/CMakeLists.txt (+7/-0)
To merge this branch: bzr merge lp:~dobey/indicator-display/fix-coverage
Reviewer Review Type Date Requested Status
unity-api-1-bot continuous-integration Approve
Pete Woods (community) Approve
Ted Gould (community) Needs Information
Review via email: mp+316601@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:26
https://jenkins.canonical.com/unity-api-1/job/lp-indicator-display-ci/26/
Executed test runs:
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build/1617
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-0-fetch/1624
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1402
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1402/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=zesty/1402
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=zesty/1402/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1402
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1402/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=zesty/1402
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=zesty/1402/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/1402
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/1402/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=zesty/1402
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=zesty/1402/artifact/output/*zip*/output.zip

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

review: Approve (continuous-integration)
Revision history for this message
Ted Gould (ted) wrote :

I think that instead of defining the variable in the parent scope, it should instead be a global property. This way you don't have to track the level of recursion in each file. Also, with set property you can do an append:

set_property(GLOBAL APPEND PROPERTY COVERAGE_TEST_TARGETS ${TEST_NAME})

review: Needs Information
Revision history for this message
Charles Kerr (charlesk) wrote :

Keeper uses the cascading-parent-scope approach as an alternative to hardcoding all the test names in the toplevel CMakeLists.txt file, and I suggested it here for the same reason.

If it works, the global property approach sounds cleaner than the previous two approaches.

Revision history for this message
Pete Woods (pete-woods) :
review: Needs Fixing
27. By dobey

Remove hard-coded -g option.

Revision history for this message
Pete Woods (pete-woods) :
review: Approve
Revision history for this message
unity-api-1-bot (unity-api-1-bot) wrote :

PASSED: Continuous integration, rev:27
https://jenkins.canonical.com/unity-api-1/job/lp-indicator-display-ci/28/
Executed test runs:
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build/1668
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-0-fetch/1675
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1450
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1450/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=zesty/1450
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=zesty/1450/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1450
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1450/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=zesty/1450
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=zesty/1450/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/1450
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/1450/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=zesty/1450
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=zesty/1450/artifact/output/*zip*/output.zip

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

review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt 2016-12-07 17:06:29 +0000
+++ CMakeLists.txt 2017-02-10 16:17:38 +0000
@@ -13,9 +13,6 @@
13set(SERVICE_LIB ${PACKAGE})13set(SERVICE_LIB ${PACKAGE})
14set(SERVICE_EXEC "${PACKAGE}-service")14set(SERVICE_EXEC "${PACKAGE}-service")
1515
16option(enable_tests "Build the package's automatic tests." ON)
17option(enable_coverage "Generate code coverage reports." ON)
18
19##16##
20## GNU standard paths17## GNU standard paths
21## 18##
@@ -67,22 +64,22 @@
67 list(APPEND CXX_WARNING_ARGS -Wall -Wextra -Wpedantic)64 list(APPEND CXX_WARNING_ARGS -Wall -Wextra -Wpedantic)
68endif()65endif()
6966
70add_compile_options(-std=c++14 -fPIC -g)67add_compile_options(-std=c++14 -fPIC)
71
72##
73## Testing & Coverage
74##
75
76if(${enable_tests})
77 enable_testing()
78 if(${enable_coverage})
79 find_package(CoverageReport)
80 endif()
81endif()
8268
83add_subdirectory(src)69add_subdirectory(src)
84add_subdirectory(data)70add_subdirectory(data)
85add_subdirectory(po)71add_subdirectory(po)
86if (${enable_tests})72
87 add_subdirectory(tests)73##
88endif ()74## Testing & Coverage
75##
76
77enable_testing()
78add_subdirectory(tests)
79find_package(CoverageReport)
80ENABLE_COVERAGE_REPORT(
81 TARGETS ${SERVICE_LIB} ${SERVICE_EXEC}
82 TESTS ${COVERAGE_TEST_TARGETS}
83 FILTER /usr/include ${CMAKE_BINARY_DIR}/*
84)
85
8986
=== modified file 'debian/control'
--- debian/control 2016-12-07 17:06:29 +0000
+++ debian/control 2017-02-10 16:17:38 +0000
@@ -10,6 +10,7 @@
10 libgudev-1.0-dev,10 libgudev-1.0-dev,
11 libproperties-cpp-dev,11 libproperties-cpp-dev,
12# for coverage reports12# for coverage reports
13 gcovr,
13 lcov,14 lcov,
14# for tests15# for tests
15 qt5-default,16 qt5-default,
1617
=== modified file 'tests/CMakeLists.txt'
--- tests/CMakeLists.txt 2016-03-11 20:06:34 +0000
+++ tests/CMakeLists.txt 2017-02-10 16:17:38 +0000
@@ -33,3 +33,8 @@
33add_subdirectory(integration)33add_subdirectory(integration)
34add_subdirectory(unit)34add_subdirectory(unit)
35add_subdirectory(utils)35add_subdirectory(utils)
36
37set(COVERAGE_TEST_TARGETS
38 ${COVERAGE_TEST_TARGETS}
39 PARENT_SCOPE
40)
3641
=== modified file 'tests/integration/CMakeLists.txt'
--- tests/integration/CMakeLists.txt 2016-03-16 00:25:33 +0000
+++ tests/integration/CMakeLists.txt 2017-02-10 16:17:38 +0000
@@ -16,9 +16,15 @@
1616
17function(add_qt_test_by_name name)17function(add_qt_test_by_name name)
18 set(TEST_NAME ${name})18 set(TEST_NAME ${name})
19 set(COVERAGE_TEST_TARGETS ${COVERAGE_TEST_TARGETS} ${TEST_NAME} PARENT_SCOPE)
19 add_executable (${TEST_NAME} ${TEST_NAME}.cpp)20 add_executable (${TEST_NAME} ${TEST_NAME}.cpp)
20 add_test(${TEST_NAME} ${TEST_NAME})21 add_test(${TEST_NAME} ${TEST_NAME})
21 set_property(TEST ${TEST_NAME} APPEND PROPERTY ENVIRONMENT ${CTEST_ENVIRONMENT})22 set_property(TEST ${TEST_NAME} APPEND PROPERTY ENVIRONMENT ${CTEST_ENVIRONMENT})
22 target_link_libraries(${TEST_NAME} ${SERVICE_LINK_LIBRARIES} ${QT_LINK_LIBRARIES} ${TEST_LINK_LIBRARIES} ${THREAD_LINK_LIBRARIES})23 target_link_libraries(${TEST_NAME} ${SERVICE_LINK_LIBRARIES} ${QT_LINK_LIBRARIES} ${TEST_LINK_LIBRARIES} ${THREAD_LINK_LIBRARIES})
23endfunction()24endfunction()
24add_qt_test_by_name(usb-manager-test)25add_qt_test_by_name(usb-manager-test)
26
27set(COVERAGE_TEST_TARGETS
28 ${COVERAGE_TEST_TARGETS}
29 PARENT_SCOPE
30)
2531
=== modified file 'tests/unit/CMakeLists.txt'
--- tests/unit/CMakeLists.txt 2016-04-21 00:57:03 +0000
+++ tests/unit/CMakeLists.txt 2017-02-10 16:17:38 +0000
@@ -20,6 +20,7 @@
2020
21function(add_test_by_name name)21function(add_test_by_name name)
22 set(TEST_NAME ${name})22 set(TEST_NAME ${name})
23 set(COVERAGE_TEST_TARGETS ${COVERAGE_TEST_TARGETS} ${TEST_NAME} PARENT_SCOPE)
23 add_executable (${TEST_NAME} ${TEST_NAME}.cpp)24 add_executable (${TEST_NAME} ${TEST_NAME}.cpp)
24 add_test(${TEST_NAME} ${TEST_NAME})25 add_test(${TEST_NAME} ${TEST_NAME})
25 set_property(TEST ${TEST_NAME} APPEND PROPERTY ENVIRONMENT ${CTEST_ENVIRONMENT})26 set_property(TEST ${TEST_NAME} APPEND PROPERTY ENVIRONMENT ${CTEST_ENVIRONMENT})
@@ -30,6 +31,7 @@
3031
31function(add_qt_test_by_name name)32function(add_qt_test_by_name name)
32 set(TEST_NAME ${name})33 set(TEST_NAME ${name})
34 set(COVERAGE_TEST_TARGETS ${COVERAGE_TEST_TARGETS} ${TEST_NAME} PARENT_SCOPE)
33 add_executable (${TEST_NAME} ${TEST_NAME}.cpp)35 add_executable (${TEST_NAME} ${TEST_NAME}.cpp)
34 add_test(${TEST_NAME} ${TEST_NAME})36 add_test(${TEST_NAME} ${TEST_NAME})
35 set_property(TEST ${TEST_NAME} APPEND PROPERTY ENVIRONMENT ${CTEST_ENVIRONMENT})37 set_property(TEST ${TEST_NAME} APPEND PROPERTY ENVIRONMENT ${CTEST_ENVIRONMENT})
@@ -37,3 +39,8 @@
37endfunction()39endfunction()
38add_qt_test_by_name(greeter-test)40add_qt_test_by_name(greeter-test)
39add_qt_test_by_name(usb-snap-test)41add_qt_test_by_name(usb-snap-test)
42
43set(COVERAGE_TEST_TARGETS
44 ${COVERAGE_TEST_TARGETS}
45 PARENT_SCOPE
46)

Subscribers

People subscribed via source and target branches