Bullseye Coverage: Constants in coverage reports are evaluated as uncovered in SonarQube

  • SonarQube Developer Edition - Version 9.1 (build 47736)
  • Bullseye Version 8.24.0

Bullseye is used by us to measure the coverage on C/C++ code. It marks while (1) - loops as constant, since there’s no condition inside. SonarQube shows this as uncovered line, even if it is covered. Is this a bug in Bullseye or can you provide a fix within SonarQube? I will also contact Bullseye in parallel and keep you updated.

Here is an example of the observed behavior:

<probe line="55" column="6" kind="function" event="full"/>
<probe line="61" kind="constant" event="none"/>
<probe line="65" kind="decision" event="full"/>

image

Hi @colin1993 ,

event="none" means that it was not executed. Could you have a look on your side to understand why that happens?

Hi @mpaladin,

as you see in the screenshot, the line was actually covered (the statements above and below are covered). I sent a request to the Bullseye developers to get some feedback from them as well. I will let you know as soon as I get a reply.

Thanks.

Hi @mpaladin,

By now I got some feedback from the Bullseye developers:

This is an oversight on our part - for kind=“constant”, there ought be no
‘event’. The ‘constant’ value means there is no instrumentation to collect
coverage. This will be fixed in the next release. In the mean time, you
should ignore the ‘event’ in this case.

So it looks like we just need to wait for the next Bullseye release. Thanks for your time!

Hi @colin1993 ,

great, thank you for sharing.

Hi @mpaladin
thanks for reopening this issue. Bullseye provided a new released version, with which the mentioned behavior is fixed and so called constants in the coverage reports do not have any event anymore.

Now, I think the cfamily parser for Bullseye might need some adaption, as it crashes now on finding XML elements without an event, as shown in the attached screenshot.

If you need the coverageReport.xml, I can provide it in a private message.

Hi @colin1993 ,

I sent you a private message.

1 Like

Hi @colin1993 ,

thank you for your report, I created CPP-3386, it is going to be part of the next release, unfortunately, it is too late for SonarQube 9.2, it is going to make it into SonarQube 9.3.

1 Like

Hi @colin1993 ,

FYI, for kind="constant" the line won’t be marked as being hit. Even in the coverage file you provided there are cases where it is not possible to distinguish between being hit or not.

Likely not hit:

<probe line="5" column="4" kind="function" event="none"/>
<probe line="7" kind="constant"/>
<probe line="9" kind="decision" event="none"/>

Likely hit:

<probe line="37" column="4" kind="function" event="full"/>
<probe line="41" kind="constant"/>
<probe line="43" kind="decision" event="full"/>

This report format doesn’t seem to be too powerful. Out of curiosity, why aren’t you using a better coverage tool?

Hi @mpaladin

We want to switch the coverage tool. But at the moment there are quite a few projects using it, so it’ll take time … as usual.

Anyway, thanks for you help!

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