Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/keepassxreboot/keepassxc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJanek Bevendorff <janek@jbev.net>2018-09-29 15:55:33 +0300
committerJanek Bevendorff <janek@jbev.net>2018-10-19 22:45:53 +0300
commit18b22834c1d9657ab98ca5160571e51837bb6366 (patch)
tree76b4c16ffc0559903e979e2686e92da2f37db771 /CMakeLists.txt
parentb8d2d5d877a407477ade9c26809211c40367ed9f (diff)
Update and fix test coverage report generation
Generation of unit test coverage reports used to be quite complicated and required a lot of different settings, including a custom CMake build type. This patch updates the coverage CMake module to only require -DWITH_COVERAGE=ON to be set on a normal Debug build in order to create a coverage target. This patch also moves away from lcov in favor of gcovr, since lcov appears to be broken in GCC 8. However, the routines for generating lcov reports still exist, so provided lcov receives updates and there is sufficient reason to switch back, it is easy to do so.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt21
1 files changed, 15 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 41a6b9403..0f8a4b672 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -204,12 +204,6 @@ endif()
if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wcast-align")
-
- if(WITH_COVERAGE)
- # Include code coverage, use with -DCMAKE_BUILD_TYPE=Coverage
- include(CodeCoverage)
- setup_target_for_coverage(kp_coverage "make test" coverage)
- endif()
endif()
if(CMAKE_COMPILER_IS_GNUCC)
@@ -291,6 +285,21 @@ if(WITH_TESTS)
enable_testing()
endif(WITH_TESTS)
+if(WITH_COVERAGE)
+ # Include code coverage, use with -DCMAKE_BUILD_TYPE=Debug
+ include(CodeCoverage)
+ set(COVERAGE_GCOVR_EXCLUDES
+ "\\(.+/\\)?tests/.\\*"
+ ".\\*/moc_\\[^/\\]+\\.cpp"
+ ".\\*/ui_\\[^/\\]+\\.h"
+ "\\(.+/\\)?zxcvbn/.\\*")
+ append_coverage_compiler_flags()
+ setup_target_for_coverage_gcovr_html(
+ NAME coverage
+ EXECUTABLE $(MAKE) && $(MAKE) test
+ )
+endif()
+
include(CLangFormat)
if(UNIX AND NOT APPLE)