Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions py_loaded_gcovr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ while [ $# -ne 0 ]; do
done

NUM=0
TOTAL_UNCOVERD_LINES=0

gcovr "${GCOVR_ARGS[@]}" | while read Line; do
# Get file name
Expand All @@ -36,6 +37,7 @@ gcovr "${GCOVR_ARGS[@]}" | while read Line; do
[ ! -f "$File" ] && continue

# Find start and end of actual code, not CFFI prefix and postfix
# the cffi is add a /****(X60)/ on pre and post fix
Lines=$(grep -nE '/\*{60}/' "$File" | cut -f1 -d':')
Start=$(echo $Lines | cut -f1 -d' ')
End=$(echo $Lines | cut -f2 -d' ')
Expand Down Expand Up @@ -95,17 +97,22 @@ gcovr "${GCOVR_ARGS[@]}" | while read Line; do
fi
fi

if [ ! -z $NO_CODE ]; then
if [ $A -eq $B ]; then
# print a single digit for a single line or a range
if [ $A -eq $B ]; then
TOTAL_UNCOVERD_LINES=$((TOTAL_UNCOVERD_LINES + 1))
if [ ! -z $NO_CODE ]; then
echo -n "$A,"
else
fi
else
TOTAL_UNCOVERD_LINES=$((TOTAL_UNCOVERD_LINES + B - A + 1))
if [ ! -z $NO_CODE ]; then
echo -n "$A-$B,"
fi

fi
done

if [ ! -z $NO_CODE ]; then
echo
fi
TOTAL_LINES=$((End - Start))
echo -ne "\nTotal lines: $TOTAL_LINES"
echo -ne "\nUncoverd lines: $TOTAL_UNCOVERD_LINES"
echo -ne "\nPercentage: $(( 100-(TOTAL_UNCOVERD_LINES*100)/TOTAL_LINES))%"
done