mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-24 04:13:28 +01:00
e31ffb2741
In scripts/test/coverage, avoid attempting to move gcov output files to the root directory when given no arguments. Fixes bug 23741.
47 lines
1.2 KiB
Bash
Executable File
47 lines
1.2 KiB
Bash
Executable File
#!/bin/sh
|
|
# Copyright 2013 The Tor Project, Inc.
|
|
# See LICENSE for licensing information.
|
|
|
|
# coverage -- run gcov on the appropriate set of object files to extract
|
|
# coverage information.
|
|
|
|
dst=$1
|
|
|
|
for fn in src/or/*.c src/common/*.c; do
|
|
BN=`basename $fn`
|
|
DN=`dirname $fn`
|
|
F=`echo $BN | sed -e 's/\.c$//;'`
|
|
GC="${BN}.gcov"
|
|
# 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 [ -d "$dst" ]
|
|
then
|
|
mv $GC $dst/$GC
|
|
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
|