Get Involved
Download!
Docs
Guidelines
Miscellaneous
|
APR Test Coverage
|
This should give us some idea of how well our tests actually stress our
code. To generate this data, do the following:
Note that this will only generate test coverage data for the testall script,
but all tests should be moving to the unified framework, so this is correct.
EOF
# Remind current dir, so that we can easily navigate in directories
pwd=`pwd`
# gcno files are created at compile time and gcna files at run-time
for i in `find ../.. -name "*.gcno" | sort`; do
# Skip test files
if [[ "$i" =~ "test" ]]; then
continue
fi
# We are only intested in gcno files in .libs directories, because it there
# that we'll also find some gcna files
if ! [[ "$i" =~ "libs" ]]; then
continue
fi
# Find the directory and base name of this gcno file
dir=`dirname -- "$i"`
basename=`basename "$i"`
filename="${basename%.*}"
# Go to this directory
cd $dir
# Get the % of test coverage for each of this file
percent=`gcov $filename.gcda | grep "%" | awk -F'%' {'print $1'} | awk -F':' {'print $2'}`
# Come back to our base directory
cd $pwd
# Process the data we have collected
if [ "x$percent" = "x" ]; then
echo "" >> index.html
echo " Error generating data for $filename | " >> index.html
echo " " >> index.html
continue;
fi
intpercent=`echo "$percent/1" | bc`
if [[ $intpercent -lt 33 ]]; then
color="#ffaaaa"
else if [[ $intpercent -lt 66 ]]; then
color="#ffff77"
else
color="#aaffaa"
fi
fi
echo "" >> index.html
echo "$filename | " >> index.html
echo "$percent% tested | " >> index.html
echo " " >> index.html
done
echo " Last generated `date` " >> index.html
cat >> index.html << EOF
|
|