aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt8
-rw-r--r--cmake/Coverage.cmake37
-rw-r--r--debian/control2
-rw-r--r--src/CMakeLists.txt8
-rw-r--r--src/gmenuharness/CMakeLists.txt7
-rw-r--r--tests/CMakeLists.txt14
-rw-r--r--tests/integration/CMakeLists.txt7
7 files changed, 44 insertions, 39 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7d2624c..b8730fe 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -11,7 +11,6 @@ add_definitions( -DGETTEXT_PACKAGE="${GETTEXT_PACKAGE}" )
find_package(PkgConfig REQUIRED)
include(GNUInstallDirs)
-include(Coverage)
include(UseVala)
# Workaround for libexecdir on debian
@@ -79,4 +78,9 @@ add_subdirectory(src)
enable_testing()
add_subdirectory(tests)
-
+find_package(CoverageReport)
+ENABLE_COVERAGE_REPORT(
+ TARGETS ${COVERAGE_TARGETS}
+ TESTS ${COVERAGE_TEST_TARGETS}
+ FILTER /usr/include ${CMAKE_BINARY_DIR}/*
+)
diff --git a/cmake/Coverage.cmake b/cmake/Coverage.cmake
deleted file mode 100644
index 22a0d29..0000000
--- a/cmake/Coverage.cmake
+++ /dev/null
@@ -1,37 +0,0 @@
-if (CMAKE_BUILD_TYPE MATCHES coverage)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage")
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage")
- set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} --coverage")
- set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --coverage")
-
- find_program(GCOVR_EXECUTABLE gcovr HINTS ${GCOVR_ROOT} "${GCOVR_ROOT}/bin")
- if (NOT GCOVR_EXECUTABLE)
- message(STATUS "Gcovr binary was not found, can not generate XML coverage info.")
- else ()
- message(STATUS "Gcovr found, can generate XML coverage info.")
- add_custom_target (coverage-xml
- WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
- COMMAND "${GCOVR_EXECUTABLE}" --exclude="test.*" --exclude="obj.*" -x -r "${CMAKE_SOURCE_DIR}"
- --object-directory=${CMAKE_BINARY_DIR} -o coverage.xml)
- endif()
-
- find_program(LCOV_EXECUTABLE lcov HINTS ${LCOV_ROOT} "${GCOVR_ROOT}/bin")
- find_program(GENHTML_EXECUTABLE genhtml HINTS ${GENHTML_ROOT})
- if (NOT LCOV_EXECUTABLE)
- message(STATUS "Lcov binary was not found, can not generate HTML coverage info.")
- else ()
- if(NOT GENHTML_EXECUTABLE)
- message(STATUS "Genthml binary not found, can not generate HTML coverage info.")
- else()
- message(STATUS "Lcov and genhtml found, can generate HTML coverage info.")
- add_custom_target (coverage-html
- WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
- COMMAND "${LCOV_EXECUTABLE}" --capture --output-file "${CMAKE_BINARY_DIR}/coverage.info" --no-checksum --directory "${CMAKE_BINARY_DIR}"
- COMMAND "${LCOV_EXECUTABLE}" --remove "${CMAKE_BINARY_DIR}/coverage.info" '/usr/*' --output-file "${CMAKE_BINARY_DIR}/coverage.info"
- COMMAND "${LCOV_EXECUTABLE}" --remove "${CMAKE_BINARY_DIR}/coverage.info" '${CMAKE_BINARY_DIR}/*' --output-file "${CMAKE_BINARY_DIR}/coverage.info"
- COMMAND "${LCOV_EXECUTABLE}" --remove "${CMAKE_BINARY_DIR}/coverage.info" '${CMAKE_SOURCE_DIR}/tests/*' --output-file "${CMAKE_BINARY_DIR}/coverage.info"
- COMMAND "${GENHTML_EXECUTABLE}" --prefix "${CMAKE_BINARY_DIR}" --output-directory coveragereport --title "Code Coverage" --legend --show-details coverage.info
- )
- endif()
- endif()
-endif()
diff --git a/debian/control b/debian/control
index 89914fd..8b83c08 100644
--- a/debian/control
+++ b/debian/control
@@ -9,12 +9,14 @@ Build-Depends: debhelper (>= 9.0),
dbus,
dbus-test-runner (>> 14.04.0+14.04.20150120.1),
dh-translations,
+ gcovr,
gir1.2-accountsservice-1.0,
gnome-common,
googletest | google-mock (>= 1.6.0+svn437),
gsettings-ubuntu-schemas,
autotools-dev,
valac (>= 0.20),
+ lcov,
libaccountsservice-dev,
libdbustest1-dev (>= 15.04.0),
libgirepository1.0-dev,
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 0498903..0475ff3 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -278,3 +278,11 @@ install(
)
add_subdirectory(gmenuharness)
+
+# coverage reporting
+set(COVERAGE_TARGETS
+ ${COVERAGE_TARGETS}
+ indicator-sound-service-lib
+ indicator-sound-service-bin
+ PARENT_SCOPE
+)
diff --git a/src/gmenuharness/CMakeLists.txt b/src/gmenuharness/CMakeLists.txt
index c9e613a..ca9d4dc 100644
--- a/src/gmenuharness/CMakeLists.txt
+++ b/src/gmenuharness/CMakeLists.txt
@@ -15,3 +15,10 @@ target_link_libraries(
gmenuharness-shared
${GLIB_LDFLAGS}
)
+
+# coverage reporting
+set(COVERAGE_TARGETS
+ ${COVERAGE_TARGETS}
+ gmenuharness-shared
+ PARENT_SCOPE
+)
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 610ed9b..fb9d4b9 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -284,3 +284,17 @@ add_test(indcator-test
add_subdirectory(integration)
add_subdirectory(dbus-types)
add_subdirectory(service-mocks)
+
+# coverage reporting
+set(COVERAGE_TEST_TARGETS
+ ${COVERAGE_TEST_TARGETS}
+ name-watch-test
+ accounts-service-user-test
+ volume-control-test
+ sound-menu-test
+ notifications-test
+ media-player-user-test
+ greeter-list-test
+ indicator-test
+ PARENT_SCOPE
+)
diff --git a/tests/integration/CMakeLists.txt b/tests/integration/CMakeLists.txt
index e05db4d..e021d87 100644
--- a/tests/integration/CMakeLists.txt
+++ b/tests/integration/CMakeLists.txt
@@ -126,3 +126,10 @@ target_link_libraries(
)
#add_subdirectory(utils)
+
+# coverage reporting
+set(COVERAGE_TEST_TARGETS
+ ${COVERAGE_TEST_TARGETS}
+ integration-tests
+ PARENT_SCOPE
+)