[PATCH 1 of 3] Add lcov target to generate coverage report

Wald Commits scm-commit at wald.intevation.org
Thu May 22 12:20:49 CEST 2014


# HG changeset patch
# User Andre Heinecke <aheinecke at intevation.de>
# Date 1400753967 0
# Node ID 5cd525fc91de5af80fca34c8bce3336fead75d3a
# Parent  5dc4aa684c63e192c76d58e883d40f1f5389722c
Add lcov target to generate coverage report

diff -r 5dc4aa684c63 -r 5cd525fc91de CMakeLists.txt
--- a/CMakeLists.txt	Thu May 22 08:59:13 2014 +0000
+++ b/CMakeLists.txt	Thu May 22 10:19:27 2014 +0000
@@ -118,3 +118,10 @@
 
 set(NSS_BASE_DIR "${NSS_BASE_DIR}/..")
 configure_file (packaging/tmp-createpackage.sh.in packaging/tmp-createpackage.sh)
+
+if (ENABLE_PROFILING)
+   configure_file (make-coverage.sh.in make-coverage.sh)
+   add_custom_target(lcov COMMENT "Lcov coverage report" VERBATIM COMMAND /bin/bash
+      ${CMAKE_CURRENT_BINARY_DIR}/make-coverage.sh
+   )
+endif()
diff -r 5dc4aa684c63 -r 5cd525fc91de make-coverage.sh.in
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make-coverage.sh.in	Thu May 22 10:19:27 2014 +0000
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+# Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik
+# Software engineering by Intevation GmbH
+#
+# This file is Free Software under the GNU GPL (v>=2)
+# and comes with ABSOLUTELY NO WARRANTY!
+# See LICENSE.txt for details.
+
+set -x
+
+rm -r @CMAKE_CURRENT_BINARY_DIR@/coverage
+mkdir -p @CMAKE_CURRENT_BINARY_DIR@/coverage
+cd @CMAKE_CURRENT_BINARY_DIR@/coverage
+lcov -c -i -d @CMAKE_BINARY_DIR@ -o base.info
+cd @CMAKE_BINARY_DIR@
+make test
+lcov -c -d @CMAKE_BINARY_DIR@ -o test.info
+lcov -a base.info -a test.info -o TrustBridge- at PROJECT_VERSION@.info
+genhtml TrustBridge- at PROJECT_VERSION@.info


More information about the Trustbridge-commits mailing list