Sonar-wrapper makes some UT fail

Template for a good bug report, formatted with Markdown:

  • Sonarqube 8.1.0.31237 Build-wrapper
  • error observed (wrap logs/code around triple quote ``` for proper formatting)
    Some unittests fails on c++ build (cmake, executed through dpkg-buildpackage)
        Start 157: ClientOrderID.Text10WithPrefix4WithSeparatorBigEndianInvalid
157/920 Test #157: ClientOrderID.Text10WithPrefix4WithSeparatorBigEndianInvalid ........................................   Passed    0.00 sec
        Start 158: ClientServerTests.General
158/920 Test #158: ClientServerTests.General ...........................................................................***Failed    0.01 sec
build-wrapper: selfpath: Invalid argument

        Start 159: SessionTests.ClientSession_Basic
159/920 Test #159: SessionTests.ClientSession_Basic ....................................................................***Failed    0.01 sec
build-wrapper: selfpath: Invalid argument```
I wrap it like this:

build-wrapper-linux-x86-64 --out-dir obj-x86_64-linux-gnu dpkg-buildpackage -uc -b -j8

* Hard to describe as our buildpipeline is kind of complex, however if unwrapped it passes all 903 tests, but once wrapped only 203 are successful. 
* Not doing a scan would work around it but we would love to have c++ coverage :slight_smile: 

P.S.: use the #bug:fault sub-category if you're hitting a specific crash/error , or the #bug:fp sub-category for rules-related behaviour

Has anyone seen an error like this before? I have brought down -j8 to -j2 just to ensure it's not starved out of cores during testing, but with same results.

Hi @Jonasandersson,

it’s strange that build-wrapper is interfering with your unit tests.

You could try to wrap with the build-wrapper the build part only and run the tests in a second step without build-wrapper.

Hi Massimo,

Thanks for your fast reply, appreciate it. What strikes me as odd is that 1/3 of them make it fine, while 2/3 don’t.
I will do my best to separate them and let you know how that goes.

Kind regards

Jonas

Hi @Jonasandersson,

thank you for your update, I hope you manage to fix your issue.

Hi Massimo,

I am happy to tell you i managed to get the c++ coverage working, and it already returning useful results. The only thing we are missing now is getting sonar to return the results to Bamboo. When we sonar analysis on Maven project, as soon as the results are proceeded we see these results in the main build screen in bamboo, but for some reason we don’t get that when doing c++ builds (with sonar-scanner and sonar-wrapper). We use Version 8.1.0.31237 (enterprise) on for our c++ builds. I tried adding a webhook back to bitbucket, but i still don’t see any results pushed back. Results are all available in the sonarqube interface. Not sure where to start looking?

kind regards

Jonas

Hi @Jonasandersson,

What do you mean with “sonar to return the results to Bamboo”? What results are you talking about?

Hi Massimo,

For Java we have a bamboo integration of sonar, so once a build is completed, sonar analysis are made, these sonar-results are pushed back to Bamboo, and are left in the summary of bamboo in a frame called “Sonar analysis results”. This overview contains the porject name:branch and the quality gates passed. This is true for all Java builds, however when we do coverage test using sonar-scanner and sonar-wrapper in the build log we see links to the sonar tests in the build log, but we don’t get the results pushed back to the “Sonar analysis results” in the green build summary, in fact, that frame is not visable in the bamboo summery.
Ps we use sonar 4 bamboo plugin Version: 2.7.3

Thanks in advance

Jonas

Hi @Jonasandersson,

I would invite you to refer to Sonar for Bamboo support channel to see if you should expect to see C++ analysis result too, this is something which is not related to our products.