I have a requirement to provide coverage reports via SonarQube 6.7.5.38563 for a project that has mostly C code but some C++ code as well Since the tests run in a distributed environment and there is no way to merge the .gcov files afterwards and use the CFammily plugin thus I am taking a lcov .info file and converting it to cobertura XML (there is a python module that does this) and importing it using the CXX plugin
My question is how independent is the coverage report from the code is that is actually scanned since most of the C code is skipped by the CXX plugin ?
Also is there no way to use a cobertura XML report with the CFamily (paid) plugin ?
If you’ve got questions about the Cxx plugin, you should probably enter a GitHub Issue on the project. Regarding coverage with SonarCFamily, the docs indicate that you can import multiple .gcov reports. Does that meet your needs, or is there still something unanswered around file paths being different in the different environments where tests are run?
By way of example: when I run a test that accesses main.c that was built with coverage and has had gcov run on it after the tests I end up with 4 files main.c, main.gcno, main.gcda and main.c.gcov
main.c.gcov is a text file that shows the code coverage and how many times test accessed main.c
my issue is that I have the source code on several machines that run tests against the same sources so I will have the above mentioned 4 files on 5 different machines.
SO my question how can the Cfamily plugin deal with this kind of setup ?
I don’t have a CXX question as there I can use cobertura XML and it would be a great workaround if I could use cobertura XML with the CFamily as well.
I also have a similar question as @Eliezer_Ramm. I am trying to display code coverage for a C/C++ project, however, everything is displayed on SonarQube except for code coverage. I am using this version of SonarQube and these plugins:
I am generating a Cobertura Code Coverage XML and have tried using both of these keys to point to my report in the sonar-project.properties file:
sonar.flex.cobertura.reportPath
sonar.cobertura.reportPath
Under Administration --> Configuration, the “Analysis of C/C++” feature is included. I am also building my project using the Build Wrapper, MSBuild, since my project is MSBuild based, and this sonar key sonar.cfamily.build-wrapper-output=bw_output.
In a nutshell, my question is, can SonarQube analyze a Cobertura code coverage report for a C/C++ solution? Also, if it can, what else do I need to display code coverage on SonarQube?
the C/C++ analyzer can import gcov format without any issue. If you are importing it with sonar-cxx we cannot help you in this forum, please refer to their channel.
If you want to import a format which we don’t support you can always use SonarQube generic coverage format: