Code Coverage is showing 0% in sonar cloud

Hello team,
I would like to reach out to community regarding the sonar scan analysis for Carma-Platform (https://sonarcloud.io/summary/new_code?id=usdot-fhwa-stol_CARMAPlatform) Coverage reports are not reflecting and shows 0% on sonar cloud

Please find more details of the Project and Repository.

GitHub repository URL: GitHub - usdot-fhwa-stol/carma-platform: CARMA Platform is built on robot operating system (ROS) and utilizes open source software (OSS) that enables Cooperative Driving Automation (CDA) features to allow Automated Driving Systems to interact and cooperate with infrastructure and other vehicles through communication.

Sonar scan properties : carma-platform/sonar-scanner.properties at develop · usdot-fhwa-stol/carma-platform · GitHub

Circle CI build URL: https://app.circleci.com/pipelines/github/usdot-fhwa-stol/carma-platform/6518/workflows/5e107a07-150a-46
Output log:
Sonarcloud platfomr output.txt (139.3 KB)
ca-a358-1b0ea3152d4d/jobs/6713

Could you please let me know how to resolve this issue and what we are missing ? Thanks in advance!

Hello @SaikrishnaBairamoni,
Judging by the SonarCloud logs you’ve attached, the coverage_reports/gcov folder contains no coverage reports for the project files. It contains only reports for two files used by CMake to detect C and C++ compiler features:

INFO: Sensor gcov [cpp]
INFO: Parsing /opt/carma/coverage_reports/gcov/CMakeCCompilerId.c.gcov
WARN: File not analysed by Sonar, so ignoring coverage: /opt/carma/src/CARMAPlatform/stop_controlled_intersection_tactical_plugin/CMakeCCompilerId.c
INFO: Parsing /opt/carma/coverage_reports/gcov/CMakeCXXCompilerId.cpp.gcov
WARN: File not analysed by Sonar, so ignoring coverage: /opt/carma/src/CARMAPlatform/stop_controlled_intersection_tactical_plugin/CMakeCXXCompilerId.cpp
INFO: Sensor gcov [cpp] (done) | time=4ms

Unfortunately, CARMA requires quite an elaborate setup to build and run tests, so I’ll have to rely on you for this. For instance, I failed to find the make_with_coverage.bash file that is invoked in your circleCI script.

Can you make sure that the folder indeed contains the coverage reports? For example, are you running the tests before invoking the Sonar scanner? Perhaps you could list the contents of the directory in your build script right before the scanner runs?

Hello Arseniy,

Thank you for the response!

Here is the file coverage.bash scripts in our base repository (carma-base/code_coverage at develop · usdot-fhwa-stol/carma-base · GitHub).

we are running the build and tests before the sonar scanner here is the link to one of our latest build (https://app.circleci.com/pipelines/github/usdot-fhwa-stol/carma-platform/6571/workflows/5eab730b-21bf-4a7b-bc65-7d1a6668cabd/jobs/6767)

Please advise me if we are missing anything.

Thanks!
Saikrishna.

I see. The logs show that our sensor fails to find the coverage reports in the folder. Can you list the files in that folder to make sure the reports are there?

Something like ls -lha "${output_dir}" right before running the sensor. E.g.: this and this

I have listed out the coverage reports folder after the tests are finished and I see couple of gcov files as below:
drwxr-xr-x 2 carma carma 72 Mar 7 18:48 .
drwxr-xr-x 3 carma carma 18 Mar 7 18:12 …
-rw-r–r-- 1 carma carma 199 Mar 7 18:48 CMakeCCompilerId.c.gcov
-rw-r–r-- 1 carma carma 209 Mar 7 18:48 CMakeCXXCompilerId.cpp.gcov

Here is the link to the build for my changes: https://app.circleci.com/pipelines/github/usdot-fhwa-stol/carma-platform/6588/workflows/348ecd85-3b34-408a-ab3f-e259b383e8e7/jobs/6784

Here is the Config file on my branch: carma-platform/config.yml at fix/sonar_cloud · usdot-fhwa-stol/carma-platform · GitHub

As you can see, the folder contains only two reports for irrelevant files (I believe these are small files CMake uses to test the supported C and C++ compiler features). No report is available for the source files of your project. The issue is likely in the collect_gcovr.bash script, you can check whether it has access to coverage reports and whether it puts them into the right place. Please let me know if you find the issue or if you experience any difficulty debugging it.

Hi Arseniy,

I have informed to developers to take a look at gcov bash scripts. I will let you know if we get any issues. Thanks!

I have other ticket created long back and waiting for solution this is for another project regarding the coverage reports, Could you please go through the thread and help me on this. Here is the link to that ticket (Coverage reports is not generating after sonar scan analysis)

Thank you,
Saikrishna.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.