Must-share information (formatted with Markdown):
- which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
I am using SonarQube Developer edition v7.7 with sonar-scanner v4.2
- what are you trying to achieve
I have a simple project consisting of ~200 lines of code with google tests. I have an html page successfully generated from llvm-cov showing 87% code coverage. I am trying to upload this coverage report to SonarQube but all attempts have lead to 0% coverage on the SonarQube project page.
- what have you tried so far to achieve this
I have tried the following:
llvm-cov show ./MyTest -instr-profile=coverage.profdata -format=html -output-dir=coverage
llvm-cov export ./MyTest-instr-profile=coverage.profdata > coverage.json
llvm-cov show ./MyTest -instr-profile=coverage.profdata -show-expansions -show-regions -show-line-counts -use-color-false > coverage.txt
The SonarQube documentation does not specify what format the report needs to be in order to be parsed by SonarQube. The actual security and vulnerability scanning works fine. I just can’t seem to get the coverage report to show greater than 0%.
I run the following command with the following relevant output I receive from the scanner:
> build-wrapper-Linux-x86-64 --out-dir sonarqube make -j8 > sonar-scanner -Dsonar.projectKey=MyProject -Dsonar.sources=src -Dsonar.tests=test -Dsonar.cfamily.build-wrapper-output=sonarqube -Dsonar.cfamily.llvm-cov.reportPath=build/bin/coverage.txt -Dsonar.host.url=https://my.url.net -Dsonar.login=my-hash-login
… INFO: Sensor llvm-cov [cpp] INFO: Parsing /builds/myproject/build/bin/coverage.txt INFO: Sensor llvm-cov [cpp] (done) | time=169ms ...
I’m assuiming I’m not feeding the scanner correctly formatted llvm-cov code coverage. Is there a specific format I need to be using or am I doing something obviously incorrect?