Revision da775218 autotools/gen-coverage

b/autotools/gen-coverage
19 19
# 02110-1301, USA.
20 20

  
21 21
set -e
22
set -u
22 23

  
23 24
: ${COVERAGE:=coverage}
24 25
: ${PYTHON:=python}
......
26 27
: ${TEXT_COVERAGE:?}
27 28
: ${GANETI_TEMP_DIR:?}
28 29

  
29
omit=$($PYTHON -c 'import sys; import os;
30
print ",".join("%s/" % i for i in set([sys.prefix, sys.exec_prefix,
31
   os.environ["GANETI_TEMP_DIR"] + "/test"]))')
32
omit="--omit=$omit"
30
reportargs=(
31
  '--include=*'
32
  '--omit=test/*'
33
  )
33 34

  
34 35
$COVERAGE erase
35 36

  
......
43 44
  else
44 45
    cmdprefix=
45 46
  fi
46
  $cmdprefix $COVERAGE run --branch --append $script
47
  $cmdprefix $COVERAGE run --branch --append "${reportargs[@]}" $script
47 48
done
48 49

  
49 50
echo "Writing text report to $TEXT_COVERAGE ..." >&2
50
$COVERAGE report $omit | tee "$TEXT_COVERAGE"
51
$COVERAGE report "${reportargs[@]}" | tee "$TEXT_COVERAGE"
51 52

  
52 53
if [[ -n "$HTML_COVERAGE" ]]; then
53 54
  echo "Generating HTML report in $HTML_COVERAGE ..." >&2
54
  $COVERAGE html $omit -d "$HTML_COVERAGE"
55
  $COVERAGE html "${reportargs[@]}" -d "$HTML_COVERAGE"
55 56
fi

Also available in: Unified diff