Search code examples
c++sonarqubedashboardgcov

Gcov report import in Sonarqube-5.6.6(LTS) using CXX Community Plug-in


Our Sonar Build Environment details as follows:

SonarQube Server Version - 5.6.6 (64-Bit).
Sonar Client Build Operating System – Ubuntu 14.04.5 LTS (64-Bit).
Sonar-scanner- Version - 3.0.3.778.
sonar-cxx-plugin-0.9.7.jar
Source Code Language: C++

Description:-

I have .gcov coverage report. Want to know is it possible to import into Sonarqube dashboard using Cxx community plugin?

If so, kindly help me with the steps. Thanks in advance.


Solution

  • Use absolute filename path in gcovr report solved for me.

    sonar config file: sonar-project.properties

    sonar.projectKey=xxx
    sonar.sources=src
    sonar.host.url=http://xxx:xxx
    sonar.login=xxx
    sonar.language=c++
    sonar.cxx.includeDirectories=xxx
    sonar.exclusions=xxx
    sonar.cxx.coverage.reportPath=gcovr_report.xml
    sonar.cxx.coverage.itReportPath=gcovr_report.xml
    sonar.cxx.coverage.overallReportPath=gcovr_report.xml
    

    gcov temp file gcda/gcno in directory /xxx/src.

    create gcovr xml report: gcovr -r /xxx/src --xml-pretty > gcovr_report.xml

    replace filename tag in gcovr_report.xml with absolute path.

    run sonar runner: ~/sonar-scanner-3.0.3.778-linux/bin/sonar-scanner -X