File: coverage_test.sh

package info (click to toggle)
pybj 0.2.6-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 468 kB
  • sloc: ansic: 2,214; python: 1,613; sh: 12; makefile: 5
file content (23 lines) | stat: -rwxr-xr-x 1,047 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
#!/usr/bin/env bash
set -eu

# Requirements
# ------------
# Python: coverage
# C: Gcov (GCC), lcov

git clean -fdX build/ _bjdata*.so
rm -rf coverage/{c,python}

# Coverage should be measured with extension compiled for both Python 2 & 3 (e.g. via separate venv)
export CFLAGS="-coverage"
python setup.py build_ext -i
python -mcoverage run --branch --omit=bjdata/compat.py -m unittest discover test/ -vf
python -mcoverage html -d coverage/python
lcov --capture --directory . --output-file /tmp/bjdata-coverage.info.pre
# Only consider own source files. (Unfortunately extract/remove commands seem incapable of reading from stdin)
lcov --extract /tmp/bjdata-coverage.info.pre "$(pwd)/src/*" --output-file /tmp/bjdata-coverage.info.pre2
# Exclude CPython floating point logic in coverage
lcov --remove /tmp/bjdata-coverage.info.pre2 '*/src/python_funcs.*' --output-file /tmp/bjdata-coverage.info
genhtml /tmp/bjdata-coverage.info --output-directory coverage/c --legend
echo -e "\nFor coverage results see index.html in coverage sub-directories.\n"