1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-30 03:18:20 +00:00
trezor-firmware/core/tools/coverage-report

26 lines
548 B
Plaintext
Raw Normal View History

#!/bin/sh
COVERAGE_THRESHOLD=${COVERAGE_THRESHOLD:-0}
coverage run --source=./src /dev/null 2>/dev/null
mv .coverage .coverage.empty
coverage combine .coverage.*
2021-06-03 09:42:51 +00:00
EXCLUDES="\
src/all_modules.py,\
src/apps/ethereum/tokens.py,\
src/trezor/messages.py,\
src/trezor/enums/__init__.py"
coverage html \
2021-06-03 09:42:51 +00:00
--omit="$EXCLUDES" \
--fail-under=${COVERAGE_THRESHOLD}
if [ $? -eq 2 ]; then
echo "Code coverage is less than ${COVERAGE_THRESHOLD}%"
exit 1
fi
RESULT=$(grep pc_cov htmlcov/index.html | egrep -o '[0-9]{1,3}%')
echo "COVERAGE: ${RESULT}"