Commit 9fe5005e authored by David Zeuthen's avatar David Zeuthen

tweak how we do coverage reporting

parent 756043c7
......@@ -22,10 +22,9 @@ $(srcdir)/ChangeLog:
if POLKIT_GCOV_ENABLED
.PHONY: ChangeLog $(srcdir)/ChangeLog coverage-report.txt
coverage-report.txt :
make -C src/kit check-coverage
make -C src/polkit check-coverage
cat src/kit/coverage-report.txt > coverage-report.txt
cat src/polkit/coverage-report.txt >> coverage-report.txt
make -C src/kit coverage-report.txt
make -C src/polkit coverage-report.txt
$(top_srcdir)/test/create-coverage-report.sh "PolicyKit" `cat src/kit/covered-files.txt src/polkit/covered-files.txt` > coverage-report.txt
check-coverage: coverage-report.txt
cat coverage-report.txt
......
......@@ -41,11 +41,16 @@ if KIT_GCOV_ENABLED
clean-gcov:
rm -f *.gcov .libs/*.gcda
.PHONY: coverage-report.txt
coverage-report.txt :
$(top_srcdir)/test/create-coverage-report.sh kit $(filter %.c,$(libkit_la_SOURCES)) > coverage-report.txt
.PHONY: coverage-report.txt covered-files.txt
check-coverage : clean-gcov all check coverage-report.txt
covered-files.txt :
echo $(addprefix src/kit/,$(filter %.c,$(libkit_la_SOURCES))) > covered-files.txt
coverage-report.txt : covered-files.txt clean-gcov all check
gcov $(filter %.c,$(libkit_la_SOURCES)) -o .libs/ > /dev/null
$(top_srcdir)/test/create-coverage-report.sh "module kit" `cat covered-files.txt` > coverage-report.txt
check-coverage : coverage-report.txt
cat coverage-report.txt
else
coverage-report.txt:
......
......@@ -85,11 +85,16 @@ if POLKIT_GCOV_ENABLED
clean-gcov:
rm -f *.gcov .libs/*.gcda
.PHONY: coverage-report.txt
coverage-report.txt :
$(top_srcdir)/test/create-coverage-report.sh polkit $(filter %.c,$(libpolkit_la_SOURCES)) > coverage-report.txt
.PHONY: coverage-report.txt covered-files.txt
check-coverage : clean-gcov all check coverage-report.txt
covered-files.txt :
echo $(addprefix src/polkit/,$(filter %.c,$(libpolkit_la_SOURCES))) > covered-files.txt
coverage-report.txt : covered-files.txt clean-gcov all check
gcov $(filter %.c,$(libpolkit_la_SOURCES)) -o .libs/ > /dev/null
$(top_srcdir)/test/create-coverage-report.sh "module polkit" `cat covered-files.txt` > coverage-report.txt
check-coverage : coverage-report.txt
cat coverage-report.txt
else
coverage-report.txt:
......
......@@ -4,19 +4,20 @@ TOTAL_ACTUAL=0
TOTAL_COVERED=0
TOTAL_SOURCE=0
P=$(dirname $0)/..
MODULE=$1
shift
echo "=============================================================================="
echo "Test coverage for module $MODULE:"
echo "Test coverage for $MODULE:"
echo "=============================================================================="
while [ $# -gt 0 ] ; do
gcov $1 -o .libs/ > /dev/null
SOURCE=`cat $1 |wc -l`
ACTUAL=`grep -v " -:" $1.gcov |wc -l`
NOT_COVERED=`grep " #####:" $1.gcov |wc -l`
SOURCE=`cat $P/$1 |wc -l`
ACTUAL=`grep -v " -:" $P/$1.gcov |wc -l`
NOT_COVERED=`grep " #####:" $P/$1.gcov |wc -l`
COVERED=$(($ACTUAL - $NOT_COVERED))
PERCENT=$((100 * $COVERED / $ACTUAL))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment