From da775218a2038956d4b9ff5c8c9f3365ea898f20 Mon Sep 17 00:00:00 2001
From: Michael Hanselmann <hansmi@google.com>
Date: Mon, 9 Jan 2012 15:12:50 +0100
Subject: [PATCH] gen-coverage: Change filter

It is not necessary to run a Python script to generate the filter, which
didn't work very well anyway on systems with modules in
/usr/share/pyshared.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
---
 autotools/gen-coverage | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/autotools/gen-coverage b/autotools/gen-coverage
index 1324724fb..91bd004c7 100755
--- a/autotools/gen-coverage
+++ b/autotools/gen-coverage
@@ -19,6 +19,7 @@
 # 02110-1301, USA.
 
 set -e
+set -u
 
 : ${COVERAGE:=coverage}
 : ${PYTHON:=python}
@@ -26,10 +27,10 @@ set -e
 : ${TEXT_COVERAGE:?}
 : ${GANETI_TEMP_DIR:?}
 
-omit=$($PYTHON -c 'import sys; import os;
-print ",".join("%s/" % i for i in set([sys.prefix, sys.exec_prefix,
-   os.environ["GANETI_TEMP_DIR"] + "/test"]))')
-omit="--omit=$omit"
+reportargs=(
+  '--include=*'
+  '--omit=test/*'
+  )
 
 $COVERAGE erase
 
@@ -43,13 +44,13 @@ for script; do
   else
     cmdprefix=
   fi
-  $cmdprefix $COVERAGE run --branch --append $script
+  $cmdprefix $COVERAGE run --branch --append "${reportargs[@]}" $script
 done
 
 echo "Writing text report to $TEXT_COVERAGE ..." >&2
-$COVERAGE report $omit | tee "$TEXT_COVERAGE"
+$COVERAGE report "${reportargs[@]}" | tee "$TEXT_COVERAGE"
 
 if [[ -n "$HTML_COVERAGE" ]]; then
   echo "Generating HTML report in $HTML_COVERAGE ..." >&2
-  $COVERAGE html $omit -d "$HTML_COVERAGE"
+  $COVERAGE html "${reportargs[@]}" -d "$HTML_COVERAGE"
 fi
-- 
GitLab