Coverage report for file is not showing a few select lines as code, even though they are in the gcov data

Description

A coverage report for a C file shows mostly reasonable results. However, a few lines which are clearly code that must have been executed are shown in white, not in green. Yet the gcov data includes them. Soo Codecov seemingly randomly skips some lines in its display.

Commit SHAs

E.g. ff4358f9ab0d01e8e194b2651d62ee6bbd985fed

Repository

CI/CD or Build URL

Uploader

We are using the bash uploader, i.e., https://codecov.io/bash

Codecov Output

If you really need this, I guess we can extract it from the GitHub Action CI logs above (but there are like … 18 or so ?)

Expected Results

For file src/io.c, line 859 should be shown in green.

Actual Results

It is shown in white, i.e. not even as uncovered code. Moreover, inspecting the gcov uploads for that commit, e.g. this, the line is clearly reported as being covered. Here is an excerpt of the relevant part, I marked the relevant line

...
# path=src#io.c.gcov.reduced
        -:    0:Source:src/io.c
func
#####:105:
73289723:107:
func
#####:110:
...
34:836:
34:839:
func
#####:851:
#####:853:
branch  0 never executed::
branch  1 never executed::
call    2 never executed::
#####:856:
#####:857:
#####:858:
#####:859:      <--- this is the line, reported as covered code like all before and after
#####:860:
#####:861:
#####:862:
#####:863:
#####:864:
#####:867:
#####:870:
func
29:891:
...

There are more examples in that file, e.g. line 1133, 1196, 1197, 1220

Additional Information

None.

@fingolfin I think there might be a file name collision happening. What happens if you run with -X fix?

There definitely is a filename collision; there are several files called io.c involved, but we only care about one. We’ve been fighting with this over the years, and in the end the only way I found to get Codecov to ignore all those other files was to make sure they are built without coverage tracking turned on (which requires quite some hacking on our side).

Among the things we tried was to add exclude the directories with the “bad” files via .codecov.yml, like this:

ignore:
 - "extern"
 - "hpcgap/extern"
 - "tst"
 - "pkg"
 - "grp/*.grp"

But that didn’t work. We also invoke codecov.sh like this, but it doesn’t seem to do anything either: ./codecov.sh -f '!./pkg/*' -f '!./extern/*' -f '!./build/*'.

I’ll try the -X fix you suggest, though I wonder what it does? The description on Fixing Reports is … not helpful. It lists some factoids about various languages, but doesn’t actually say what it “fixes” about them. Also, there seem to be some markdown and/or rendering issues on that page.

Apologies, I meant -X network. Sorry for the confusion, your instincts were right.