changeset 557:5cd525fc91de

Add lcov target to generate coverage report
author Andre Heinecke <aheinecke@intevation.de>
date Thu, 22 May 2014 10:19:27 +0000
parents 5dc4aa684c63
children bde15f68942b
files CMakeLists.txt make-coverage.sh.in
diffstat 2 files changed, 27 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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()
--- /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-@PROJECT_VERSION@.info
+genhtml TrustBridge-@PROJECT_VERSION@.info

http://wald.intevation.org/projects/trustbridge/