Make contrib/coverage smarter about check file-existence edge cases

This commit is contained in:
Andrea Shepard 2013-07-16 06:40:08 -07:00
parent 459d827193
commit e5d3efd892

View File

@ -12,9 +12,35 @@ for fn in src/or/*.c src/common/*.c; do
DN=`dirname $fn` DN=`dirname $fn`
F=`echo $BN | sed -e 's/\.c$//;'` F=`echo $BN | sed -e 's/\.c$//;'`
GC="${BN}.gcov" GC="${BN}.gcov"
gcov -o $DN/src_*$F.o $fn # Figure out the object file names
ONS=`echo ${DN}/src_*-${F}.o`
ONS_WILDCARD_LITERAL="${DN}/src_*-${F}.o"
# If the wildcard didn't expand, no files
if [ "$ONS" != "${ONS_WILDCARD_LITERAL}" ]
then
for on in $ONS; do
# We should have a gcno file
GCNO=`echo $on | sed -e 's/\.o$/\.gcno/;'`
if [ -e $GCNO ]
then
# No need to test for gcda, since gcov assumes no execution
# if it's absent
rm -f $GC
gcov -o $on $fn
if [ -e $GC ]
then
if [ -n $dst ] if [ -n $dst ]
then then
mv $GC $dst/$GC mv $GC $dst/$GC
fi fi
else
echo "gcov -o $on $fn didn't make a .gcov file"
fi
else
echo "Couldn't find gcno file for $on"
fi
done
else
echo "No object file found matching source file $fn"
fi
done done