I’m trying to get coverage data loaded into SonarCloud via SonarScanner CLI but something is going wrong and even the debug logs do not contain any hints.
Project structure looks like this:
/path/to/project/
src/
lib_a/
<cpp code>
lib_b/
<cpp code>
.build-dir/
.builddir-test-unit-coverage/
compile_commands.json
<various cmake files>
lib_a/
CMakeFiles/
/project.dir
<cpp code .o + .gcda + gcdo files>
lib_b/
CMakeFiles/
/project.dir
<cpp code .o + .gcda + gcdo files>
SonarScanner CLI command looks like this:
SONAR_SCANNER_OPTS="<opts>" sonar-scanner -X
where <opts>
are:
-Dsonar.projectBaseDir=/path/to/project
-Dsonar.cfamily.compile-commands=/path/to/project/.builddir/.builddir-test-unit-coverage/compile_commands.json
-Dsonar.cfamily.gcov.reportsPath=/path/to/project/.builddir/.builddir-test-unit-coverage/
and /path/to/project/sonar-project.properties
contains following additional options:
sonar.sources=src
sonar.exclusions=**/*.json, **/*.py, **/*.js, **/*.xml
sonar.sourceEncoding=UTF-8
I believe the code analysis completes correctly using above settings based on the following logs:
09:55:44.543 INFO: Sensor CFamily [cpp]
09:55:44.576 INFO: CFamily plugin version: 6.53.0.67215
09:55:44.577 INFO: Using compile commands: /path/to/project/.builddir/.builddir-test-unit-coverage/compile_commands.json
09:55:44.584 INFO: Available processors: 16
09:55:44.587 INFO: Using 16 threads for analysis.
...
10:05:04.674 INFO: PCH: unique=0 use=0 (forceInclude=0,throughHeader=0,firstInclude=0) out of 864 (forceInclude=0,throughHeader=0)
10:05:04.674 INFO: Z3 refutation rate: 0 out of 35
10:05:04.674 INFO: SE: 864 out of 864
10:05:04.886 INFO: Subprocess(es) done in 556093ms
However coverage data is not being detected/analyzed. All I see in the logs is following lines:
10:05:06.908 INFO: ------------- Run sensors on project
10:05:06.913 DEBUG: 'llvm-cov' skipped because one of the required properties is missing
10:05:06.914 DEBUG: 'cppunit' skipped because one of the required properties is missing
10:05:06.914 DEBUG: 'VisualStudioCoverage' skipped because one of the required properties is missing
10:05:06.914 DEBUG: 'bullseye' skipped because one of the required properties is missing
10:05:06.914 DEBUG: 'cobertura' skipped because one of the required properties is missing
10:05:06.915 DEBUG: 'Valgrind' skipped because one of the required properties is missing
10:05:06.915 DEBUG: 'Java CPD Block Indexer' skipped because there is no related file in current project
10:05:06.915 DEBUG: Sensors : gcov -> Zero Coverage Sensor
10:05:06.916 INFO: Sensor gcov [cpp]
10:05:06.998 INFO: Sensor gcov [cpp] (done) | time=82ms
10:05:06.998 INFO: Sensor Zero Coverage Sensor
10:05:07.169 INFO: Sensor Zero Coverage Sensor (done) | time=171ms
Notice this is already with debug enabled, yet there is no indication as to why coverage sensor completed in 171ms and did not detect/process any coverage data.
Any pointers as to what I am missing would be greatly appreciated.