From 0a3d61f3f1a7f27dba4de257400e57ba9a6c2dba Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Fri, 27 Aug 2021 11:11:31 +0100 Subject: Derive a gcov for the same series as GCC, doesn't have to be an exact match --- bashrc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/bashrc b/bashrc index 08a0e51..58a0c96 100644 --- a/bashrc +++ b/bashrc @@ -41,8 +41,13 @@ cov() { local key=$cov/key local html=$cov/html local htmlfin=bin/cov - local gcov=$(which $(build $@ -qand1 variant=coverage | grep -w compile | \ - sed -n "s/.*\/gcc-\([0-9]\+\.[0-9]\+\.[0-9]\+\)\/.*/gcov-\1/p" | head -n1)) + local gcov=$(build $@ -qand1 variant=coverage | grep -w compile | \ + sed -n "s/.*\/gcc-\([0-9.]\+\)\/.*/gcov-\1/p" | head -n1) + if [[ -z $gcov ]] ; then + echo "Couldn't figure a gcov version" + return 1 + fi + gcov=$(find ${PATH//:/ } -name "$gcov*" 2> /dev/null | sort -Vr | head -n1) if [[ ! -x $gcov ]] ; then echo "Couldn't find a suitable gcov" return 1 -- cgit v1.2.3