Changeset c1f2c32 in rtems-tools


Ignore:
Timestamp:
Jun 19, 2018, 3:42:03 AM (11 months ago)
Author:
Chris Johns <chrisj@…>
Branches:
master
Children:
845054a
Parents:
e341a65
Message:

tester: Add line feeds to the coverage HTML report.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tester/rt/coverage.py

    re341a65 rc1f2c32  
    103103        self.symbol_sets_list = ['score']
    104104        self.build_dir = build_dir
    105         self.partial_reports_files = list(["index.html", "summary.txt"])
     105        self.partial_reports_files = list(['index.html', 'summary.txt'])
    106106        self.number_of_columns = 1
    107107        self.covoar_src_path = path.join(rtdir, 'covoar')
     
    111111        partial_reports = {}
    112112        for symbol_set in self.symbol_sets_list:
    113             set_summary = summary(path.join(self.build_dir,
    114                                   self.bsp + "-coverage",
    115                                   symbol_set))
     113            set_summary = summary(path.join(self.bsp + "-coverage",
     114                                            symbol_set))
    116115            set_summary.parse()
    117116            partial_reports[symbol_set] = set_summary
     
    119118
    120119    def _prepare_head_section(self):
    121         head_section = '''
    122         <head>
    123         <title>RTEMS coverage report</title>
    124         <style type="text/css">
    125             progress[value] {
    126               -webkit-appearance: none;
    127                appearance: none;
    128 
    129               width: 150px;
    130               height: 15px;
    131             }
    132         </style>
    133         </head>'''
     120        head_section = '<head>' + os.linesep
     121        head_section += ' <title>RTEMS coverage report</title>' + os.linesep
     122        head_section += ' <style type="text/css">' + os.linesep
     123        head_section += '  progress[value] {' + os.linesep
     124        head_section += '    -webkit-appearance: none;' + os.linesep
     125        head_section += '    appearance: none;' + os.linesep
     126        head_section += '    width: 150px;' + os.linesep
     127        head_section += '    height: 15px;' + os.linesep
     128        head_section += '  }' + os.linesep
     129        head_section += ' </style>' + os.linesep
     130        head_section += '</head>' + os.linesep
    134131        return head_section
    135132
    136133    def _prepare_index_content(self, partial_reports):
    137         header = "<h1> RTEMS coverage analysis report </h1>"
    138         header += "<h3>Coverage reports by symbols sets:</h3>"
    139         table = "<table>"
     134        header = "<h1> RTEMS coverage analysis report </h1>" + os.linesep
     135        header += "<h3>Coverage reports by symbols sets:</h3>" + os.linesep
     136        table = "<table>" + os.linesep
    140137        table += self._header_row()
    141138        for symbol_set in partial_reports:
     
    146143
    147144    def _row(self, symbol_set, summary):
    148         row = "<tr>"
    149         row += "<td>" + symbol_set + "</td>"
     145        row = "<tr>" + os.linesep
     146        row += "<td>" + symbol_set + "</td>" + os.linesep
    150147        if summary.is_failure:
    151148            row += ' <td colspan="' + str(self.number_of_columns-1) \
    152             + '" style="background-color:red">FAILURE</td>'
     149                        + '" style="background-color:red">FAILURE</td>' + os.linesep
    153150        else:
    154             row += " <td>" + self._link(summary.index_file_path,"Index") \
    155             + "</td>"
    156             row += " <td>" + self._link(summary.summary_file_path,"Summary") \
    157             + "</td>"
    158             row += " <td>" + summary.bytes_analyzed + "</td>"
    159             row += " <td>" + summary.bytes_not_executed + "</td>"
    160             row += " <td>" + summary.ranges_uncovered + "</td>"
    161             row += " <td>" + summary.percentage_executed + "%</td>"
    162             row += " <td>" + summary.percentage_not_executed + "%</td>"
     151            row += ' <td>' + self._link(summary.index_file_path, 'Index') \
     152                   + '</td>' + os.linesep
     153            row += ' <td>' + self._link(summary.summary_file_path, 'Summary') \
     154                   + '</td>' + os.linesep
     155            row += ' <td>' + summary.bytes_analyzed + '</td>' + os.linesep
     156            row += ' <td>' + summary.bytes_not_executed + '</td>' + os.linesep
     157            row += ' <td>' + summary.ranges_uncovered + '</td>' + os.linesep
     158            row += ' <td>' + summary.percentage_executed + '%</td>' + os.linesep
     159            row += ' <td>' + summary.percentage_not_executed + '%</td>' + os.linesep
    163160            row += ' <td><progress value="' + summary.percentage_executed \
    164             + '" max="100"></progress></td>'
    165             row += " <td>" + summary.branches_uncovered + "</td>"
    166             row += " <td>" + summary.branches_total + "</td>"
    167             row += " <td> {:.3%} </td>".format(summary.percentage_branches_covered)
     161                    + '" max="100"></progress></td>' + os.linesep
     162            row += ' <td>' + summary.branches_uncovered + '</td>' + os.linesep
     163            row += ' <td>' + summary.branches_total + '</td>' + os.linesep
     164            row += ' <td> {:.3%} </td>'.format(summary.percentage_branches_covered)
    168165            spbc = 100 * summary.percentage_branches_covered
    169166            row += ' <td><progress value="{:.3}" max="100"></progress></td>'.format(spbc)
    170             row += "</tr>\n"
     167            row += '</tr>' + os.linesep
    171168        return row
    172169
    173170    def _header_row(self):
    174         row = "<tr>"
    175         row += "<th> Symbols set name </th>"
    176         row += "<th> Index file </th>"
    177         row += "<th> Summary file </th>"
    178         row += "<th> Bytes analyzed </th>"
    179         row += "<th> Bytes not executed </th>"
    180         row += "<th> Uncovered ranges </th>"
    181         row += "<th> Percentage covered </th>"
    182         row += "<th> Percentage uncovered </th>"
    183         row += "<th> Instruction coverage </th>"
    184         row += "<th> Branches uncovered </th>"
    185         row += "<th> Branches total </th>"
    186         row += "<th> Branches covered percentage </th>"
    187         row += "<th> Branches coverage </th>"
    188         row += "</tr>\n"
     171        row = "<tr>" + os.linesep
     172        row += " <th> Symbols set name </th>" + os.linesep
     173        row += " <th> Index file </th>" + os.linesep
     174        row += " <th> Summary file </th>" + os.linesep
     175        row += " <th> Bytes analyzed </th>" + os.linesep
     176        row += " <th> Bytes not executed </th>" + os.linesep
     177        row += " <th> Uncovered ranges </th>" + os.linesep
     178        row += " <th> Percentage covered </th>" + os.linesep
     179        row += " <th> Percentage uncovered </th>" + os.linesep
     180        row += " <th> Instruction coverage </th>" + os.linesep
     181        row += " <th> Branches uncovered </th>" + os.linesep
     182        row += " <th> Branches total </th>" + os.linesep
     183        row += " <th> Branches covered percentage </th>" + os.linesep
     184        row += " <th> Branches coverage </th>" + os.linesep
     185        row += "</tr>"
    189186        self.number_of_columns = row.count('<th>')
    190187        return row
Note: See TracChangeset for help on using the changeset viewer.