mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-21 05:48:23 +00:00
22 lines
508 B
Bash
Executable File
22 lines
508 B
Bash
Executable File
#!/bin/sh
|
|
|
|
COVERAGE_THRESHOLD=${COVERAGE_THRESHOLD:-0}
|
|
|
|
coverage run --source=./src /dev/null 2>/dev/null
|
|
mv .coverage .coverage.empty
|
|
coverage combine .coverage.*
|
|
|
|
coverage html \
|
|
--omit=src/trezor/messages/* \
|
|
--omit=src/all_modules.py \
|
|
--omit=src/apps/ethereum/tokens.py \
|
|
--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}"
|