Sonar scanner not able to match files in gcovr coverage output

  • which versions are you using:
    SonarQube 10.0 (build 68432) Developer Edition deployed using Docker official image

  • what are you trying to achieve

    • C unit test project, compiled using CMake, generating coverage data using gcov.
      • project sources are located in proj/src
    • gcovr is used to create reports (--sonarqube option output called sq_coverage.xml)
    • Goal is to upload coverage data using sonar.coverageReportPaths scanner option
  • what have you tried so far to achieve this

    • in sonar.properties
      • sonar.sources=proj/src
    • in generated file sq_coverage.xml, we see files don’t have any path, only file name (<file path="source.c">)

Scanner is not able to match files, giving following INFO message (no DEBUG message available)

17:27:08 08:27:08.637 INFO: Parsing ...\sq_coverage.xml
17:27:08 08:27:08.685 INFO: Imported coverage data for 0 files
17:27:08 08:27:08.687 INFO: Coverage data ignored for 10 unknown files, including:
17:27:08 source.c
17:27:08 source_common.c
17:27:08 source_driver.c
17:27:08 source_utils.c
17:27:08 source_dummy.c

We tried several options in Gcovr, but report only contains source file name.

As sonar.sources file is properly configured to the path of the project source files, we would expect scanner to properly match file proj/src/source.c

How can we make gcovr --sonarqube output understandable by the sonar scanner?

Thanks in advance for your advice!

Hi,

Unfortunately, you’re going to have to direct this question to the gcovr folks.

 
:woman_shrugging:
Ann