[SOLVED] ...Publish Ozone code coverage report on Jenkins

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [SOLVED] ...Publish Ozone code coverage report on Jenkins

    Hello all,

    This post belongs to the closed topic:
    forum.segger.com/index.php/Thr…verage-report-on-Jenkins/

    We currently have the same problem to get the Ozone code coverage output in shape for jenkins usage. In my opinion the topic was closed without solving the problem .

    Does Anybody have a solution to convert such a code coverage txt outputfile like this...:

    Brainfuck Source Code

    1. Ozone Code Profile Report
    2. Project: Start\SEGGER_CortexM_Trace_Reference_Board.jdebug
    3. Application: Start/Output/Debug NoOS NoSystemInit/SEGGER Cortex-M Trace Reference Board.elf
    4. Code Coverage Summary
    5. Module/Function | Source Lines | Instructions
    6. ------------------+-------------------------------------+-------------------------------------
    7. BSP.c | |
    8. BSP_Init | 9 / 9 100.0% | 93 / 93 100.0%
    9. BSP_SetLED | 3 / 4 75.0% | 25 / 27 92.6%
    10. BSP_ToggleLED | 5 / 6 83.3% | 56 / 58 96.6%
    11. TraceDemo.c | |
    12. _TestFunc0 | 5 / 6 83.3% | 18 / 19 94.7%
    13. _TestFunc0a | 3 / 3 100.0% | 11 / 11 100.0%
    14. _TestFunc0b | 3 / 3 100.0% | 9 / 9 100.0%
    15. _TestFunc1 | 4 / 5 80.0% | 19 / 20 95.0%
    16. _TestFunc2 | 5 / 5 100.0% | 18 / 18 100.0%
    17. main | 10 / 11 90.9% | 44 / 45 97.8%
    18. ------------------+-------------------------------------+-------------------------------------
    19. Total | 47 / 52 90.4% | 293 / 300 97.7%
    Display All
    ...in a cobertura xml.


    For example.... this is how a proper Cobertura xml file looks like:

    XML Source Code

    1. <?xml version="1.0"?>
    2. <!--DOCTYPE coverage SYSTEM "http://cobertura.sourceforge.net/xml/coverage-03.dtd"-->
    3. <coverage line-rate="0.9" branch-rate="0.75" version="1.9" timestamp="1187350905008">
    4. <sources>
    5. <source>C:/local/mvn-coverage-example/src/main/java</source>
    6. <source>--source</source>
    7. </sources>
    8. <packages>
    9. <package name="" line-rate="1.0" branch-rate="1.0" complexity="1.0">
    10. <classes>
    11. <class name="Main" filename="Main.java" line-rate="1.0" branch-rate="1.0" complexity="1.0">
    12. <methods>
    13. <method name="<init>" signature="()V" line-rate="1.0" branch-rate="1.0">
    14. <lines>
    15. <line number="10" hits="3" branch="false"/>
    16. </lines>
    17. </method>
    18. <method name="doSearch" signature="()V" line-rate="1.0" branch-rate="1.0">
    19. <lines>
    20. <line number="23" hits="3" branch="false"/>
    21. <line number="25" hits="3" branch="false"/>
    22. <line number="26" hits="3" branch="false"/>
    23. <line number="28" hits="3" branch="false"/>
    24. <line number="29" hits="3" branch="false"/>
    25. <line number="30" hits="3" branch="false"/>
    26. </lines>
    27. </method>
    28. <method name="main" signature="([Ljava/lang/String;)V" line-rate="1.0" branch-rate="1.0">
    29. <lines>
    30. <line number="16" hits="3" branch="false"/>
    31. <line number="17" hits="3" branch="false"/>
    32. <line number="18" hits="3" branch="false"/>
    33. <line number="19" hits="3" branch="false"/>
    34. </lines>
    35. </method>
    36. </methods>
    37. <lines>
    38. <line number="10" hits="3" branch="false"/>
    39. <line number="16" hits="3" branch="false"/>
    40. <line number="17" hits="3" branch="false"/>
    41. <line number="18" hits="3" branch="false"/>
    42. <line number="19" hits="3" branch="false"/>
    43. <line number="23" hits="3" branch="false"/>
    44. <line number="25" hits="3" branch="false"/>
    45. <line number="26" hits="3" branch="false"/>
    46. <line number="28" hits="3" branch="false"/>
    47. <line number="29" hits="3" branch="false"/>
    48. <line number="30" hits="3" branch="false"/>
    49. </lines>
    50. </class>
    51. </classes>
    52. </package>
    53. <package name="search" line-rate="0.8421052631578947" branch-rate="0.75" complexity="3.25">
    54. <classes>
    55. <class name="search.BinarySearch" filename="search/BinarySearch.java" line-rate="0.9166666666666666" branch-rate="0.8333333333333334" complexity="3.0">
    56. <methods>
    57. <method name="<init>" signature="()V" line-rate="1.0" branch-rate="1.0">
    58. <lines>
    59. <line number="12" hits="3" branch="false"/>
    60. </lines>
    61. </method>
    62. <method name="find" signature="([II)I" line-rate="0.9090909090909091" branch-rate="0.8333333333333334">
    63. <lines>
    64. <line number="16" hits="3" branch="false"/>
    65. <line number="18" hits="12" branch="true" condition-coverage="100% (2/2)">
    66. <conditions>
    67. <condition number="0" type="jump" coverage="100%"/>
    68. </conditions>
    69. </line>
    70. <line number="20" hits="9" branch="false"/>
    71. <line number="21" hits="9" branch="false"/>
    72. <line number="23" hits="9" branch="true" condition-coverage="50% (1/2)">
    73. <conditions>
    74. <condition number="0" type="jump" coverage="50%"/>
    75. </conditions>
    76. </line>
    77. <line number="24" hits="0" branch="false"/>
    78. <line number="25" hits="9" branch="true" condition-coverage="100% (2/2)">
    79. <conditions>
    80. <condition number="0" type="jump" coverage="100%"/>
    81. </conditions>
    82. </line>
    83. <line number="26" hits="6" branch="false"/>
    84. <line number="28" hits="3" branch="false"/>
    85. <line number="29" hits="9" branch="false"/>
    86. <line number="31" hits="3" branch="false"/>
    87. </lines>
    88. </method>
    89. </methods>
    90. <lines>
    91. <line number="12" hits="3" branch="false"/>
    92. <line number="16" hits="3" branch="false"/>
    93. <line number="18" hits="12" branch="true" condition-coverage="100% (2/2)">
    94. <conditions>
    95. <condition number="0" type="jump" coverage="100%"/>
    96. </conditions>
    97. </line>
    98. <line number="20" hits="9" branch="false"/>
    99. <line number="21" hits="9" branch="false"/>
    100. <line number="23" hits="9" branch="true" condition-coverage="50% (1/2)">
    101. <conditions>
    102. <condition number="0" type="jump" coverage="50%"/>
    103. </conditions>
    104. </line>
    105. <line number="24" hits="0" branch="false"/>
    106. <line number="25" hits="9" branch="true" condition-coverage="100% (2/2)">
    107. <conditions>
    108. <condition number="0" type="jump" coverage="100%"/>
    109. </conditions>
    110. </line>
    111. <line number="26" hits="6" branch="false"/>
    112. <line number="28" hits="3" branch="false"/>
    113. <line number="29" hits="9" branch="false"/>
    114. <line number="31" hits="3" branch="false"/>
    115. </lines>
    116. </class>
    117. <class name="search.ISortedArraySearch" filename="search/ISortedArraySearch.java" line-rate="1.0" branch-rate="1.0" complexity="1.0">
    118. <methods>
    119. </methods>
    120. <lines>
    121. </lines>
    122. </class>
    123. <class name="search.LinearSearch" filename="search/LinearSearch.java" line-rate="0.7142857142857143" branch-rate="0.6666666666666666" complexity="6.0">
    124. <methods>
    125. <method name="<init>" signature="()V" line-rate="1.0" branch-rate="1.0">
    126. <lines>
    127. <line number="9" hits="3" branch="false"/>
    128. </lines>
    129. </method>
    130. <method name="find" signature="([II)I" line-rate="0.6666666666666666" branch-rate="0.6666666666666666">
    131. <lines>
    132. <line number="13" hits="9" branch="true" condition-coverage="50% (1/2)">
    133. <conditions>
    134. <condition number="0" type="jump" coverage="50%"/>
    135. </conditions>
    136. </line>
    137. <line number="15" hits="9" branch="true" condition-coverage="100% (2/2)">
    138. <conditions>
    139. <condition number="0" type="jump" coverage="100%"/>
    140. </conditions>
    141. </line>
    142. <line number="16" hits="3" branch="false"/>
    143. <line number="17" hits="6" branch="true" condition-coverage="50% (1/2)">
    144. <conditions>
    145. <condition number="0" type="jump" coverage="50%"/>
    146. </conditions>
    147. </line>
    148. <line number="19" hits="0" branch="false"/>
    149. <line number="24" hits="0" branch="false"/>
    150. </lines>
    151. </method>
    152. </methods>
    153. <lines>
    154. <line number="9" hits="3" branch="false"/>
    155. <line number="13" hits="9" branch="true" condition-coverage="50% (1/2)">
    156. <conditions>
    157. <condition number="0" type="jump" coverage="50%"/>
    158. </conditions>
    159. </line>
    160. <line number="15" hits="9" branch="true" condition-coverage="100% (2/2)">
    161. <conditions>
    162. <condition number="0" type="jump" coverage="100%"/>
    163. </conditions>
    164. </line>
    165. <line number="16" hits="3" branch="false"/>
    166. <line number="17" hits="6" branch="true" condition-coverage="50% (1/2)">
    167. <conditions>
    168. <condition number="0" type="jump" coverage="50%"/>
    169. </conditions>
    170. </line>
    171. <line number="19" hits="0" branch="false"/>
    172. <line number="24" hits="0" branch="false"/>
    173. </lines>
    174. </class>
    175. </classes>
    176. </package>
    177. </packages>
    178. </coverage>
    Display All
    Greetings
    Joe
  • Hello,

    Thank you for your inquiry.

    Joe_RuS wrote:

    Does Anybody have a solution to convert such a code coverage txt outputfile like this...:
    We currently do not support exporting trace reports in third party software specific output formats nor is it planned to add it.
    Currently supported is .csv and .txt as file type in the formatting as you quoted in your post.
    The easiest way would be to write your own converter that fits your specific needs.
    Alternatively we suggest contacting Cobertura or Jenkins team if they are looking to write a converter for Ozone code coverage output.

    Best regards,
    Nino
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.