From 2909d14047e03f2d148efc80827712ec36e29aca Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Mon, 29 May 2017 14:53:26 +0100 Subject: Function for coverage reports --- bashrc | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/bashrc b/bashrc index 09b6d09..139403f 100644 --- a/bashrc +++ b/bashrc @@ -16,6 +16,30 @@ diffWith() { ( gvim -f $diffFile ; rm $diffFile ) & } +cov() { + src=${1} + src=$(realpath ${src:=$(pwd)}) + cov=/tmp/cov.$$ + all=$cov/all + key=$cov/key + html=$src/bin/cov/html + test -d $src || ( echo "$src not a directory" && return 1 ) + echo "Cleaning $src" + find $src -name "*.gcda" -type f -delete + find $src -name "*.run" -type f -delete + echo "Building in ${src}" + build $src -d0 variant=coverage + echo "Extracting coverage data" + mkdir -p $cov + lcov -d $src -c -o $all --derive-func-data --no-external -b $src -q + lcov --remove $all "*/bin/*" -o $key -q + echo "Generating HTML" + mkdir -p $html + genhtml $key -o $html -s -k -t $src --demangle-cpp --sort --function-coverage -q + rm -rf $cov + [ "${2}" != "0" ] && xdg-open file://$src/bin/cov/html/index.html +} + PATH="/usr/lib/ccache/bin:$PATH" CORES=$(grep core\ id /proc/cpuinfo | sort -u | wc -l) alias :e="gvim" -- cgit v1.2.3