CI: Avoid divide by zero error when generating coverage files

This commit is contained in:
Tim Wojtulewicz 2024-05-16 15:16:10 -07:00 committed by Tim Wojtulewicz
parent 04c8a6bde7
commit 179e4903f1

View file

@ -90,9 +90,11 @@ function check_group_coverage {
TOTAL=$(echo $(grep "$i" $DATA | cut -f 3) | tr " " "+" | bc) TOTAL=$(echo $(grep "$i" $DATA | cut -f 3) | tr " " "+" | bc)
fi fi
PERCENTAGE=$(echo "scale=3;100*$RUN/$TOTAL" | bc | tr "\n" " ") if [ $TOTAL -ne 0 ]; then
printf "%-50s\t%12s\t%6s %%\n" "$i" "$RUN/$TOTAL" $PERCENTAGE | PERCENTAGE=$(echo "scale=3;100*$RUN/$TOTAL" | bc | tr "\n" " ")
sed 's|#|/|g' >>$OUTPUT printf "%-50s\t%12s\t%6s %%\n" "$i" "$RUN/$TOTAL" $PERCENTAGE |
sed 's|#|/|g' >>$OUTPUT
fi
done done
} }