5 MIN_COVERAGE_PERCENT="$2"
7 function coverage_from_report() {
8 local xpath_expr="string(/report/counter[@type='INSTRUCTION']/@$1)"
9 xpath -q -e "$xpath_expr" "$JACOCO_REPORT"
12 missed=`coverage_from_report missed`
13 covered=`coverage_from_report covered`
14 total=$(($missed + $covered))
15 coverage=$((100 * $covered / $total))
17 echo "Coverage: $coverage% (covered/total: $covered/$total)"
19 if [[ $coverage -lt $MIN_COVERAGE_PERCENT ]]; then
20 echo "Coverage is too low. Minimum coverage: $MIN_COVERAGE_PERCENT%"