Skip to content

Commit a4ca8b3

Browse files
authored
fix for coverage failure (#699)
1 parent 0de8027 commit a4ca8b3

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

tool/generate_coverage.sh

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,9 @@ if [ "${IS_FLUTTER_PACKAGE}" != true ]; then
7171
)
7272
fi
7373

74-
# package:coverage emits branch details as BRDA records without BRF/BRH totals,
75-
# which genhtml 2.x does not summarize. Calculate the branch rate directly.
74+
# package:coverage may emit BRDA records without BRF/BRH totals, and some
75+
# coverage producers do not emit branch records at all. When BRDA is present,
76+
# calculate the branch rate directly. Otherwise, keep reporting line coverage.
7677
BRANCH_SUMMARY=$(awk -F'[:,]' '
7778
/^BRDA:/ {
7879
found++
@@ -82,13 +83,17 @@ BRANCH_SUMMARY=$(awk -F'[:,]' '
8283
}
8384
END {
8485
if (found == 0) {
85-
print "Error: no branch coverage data found" > "/dev/stderr"
86-
exit 1
86+
print "none"
87+
exit 0
8788
}
8889
printf "%.1f%% (%d of %d branches)", 100 * hit / found, hit, found
8990
}
9091
' coverage/lcov.info)
91-
echo "Branch coverage: $BRANCH_SUMMARY"
92+
if [ "$BRANCH_SUMMARY" = "none" ]; then
93+
echo "Warning: no branch coverage data found in coverage/lcov.info; continuing with line coverage only."
94+
else
95+
echo "Branch coverage: $BRANCH_SUMMARY"
96+
fi
9297

9398
# Install lcov if needed
9499
if ! command -v lcov &> /dev/null; then

0 commit comments

Comments
 (0)