Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-76221

Coverage parser gives wrong results if line numbers are not unique

XMLWordPrintable

      Gcovr Cobertura XML schema may contain multiple lines with same line number for templated code like in the following example. In this case, coverage plugin parser gives wrong line coverage and branch coverage results from only one of the line objects.

      \<class name="foobar.cc" filename="path/to/foobar.cc" line-rate="0.7244729344729344" branch-rate="0.5619730941704036" complexity="0.0">
          \<methods/>
              // There is lines for each type variant
          \</methods>
          \<lines>
              ...
              \<line number="81" hits="0" branch="false"/>
              \<line number="81" hits="14" branch="false"/>
              \<line number="81" hits="0" branch="false"/>
              \<line number="82" hits="28" branch="true" condition-coverage="50% (2/4)">
                  \<conditions>
                      \<condition number="0" type="jump" coverage="50%"/>
                  \</conditions>
              \</line>
              \<line number="82" hits="34" branch="true" condition-coverage="25% (1/4)">
                  \<conditions>
                      \<condition number="0" type="jump" coverage="25%"/>
                  \</conditions>
              \</line>
              \<line number="82" hits="20" branch="true" condition-coverage="50% (2/4)">
                  \<conditions>
                      \<condition number="0" type="jump" coverage="50%"/>
                  \</conditions>
              \</line>
              ...
          \</lines>
      \</class&gt; 

      There is a workaround for this to use option '--merge-lines' with gcovr.

      Gitter message: https://matrix.to/#/!GriGOxVIKpmCHcWrag:gitter.im/$TC9riRiWsCX-aC1NAWP2dhbr3FD1e2CXPEX32RHq8Uw?via=gitter.im&via=matrix.org 

            Unassigned Unassigned
            ossikankainen Ossi
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: