Bitbucket C++ Coverage SonarCloud

Hi all, having a terrible time trying to get over 0% coverage for C, C++, and python code in one repository. I can get the project to analyze, but only three of my 100+ issues are C family errors (we definitely are not that clean) and I cannot get over 0% coverage no matter what I try. Any help is appreciated. Current pipeline configuration with bitbucket:

definitions:
  caches:
    sonar: ~/.sonar/cache  # Caching SonarCloud artifacts will speed up your build
  steps:
    - step: &build-test-sonarcloud
        name: Build, test and analyze on SonarCloud
        caches:
          - sonar
        size: 2x  # Increase the size to get more memory (1x, 2x, 4x, etc.)
        script:
          - git config --global --add safe.directory /opt/atlassian/pipelines/agent/build
          - sudo chown -R evi:evi .
          - git lfs install || true
          - git lfs update --force
          - git lfs pull
          - tar xzf soup_redux.tgz --directory /path/to/ev && mv -v /path/to/soup
          - ls -ld /path/to/soup/boost_1_80_0/boost
          - ln -s $(pwd) path/to/shared-libs
          - find /path/to/soup -type d
          - echo "Starting sonarcloud scan"
          - export SONAR_SCANNER_VERSION=6.2.1.4610
          - export SONAR_SCANNER_HOME=$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-linux-x64
          - export BW_OUTPUT=$HOME/.sonar/bw-output
          - mkdir -p $BW_OUTPUT
          - curl --create-dirs -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_VERSION-linux-x64.zip
          - unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
          - export PATH=$SONAR_SCANNER_HOME/bin:$PATH
          - curl --create-dirs -sSLo $HOME/.sonar/build-wrapper-linux-x86.zip https://sonarcloud.io/static/cpp/build-wrapper-linux-x86.zip
          - unzip -o $HOME/.sonar/build-wrapper-linux-x86.zip -d $HOME/.sonar/
          - export PATH=$HOME/.sonar/build-wrapper-linux-x86:$PATH
          - mkdir -p build
          - cd build
          - source /path/to/sharedlibs/env.bashrc && cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ..
          - make clean
          - build-wrapper-linux-x86-64 --out-dir $BW_OUTPUT make all || true
          - sonar-scanner -Dsonar.cfamily.compile-commands=$BW_OUTPUT/compile_commands.json
        artifacts:
          - compile_commands.json

What do the logs say about importing code coverage when you try?

Analyzing your logs should also be useful if you doubt your C/C++ analsyis results. Do you see all the files you see to expect (sonar-scanner -X helps here). Are you performing a clean build to produce your compile commands?

Seeing a lot of this even though I have these set:

- sonar.cfamily.gcov.reportsPath: <empty>
14:52:44.374 DEBUG 'llvm-cov' skipped because of missing configuration requirements.
Accessed configuration:
- sonar.cfamily.llvm-cov.reportPath: <empty>
- sonar.cfamily.gcov.reportsPath: <empty>
14:52:44.375 DEBUG 'cppunit' skipped because of missing configuration requirements.
Accessed configuration:
- sonar.cfamily.cppunit.reportsPath: <empty>
- sonar.cfamily.llvm-cov.reportPath: <empty>
- sonar.cfamily.gcov.reportsPath: <empty>
14:52:44.375 DEBUG 'VisualStudioCoverage' skipped because of missing configuration requirements.
Accessed configuration:
- sonar.cfamily.vscoveragexml.reportsPath: <empty>
- sonar.cfamily.cppunit.reportsPath: <empty>
- sonar.cfamily.llvm-cov.reportPath: <empty>
- sonar.cfamily.gcov.reportsPath: <empty>
14:52:44.375 DEBUG 'bullseye' skipped because of missing configuration requirements.
Accessed configuration:
- sonar.cfamily.vscoveragexml.reportsPath: <empty>
- sonar.cfamily.cppunit.reportsPath: <empty>
- sonar.cfamily.llvm-cov.reportPath: <empty>
- sonar.cfamily.bullseye.reportPath: <empty>
- sonar.cfamily.gcov.reportsPath: <empty>
14:52:44.375 DEBUG 'cobertura' skipped because of missing configuration requirements.
Accessed configuration:
- sonar.cfamily.vscoveragexml.reportsPath: <empty>
- sonar.cfamily.cppunit.reportsPath: <empty>
- sonar.cfamily.llvm-cov.reportPath: <empty>
- sonar.cfamily.cobertura.reportPaths: <empty>
- sonar.cfamily.bullseye.reportPath: <empty>
- sonar.cfamily.gcov.reportsPath: <empty>
14:52:44.376 DEBUG 'Valgrind' skipped because of missing configuration requirements.
Accessed configuration:
- sonar.cfamily.vscoveragexml.reportsPath: <empty>
- sonar.cfamily.cppunit.reportsPath: <empty>
- sonar.cfamily.llvm-cov.reportPath: <empty>
- sonar.cfamily.cobertura.reportPaths: <empty>
- sonar.cfamily.valgrind.reportsPaths: <empty>
- sonar.cfamily.bullseye.reportPath: <empty>
- sonar.cfamily.gcov.reportsPath: <empty>
14:52:44.376 DEBUG 'Import external issues report from SARIF file.' skipped because of missing configuration requirements.
Accessed configuration:
- sonar.cfamily.vscoveragexml.reportsPath: <empty>
- sonar.cfamily.cppunit.reportsPath: <empty>
- sonar.cfamily.llvm-cov.reportPath: <empty>
- sonar.cfamily.cobertura.reportPaths: <empty>
- sonar.cfamily.valgrind.reportsPaths: <empty>
- sonar.cfamily.bullseye.reportPath: <empty>
- sonar.sarifReportPaths: <empty>
- sonar.cfamily.gcov.reportsPath: <empty>

Also a lot of these:


14:51:35.372 DEBUG Analyzing file: file:///opt/atlassian/pipelines/agent/build/build/Apps/DDS/CMakeFiles/json_subscriber_app_autogen.dir/compiler_depend.ts
14:51:35.373 DEBUG Analyzing file "/opt/atlassian/pipelines/agent/build/build/Apps/DDS/CMakeFiles/json_subscriber_app_autogen.dir/compiler_depend.ts" with linterId "default"
14:51:35.373 DEBUG Parsing /opt/atlassian/pipelines/agent/build/build/Apps/DDS/CMakeFiles/json_subscriber_app_autogen.dir/compiler_depend.ts with @typescript-eslint/parser
14:51:35.374 DEBUG Failed to parse /opt/atlassian/pipelines/agent/build/build/Apps/DDS/CMakeFiles/json_subscriber_app_autogen.dir/compiler_depend.ts with TypeScript parser: Invalid character.
14:51:35.374 WARN  Failed to parse file [Apps/DDS/CMakeFiles/json_subscriber_app_autogen.dir/compiler_depend.ts] at line 1: Invalid character.
14:51:35.374 DEBUG Cache entry created for key 'jssecurity:ucfgs:SEQ:10.20.0.29356:evidentvascular_evi-shared-libs:Apps/DDS/CMakeFiles/json_subscriber_app_autogen.dir/compiler_depend.ts' containing 0 file(s)
14:51:35.374 DEBUG Cache entry created for key 'jssecurity:ucfgs:JSON:10.20.0.29356:evidentvascular_evi-shared-libs:Apps/DDS/CMakeFiles/json_subscriber_app_autogen.dir/compiler_depend.ts'
14:51:35.374 DEBUG Cache entry created for key 'js:filemetadata:10.20.0.29356:evidentvascular_evi-shared-libs:Apps/DDS/CMakeFiles/json_subscriber_app_autogen.dir/compiler_depend.ts'
14:51:35.374 DEBUG Cache strategy set to 'WRITE_ONLY' for file 'CMakeFiles/Nightly.dir/compiler_depend.ts' as current analysis requires all files to be analyzed
14:51:35.374 DEBUG Analyzing file: file:///opt/atlassian/pipelines/agent/build/build/CMakeFiles/Nightly.dir/compiler_depend.ts
14:51:35.375 DEBUG Analyzing file "/opt/atlassian/pipelines/agent/build/build/CMakeFiles/Nightly.dir/compiler_depend.ts" with linterId "default"
14:51:35.376 DEBUG Parsing /opt/atlassian/pipelines/agent/build/build/CMakeFiles/Nightly.dir/compiler_depend.ts with @typescript-eslint/parser
14:51:35.376 DEBUG Failed to parse /opt/atlassian/pipelines/agent/build/build/CMakeFiles/Nightly.dir/compiler_depend.ts with TypeScript parser: Invalid character.
14:51:35.376 WARN  Failed to parse file [CMakeFiles/Nightly.dir/compiler_depend.ts] at line 1: Invalid character.
14:51:35.376 DEBUG Cache entry created for key 'jssecurity:ucfgs:SEQ:10.20.0.29356:evidentvascular_evi-shared-libs:CMakeFiles/Nightly.dir/compiler_depend.ts' containing 0 file(s)
14:51:35.376 DEBUG Cache entry created for key 'jssecurity:ucfgs:JSON:10.20.0.29356:evidentvascular_evi-shared-libs:CMakeFiles/Nightly.dir/compiler_depend.ts'
14:51:35.376 DEBUG Cache entry created for key 'js:filemetadata:10.20.0.29356:evidentvascular_evi-shared-libs:CMakeFiles/Nightly.dir/compiler_depend.ts'
14:51:35.376 DEBUG Cache strategy set to 'WRITE_ONLY' for file 'eviCommon/version/tests/CMakeFiles/evi_version_test.dir/compiler_depend.ts' as current analysis requires all files to be analyzed

Which ones did you set, and where? A sonar-project.properties file? Command line arguments? Something else?