C++ scanner-cli ERROR: GO Coverage report can't be loaded

SonarQube Enterprise 9.9.1.69595
build-wrapper-win-x86.zip
sonar-scanner-cli-5.0.1.3006-windows.zip

I am attempting to build a C++/C# sln using build-wrapper and scan the C++ using sonar-scanner-cli.

During the scan I am seeing an error:


12:19:32.031 INFO: Sensor Go Cover sensor for Go coverage [go]
.sonar\sonar-scanner-5.0.1.3006-windows\bin\sonar-scanner.bat : 12:19:32.032 ERROR: Coverage report can’t be loaded, report file not found, ignoring this file go-coverage.out.
At line:1 char:34

  • … e “true”) { .sonar\sonar-scanner-5.0.1.3006-windows\bin\sonar-scanner …
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (12:19:32.032 ER…o-coverage.out.:String) , RemoteException
    • FullyQualifiedErrorId : NativeCommandError

12:19:32.033 INFO: Sensor Go Cover sensor for Go coverage [go] (done) | time=3ms
12:19:32.033 INFO: Sensor JaCoCo XML Report Importer [jacoco]
12:19:32.034 INFO: ‘sonar.coverage.jacoco.xmlReportPaths’ is not defined. Using d

12:19:55.654 DEBUG: Post-jobs :
12:19:55.718 INFO: Analysis total time: 1:09.776 s
12:19:55.735 INFO: ------------------------------------------------------------------------
12:19:55.737 INFO: EXECUTION SUCCESS
12:19:55.737 INFO: ------------------------------------------------------------------------
12:19:55.737 INFO: Total time: 1:24.684s
12:19:55.896 INFO: Final Memory: 54M/180M
12:19:55.903 INFO: ------------------------------------------------------------------------
Command executed with exception: 12:19:32.032 ERROR: Coverage report can’t be loaded, report file not found, ignoring this file go-coverage.out.

Any help in eliminating the error would be much appreciated.

Hi,

Welcome to the community!

Can you provide the full analysis log?

That At line:1… portion of the log is not what I expect to see after an INFO line letting you know that a coverage report wasn’t loaded. I suspect your analysis is running multi-threaded and different threads were appending / interlacing at the same time.

 
Thx,
Ann

Hi Ann,

Thank you for your reply. I have attached the log as requested. Thanks in advance.
sonarscanner_cli_debug_ouput_noexclusions_trimmed_redacted1.txt (5.9 MB)

Brandon

I have limited threading to 1 thread and the problem persists.

sonar-project.properties:

sonar.projectKey=com.my.project
sonar.projectVersion=1.0
sonar.sources=.
sonar.cfamily.build-wrapper-output=bw-output
sonar.cfamily.threads=1
sonar.host.url=https://myserver.com


09:34:58.174 DEBUG: ‘Source/UtilityLibs/audio-resource-controller/src/audioResourceController/MrcUtils/MrcUtils/GeneratedCode/CallMap.h’ generated metadata with charset ‘windows-1252’
.sonar\sonar-scanner-5.0.1.3006-windows\bin\sonar-scanner.bat : 09:34:58.517 ERROR: Coverage report can’t be loaded, report file not found, ignoring this file go-coverage.out.
At line:1 char:34

  • … e “true”) { .sonar\sonar-scanner-5.0.1.3006-windows\bin\sonar-scanner …
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (09:34:58.517 ER…o-coverage.out.:String) , RemoteException
    • FullyQualifiedErrorId : NativeCommandError

09:34:58.174 DEBUG: ‘Source/UtilityLibs/audio-resource-controller/src/Tests/ProviderESNUnitTests/RestAudioActionsUnitTests.cs’ generated metadata with charset ‘UTF-8’

09:34:59.319 INFO: Sensor AWS SAM Inline template file sensor [security] (done) | time=32ms

09:34:59.319 INFO: Sensor CFamily [cpp]

09:34:59.384 INFO: CFamily plugin version: 6.41.0.60884

09:34:59.386 INFO: Using build-wrapper output: C:\projects\audio-server\bw-output\build-wrapper-dump.json

09:34:59.387 INFO: Available processors: 2

09:34:59.388 INFO: Using 1 thread for analysis, according to value of “sonar.cfamily.threads” property.

09:34:59.453 DEBUG: Total system memory: 6290399232

09:34:59.453 DEBUG: Unpacking analyzer to: C:\projects\audio-server.scannerwork.sonartmp\14001519706777471359

09:35:02.606 DEBUG: Not enough content in ‘Source/Rtp/RTPLineManager/audioGatewayTestHarnesses/DynamicJitterBufferTester/stdafx.cpp’ to have CPD blocks, it will not be part of the duplication detection

10:01:39.230 DEBUG: Upload report
10:01:39.714 DEBUG: POST 200 https://my.server.com/api/ce/submit?projectKey=com.my.project&characteristic=pullRequest%3D1427 | time=484ms
10:01:39.720 INFO: Analysis report uploaded in 487ms
10:01:39.728 DEBUG: Report metadata written to C:\projects\media-server.scannerwork\report-task.txt
10:01:39.728 INFO: ANALYSIS SUCCESSFUL, you can find the results at: https://my.server.com/dashboard?id=com.my.project&pullRequest=1427
10:01:39.728 INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
10:01:39.729 INFO: More about the report processing at https://my.server.com/api/ce/task?id=AY8qlyUaBKeI4t_jCYFt
10:01:39.768 DEBUG: Post-jobs :
10:01:39.910 INFO: Analysis total time: 29:38.663 s
10:01:39.924 INFO: ------------------------------------------------------------------------
10:01:39.925 INFO: EXECUTION SUCCESS
10:01:39.925 INFO: ------------------------------------------------------------------------
10:01:39.925 INFO: Total time: 29:55.127s
10:01:40.090 INFO: Final Memory: 63M/214M
10:01:40.091 INFO: ------------------------------------------------------------------------
Command executed with exception: 09:34:58.517 ERROR: Coverage report can’t be loaded, report file not found, ignoring this file go-coverage.out.

Hi,

Thanks for the log. I’ve flagged this for more expert eyes.

 
Ann

1 Like

Hello @scannerUt24,

Thanks for reporting the issue.

Could you please clarify what is exactly the issue (apart from the error in the logs)? Specifically:

  • Can you access the analysis results in SQ?
  • Do you actually have any code coverage reports for Go? If yes, are they imported?
  • Have you run the tests and generated coverage reports for Go before analysis?
  • Could you please share the content of your sonar.properties file with me?

Best,
Margarita

Hello Margarita,

Primarily the problem is sonar-scanner.bat execution fails when it encounters the Go code coverage error failing the pipeline run. This appeared suddenly with no recognized cause and consequently we disabled the scan and just recently started to investigate.

The pipeline has 2 scan versions for different commit types.
Branch commit:

sonar-scanner.bat -X -D"project.settings=$env:BUILD_FOLDER\sonar-project.properties" -D"sonar.branch.name=$env:REPO_BRANCH_Name"

Pull Request commits

sonar-scanner.bat -X -D"project.settings=$env:BUILD_FOLDER\sonar-project.properties" -D"sonar.pullrequest.key=$env:PULL_REQUEST_NUMBER" -D"sonar.pullrequest.branch=$env:PULL_REQUEST_HEAD_REPO_BRANCH" -D"sonar.pullrequest.base=$env:REPO_BRANCH"

Can you access the analysis results in SQ?

I believe things are working as expected. Apologies for my ignorance. Is it correct that PR scans only report on new code and new issues? That appears to be the case

Do you actually have any code coverage reports for Go? If yes, are they imported?
Have you run the tests and generated coverage reports for Go before analysis?

I will lump the answer to both of these questions together. There are no Go files.
No tests are being run prior to the scan. Code Coverage for this pipeline is a goal for the future.

Could you please share the content of your sonar.properties file with me?

sonar.projectKey=com.my.project
sonar.projectVersion=1.0
sonar.sources=.
sonar.cfamily.build-wrapper-output=bw-output
sonar.sourceEncoding=UTF-8
sonar.host.url=https://my.server.com
sonar.exclusions=**/MSIntegratedTester/**,**/*.wav,**/.sonar/**,**/obj/**,**/BridgeManager_rpy/*,**/media-resource-controller/**,**/SipP/**,**/pkt/**,**/*.exp,**/*.lnk,**/*.bsc,**/OutputRelease/**/*.h,**/*.msi

Thanks for your answers.

So it’s strange that the Go Coverage Sensor is executed because it should only be triggered if the sonar.go.coverage.reportPaths property is specified. So, I suggest you set this property in the configuration manually and leave its value empty.

In order to investigate it further I will need a reproducer. So, if you can come up with a small example where this problem occurs, I will be able to understand what causes the go coverage sensor to be triggered.

Best,
Margarita

Unsetting the sonar.go.coverage.reportPaths appears to have resolved the problem!

sonar.projectKey=com.my.project
sonar.projectVersion=1.0
sonar.sources=.
sonar.cfamily.build-wrapper-output=bw-output
sonar.sourceEncoding=UTF-8
sonar.host.url=https://my.server.com
sonar.exclusions=**/MSIntegratedTester/**,**/*.wav,**/.sonar/**,**/obj/**,**/BridgeManager_rpy/*,**/media-resource-controller/**,**/SipP/**,**/pkt/**,**/*.exp,**/*.lnk,**/*.bsc,**/OutputRelease/**/*.h,**/*.msi
sonar.go.coverage.reportPaths=

Thank you!!

Brandon

1 Like