diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2017-05-29 14:53:26 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2017-05-29 14:53:26 +0100 |
commit | 2909d14047e03f2d148efc80827712ec36e29aca (patch) | |
tree | 7c292f448cc27580b7401540998b4fe2dc2aab04 /bashrc | |
parent | GitGutter things (diff) | |
download | util-2909d14047e03f2d148efc80827712ec36e29aca.tar.bz2 util-2909d14047e03f2d148efc80827712ec36e29aca.tar.xz util-2909d14047e03f2d148efc80827712ec36e29aca.zip |
Function for coverage reports
Diffstat (limited to 'bashrc')
-rw-r--r-- | bashrc | 24 |
1 files changed, 24 insertions, 0 deletions
@@ -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" |