nix/coverage-html: use line coverage for badge number
This commit is contained in:
@@ -59,15 +59,17 @@ stdenv.mkDerivation {
|
||||
|
||||
llvm-cov show "''${LLVM_COV_ARGS[@]}"
|
||||
|
||||
# Skip "Totals" and "Function Coverage", get "Line Coverage"
|
||||
TOTAL_COVERAGE="$(
|
||||
htmlq 'td > pre' <coverage-html/index.html \
|
||||
| sed '0,/^<pre>Totals<\/pre>$/d' \
|
||||
| head -n 1 \
|
||||
| sed -e 's/<pre>[[:space:]]*//' -e 's/%.*$/%/' \
|
||||
| sed -e '0,/^<pre>Totals<\/pre>$/d' \
|
||||
| sed -n -e '2,1p' \
|
||||
| sed -e 's/<pre>[[:space:]]*//' \
|
||||
| sed -e 's/%.*$/%/'
|
||||
)"
|
||||
|
||||
if [[ "$TOTAL_COVERAGE" == *% ]]; then
|
||||
COVERAGE_VALUE="''${TOTAL_COVERAGE%\%}"
|
||||
COVERAGE_VALUE="$(printf "%.0f" "''${TOTAL_COVERAGE%\%}")"
|
||||
if [[ "$COVERAGE_VALUE" -ge 80 ]]; then
|
||||
COLOR="green"
|
||||
elif [[ "$COVERAGE_VALUE" -ge 50 ]]; then
|
||||
|
||||
Reference in New Issue
Block a user