2020-08-13 16:37:43 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
COVERAGE_THRESHOLD=${COVERAGE_THRESHOLD:-0}
|
|
|
|
|
|
|
|
coverage run --source=./src /dev/null 2>/dev/null
|
|
|
|
mv .coverage .coverage.empty
|
|
|
|
coverage combine .coverage.*
|
|
|
|
|
2020-09-18 12:23:20 +00:00
|
|
|
coverage html \
|
|
|
|
--omit=src/trezor/messages/* \
|
2021-04-13 08:57:50 +00:00
|
|
|
--omit=src/all_modules.py \
|
|
|
|
--omit=src/apps/ethereum/tokens.py \
|
2020-09-18 12:23:20 +00:00
|
|
|
--fail-under=${COVERAGE_THRESHOLD}
|
|
|
|
|
2020-08-13 16:37:43 +00:00
|
|
|
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}"
|