diff options
-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" |