#!/bin/bash set -exuo pipefail REPORT="@PROJECT_NAME@-coverage.info" STDERR="@PROJECT_NAME@-coverage.stderr" HTML_DIR="@PROJECT_NAME@-coverage" SRCS_DIR="/usr/src/debug/@PROJECT_NAME@-@PROJECT_VERSION@" # create dir for the report mkdir $HTML_DIR # remove old gcda files find / -iname "*.gcda" -exec rm {} \; # launch unit tests privilege-info-tests # copy source files cp -rp $SRCS_DIR*/* "@CMAKE_BINARY_DIR@" # copy gcda files cp -r "@COVERAGE_BUILD_DIR@"/* "@COVERAGE_DIR@" # prepare report rm -f $STDERR lcov --no-external -c -d "@COVERAGE_DIR@" -b "@CMAKE_BINARY_DIR@" -o $REPORT 2>$STDERR lcov -r $REPORT "@CMAKE_BINARY_DIR@/test/*" -o $REPORT # check warnings if [ -s $STDERR ] then echo "Warnings detected (see $STDERR). Aborting." exit 1 fi # html genhtml $REPORT --output-directory $HTML_DIR/