- ALM used: GitHub
- CI system used: GitHub
- Scanner command used when applicable
sonar-scanner -X -Dsonar.cfamily.threads=4 -Dsonar.cfamily.build-wrapper-output=build_wrapper_output_directory -Dsonar.login=${{ secrets.SONAR_TOKEN }}" - Languages of the repository
Cfamily - This concerns a private sonarcloud project
- Error observed:
I am facing a problem with generating a coverage report for our cfamily repository. I am building the job with build-wrapper - which seems to work for static analysis of the project.
Anyway when sonar-scanner is accessing the coverage files generated by ceedling utils:gcov - gcovr is generating three coverage.xmls, one for each sub-project with following command, docker image is used to trigger all these commands.
ceedling utils:gcov
Link to ceedling gcovr tool guide: https://github.com/ThrowTheSwitch/Ceedling/blob/master/plugins/gcov/README.md
I am facing a following error for some reason - source files not are not found.
Project is configured so that there is a main project (git repository) and underneath few sub-projects, sub-project folders are having their own unittests -folders.
021-05-25T13:17:21.5359201Z 13:17:21.535 INFO: Sensor Generic Coverage Report
2021-05-25T13:17:21.5367307Z 13:17:21.536 INFO: Parsing <path1_to_gcovr_results>/coverage.xml
2021-05-25T13:17:21.6502279Z 13:17:21.644 INFO: Imported coverage data for 0 files
2021-05-25T13:17:21.6507125Z 13:17:21.650 INFO: Coverage data ignored for 30 unknown files, including:
2021-05-25T13:17:21.6509655Z <folder1>/file1.c
2021-05-25T13:17:21.6514832Z <folder2>/file2.c
2021-05-25T13:17:21.6521926Z <folder2>/file3.c
2021-05-25T13:17:21.6522499Z <folder2>/<folder2_1>/file4.c
2021-05-25T13:17:21.6523109Z <folder2>/<folder2_1>/file5.c
2021-05-25T13:17:21.6527814Z 13:17:21.652 INFO: Parsing <path2_to_gcovr_results>/coverage.xml
2021-05-25T13:17:21.6831272Z 13:17:21.682 INFO: Imported coverage data for 0 files
2021-05-25T13:17:21.6832730Z 13:17:21.682 INFO: Coverage data ignored for 26 unknown files, including:
2021-05-25T13:17:21.6834270Z <file1>.c
2021-05-25T13:17:21.6834684Z <file2>.c
2021-05-25T13:17:21.6835201Z <file3>.c
2021-05-25T13:17:21.6835551Z <file4>.c
2021-05-25T13:17:21.6836062Z <file5>.c
2021-05-25T13:17:21.6837542Z 13:17:21.682 INFO: Parsing <path3_to_gcovr_results>/coverage.xml
2021-05-25T13:17:21.6893210Z 13:17:21.688 INFO: Imported coverage data for 0 files
2021-05-25T13:17:21.6894058Z 13:17:21.689 INFO: Coverage data ignored for 3 unknown files, including:
2021-05-25T13:17:21.6894815Z <folder1>/<file1>.c
2021-05-25T13:17:21.6896653Z <folder1>/<file2>.c
2021-05-25T13:17:21.6897206Z <folder1>/<file3>.c
2021-05-25T13:17:21.6898884Z 13:17:21.689 INFO: Sensor Generic Coverage Report (done) | time=154ms
My sonar-project.properties file looks as follows:
sonar.projectKey=<hidden>
sonar.organization=<hidden>
sonar.host.url=https://sonarcloud.io
sonar.sources=<comma_separated_source_file_folders>
sonar.tests=common/unittests/,<folder-2>/unittests/,<folder-3>/unittests/
sonar.exclusions=**/Generated_Source/**/*, common/unittests/,<folder-2>/unittests,<folder-3>/unittests/
sonar.test.inclusions=**/unittests/**/*.h,**/unittests/**/*.c
sonar.coverageReportPaths=<path1_to_gcovr_results>/coverage.xml,<path2_to_gcovr_results>/coverage.xml,<path3_to_gcovr_results>/coverage.xml
sonar.sourceEncoding=UTF-8
-
Steps to reproduce:
Create a docker image for cfamily code repository
Build the code by using build-wrapper using docker container
Run unittests ceedling gcov:all for all projects using docker container
Create sonarqube report by running ceedling utils:gcov in docker container
Run sonar-scanner by installing it in the docker container - evaluate coverage page and logs from sonar-scanner. -
Potential workaround:
I have not found a workaround for this so far