SonarQube version: 220.127.116.11709
SonarScanner version: 18.104.22.1682
Target platform: Mac OS X 11.0
Target language: C++
I have a unit test suite (based on gTest) that I am executing, with a binary that produces coverage data. Then I manipulate the data slightly to produce coverage information that SonarQube can consume, in particular:
./testing/run_cpp_tests.py -c Release -go Coverage -mt unit-tests -p -v mv build/Makefiles/Release/compile_commands.json compile_commands.json mv default.profraw unit.profraw cp build/Makefiles/Release/testing/unitTests/bin/unit-tests . xcrun llvm-profdata merge unit.profraw -o all.profdata xcrun llvm-cov show --instr-profile all.profdata unit-tests > lcov.info ./sonar-scanner/bin/sonar-scanner -Dproject.settings=testing/sonar-project.properties
Sonar scanner properties are as such (redacted where needed):
sonar.cfamily.llvm-cov.reportPath=lcov.info sonar.cfamily.analysisCache.mode=fs sonar.cfamily.analysisCache.path=analysisCache sonar.cpp.std=c++11 sonar.projectKey=<project name> sonar.sources=<list of source folders> sonar.tests=<list of unit test folders> sonar.cfamily.compile-commands=compile_commands.json sonar.host.url=<url> sonar.login=<login> sonar.sourceEncoding=UTF-8 sonar.scm.exclusions.disabled=false sonar.python.version=3.6
When I execute these commands locally, SonarQube produces code coverage data correctly.
If I put these commands into my Jenkins job (not using Jenkins plugin), code coverage produces 0% result.
If I then login to the virtual machine that Jenkins was using and execute just the sonar scanner again manually, results are once again produced correctly.
I am not completely sure where to look for issues here. There are no errors on Jenkins when reading lcov.info:
INFO: Sensor llvm-cov [cpp] INFO: Parsing /private/tmp/src/workspace/products/UnitTester/lcov.info INFO: Sensor llvm-cov [cpp] (done) | time=320ms
The only difference in logs that I see is that on Jenkins, it gets auto configured branches and such:
INFO: Load branch configuration INFO: Detected branch/PR in 'Jenkins' INFO: Auto-configuring branch 'temp-run' INFO: Load branch configuration (done) | time=5ms INFO: Auto-configuring with CI 'Jenkins'
I would appreciate any pointers as to what I could check.