Fix coverage reports
authorIustin Pop <iustin@google.com>
Wed, 24 Nov 2010 16:06:32 +0000 (16:06 +0000)
committerIustin Pop <iustin@google.com>
Wed, 24 Nov 2010 16:52:51 +0000 (16:52 +0000)
Currently, the coverage reports include the unittests themselves, and
this skewes unfairly the reports, as the coverage for the tests is very
high (since they all run).

To fix this, we export the ganeti temp dir from run-in-temp-dir, and we
use that to exclude the tests directory. The patch also fixes a but
related to multiple directories to be omitted (--omit a --omit b is
wrong, it needs to be --omit a,b).

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

autotools/gen-coverage
autotools/run-in-tempdir

index f8f3865..8d6c2d4 100755 (executable)
@@ -24,10 +24,12 @@ set -e
 : ${PYTHON:=python}
 : ${COVERAGE_FILE:?}
 : ${TEXT_COVERAGE:?}
+: ${GANETI_TEMP_DIR:?}
 
-omit=$($PYTHON -c 'import sys;
-print " ".join(["--omit=%s/" % i for i in
-                set([sys.prefix, sys.exec_prefix])])')
+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"
 
 $COVERAGE erase
 
index 9cab50f..4114346 100755 (executable)
@@ -8,4 +8,4 @@ trap "rm -rf $tmpdir" EXIT
 cp -r daemons scripts lib tools test $tmpdir
 mv $tmpdir/lib $tmpdir/ganeti
 
-cd $tmpdir && "$@"
+cd $tmpdir && GANETI_TEMP_DIR="$tmpdir" "$@"