Thanks for the update. I can’t see your updated docs, are they live yet?
I’ve managed to solved my issue. The coverage I was generating didn’t include branch coverage. I just assumed it did.
Here’s a report with branch coverage enabled:
The secret is to explicitly generate branch coverage. Here’s the magic option for
lcov --capture --rc lcov_branch_coverage=1 [...]
(If you use
gcov, it should be possible to use the
-b option to generate branch data – but I didn’t test if Codecov parses branch data in gcov format.)
So some feedback:
- None of the C++ examples show branch coverage enabled, eg
-b. That would be a good hint for future spelunkers.
- It’s not clear in Codecov’s UI what sort of data was contained in your uploaded report. If Codecov had some UI which said “we accepted your report, which had line coverage YES branch coverage NO”.
I still have one issue, which is that Codecov doesn’t highlight which branches were taken (or not) in the UI. The line is marked as “partially covered” and it’s left to the reader to determine which branches need coverage. It’s possible to derive this information from gcov/lcov, for example
gcovr tool can do it locally (see the second screenshot in this section of its docs). That’s my feature request