File: gen_html_coverage.sh

package info (click to toggle)
proj 9.7.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 43,800 kB
  • sloc: sh: 218,851; cpp: 171,440; sql: 83,614; python: 8,422; ansic: 6,254; yacc: 1,349; makefile: 33
file content (43 lines) | stat: -rwxr-xr-x 966 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/sh
set -eu

# To filter only on c++ stuff:
# scripts/gen_html_coverage.sh -ext "*.cpp,*.hh"

SCRIPT_DIR=$(dirname "$0")
case $SCRIPT_DIR in
    "/"*)
        ;;
    ".")
        SCRIPT_DIR=$(pwd)
        ;;
    *)
        SCRIPT_DIR=$(pwd)/$(dirname "$0")
        ;;
esac

FILTER=""
if test $# -ge 1; then
    if test "$1" = "--help"; then
        echo "Usage: gen_html_coverage.sh [--help] [-ext \"ext1,...\"]"
        exit
    fi

    if test "$1" = "-ext"; then
        FILTER="$2"
        shift
        shift
    fi

    if test $# -ge 1; then
        echo "Invalid option: $1"
        echo "Usage: gen_html_coverage.sh [--help] [-ext \"ext1,...\"]"
        exit
    fi
fi

rm -rf coverage_html
lcov --directory src --directory include --capture --output-file proj.info
"$SCRIPT_DIR"/filter_lcov_info.py "$FILTER" < proj.info > proj.info.filtered
mv proj.info.filtered proj.info
genhtml -o ./coverage_html --ignore-errors source --num-spaces 2 proj.info