root / autotools / gen-coverage @ f774bd03
History | View | Annotate | Download (1.3 kB)
1 | 27e336af | Michael Hanselmann | #!/bin/bash |
---|---|---|---|
2 | 27e336af | Michael Hanselmann | # |
3 | 27e336af | Michael Hanselmann | |
4 | 27e336af | Michael Hanselmann | # Copyright (C) 2010 Google Inc. |
5 | 27e336af | Michael Hanselmann | # |
6 | 27e336af | Michael Hanselmann | # This program is free software; you can redistribute it and/or modify |
7 | 27e336af | Michael Hanselmann | # it under the terms of the GNU General Public License as published by |
8 | 27e336af | Michael Hanselmann | # the Free Software Foundation; either version 2 of the License, or |
9 | 27e336af | Michael Hanselmann | # (at your option) any later version. |
10 | 27e336af | Michael Hanselmann | # |
11 | 27e336af | Michael Hanselmann | # This program is distributed in the hope that it will be useful, but |
12 | 27e336af | Michael Hanselmann | # WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | 27e336af | Michael Hanselmann | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | 27e336af | Michael Hanselmann | # General Public License for more details. |
15 | 27e336af | Michael Hanselmann | # |
16 | 27e336af | Michael Hanselmann | # You should have received a copy of the GNU General Public License |
17 | 27e336af | Michael Hanselmann | # along with this program; if not, write to the Free Software |
18 | 27e336af | Michael Hanselmann | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
19 | 27e336af | Michael Hanselmann | # 02110-1301, USA. |
20 | 27e336af | Michael Hanselmann | |
21 | 27e336af | Michael Hanselmann | set -e |
22 | 27e336af | Michael Hanselmann | |
23 | 27e336af | Michael Hanselmann | : ${COVERAGE:=coverage} |
24 | 27e336af | Michael Hanselmann | : ${PYTHON:=python} |
25 | 27e336af | Michael Hanselmann | : ${COVERAGE_FILE:?} |
26 | 27e336af | Michael Hanselmann | : ${TEXT_COVERAGE:?} |
27 | 577b170b | Iustin Pop | : ${GANETI_TEMP_DIR:?} |
28 | 27e336af | Michael Hanselmann | |
29 | 577b170b | Iustin Pop | omit=$($PYTHON -c 'import sys; import os; |
30 | 577b170b | Iustin Pop | print ",".join("%s/" % i for i in set([sys.prefix, sys.exec_prefix, |
31 | 577b170b | Iustin Pop | os.environ["GANETI_TEMP_DIR"] + "/test"]))') |
32 | 577b170b | Iustin Pop | omit="--omit=$omit" |
33 | 27e336af | Michael Hanselmann | |
34 | 27e336af | Michael Hanselmann | $COVERAGE erase |
35 | 27e336af | Michael Hanselmann | |
36 | 27e336af | Michael Hanselmann | for script; do |
37 | 27e336af | Michael Hanselmann | $COVERAGE run --branch --append $script |
38 | 27e336af | Michael Hanselmann | done |
39 | 27e336af | Michael Hanselmann | |
40 | 27e336af | Michael Hanselmann | echo "Writing text report to $TEXT_COVERAGE ..." >&2 |
41 | 27e336af | Michael Hanselmann | $COVERAGE report $omit | tee "$TEXT_COVERAGE" |
42 | 27e336af | Michael Hanselmann | |
43 | 27e336af | Michael Hanselmann | if [[ -n "$HTML_COVERAGE" ]]; then |
44 | 27e336af | Michael Hanselmann | echo "Generating HTML report in $HTML_COVERAGE ..." >&2 |
45 | 27e336af | Michael Hanselmann | $COVERAGE html $omit -d "$HTML_COVERAGE" |
46 | 27e336af | Michael Hanselmann | fi |