I’m trying to get a code coverage report generated using gcovr (v7.2) for c source files. I’ve added the path to the xml file in sonar.coverageReportPath. This is the output in my Github Actions logs:
...
------------- Run sensors on project
INFO: Sensor Generic Coverage Report
INFO: Parsing /mnt/coverage/coverage.xml
INFO: Imported coverage data for 2 files
INFO: Sensor Generic Coverage Report (done) | time=28ms
INFO: Sensor Analysis Warnings import [csharp]
INFO: Sensor Analysis Warnings import [csharp] (done) | time=0ms
INFO: Sensor Zero Coverage Sensor
INFO: Sensor Zero Coverage Sensor (done) | time=11ms
...
Dashboard shows coverage as empty. I can see the coverage manually using other formats (e.g., html, text, etc) so I’m unsure what’s wrong here.
I’ve attached the xml file that was generated (renamed to .txt to be able to upload)
So it looks like coverage is being imported for your project! But your test branch doesn’t have any new lines to cover. This can happen when you’ve only changed configuration files, or other files that can’t be covered by tests (think XML files).
If you should be seeing new lines to cover (new code that can be covered by test), that’s a different problem. But if not, then I think after merging your coverage config into your main branch, you should see that 5.3% after merge figure. Is that not the case?
I’m generating my coverage reports using gcovr. I’m able to see the coverage with other output forms on this test branch and other branches. For example:
That’s really weird to see a 5.3% after merge figure on your PR, but not on your main branch. With the same coverage file being imported, these statistics should be identical.
Could you share:
The full analysis logs (sonar-scanner -X) of your main branch
A copy of the coverage report that is being imported for your main branch?
It also looks like this PR analysis was run a while ago. If you run it again, do you get the same estimated after merge figure?