diff --git a/tools/code_coverage/coverage.py b/tools/code_coverage/coverage.py index 4f73bd27e927e..7f45542a1911b 100755 --- a/tools/code_coverage/coverage.py +++ b/tools/code_coverage/coverage.py @@ -742,17 +742,15 @@ def _GenerateComponentViewHtmlIndexFile(per_component_coverage_summary, component_view_index_file_path) html_generator = _CoverageReportHtmlGenerator(component_view_index_file_path, 'Component') - totals_coverage_summary = _CoverageSummary() - for component in per_component_coverage_summary: - totals_coverage_summary.AddSummary( - per_component_coverage_summary[component]) - html_generator.AddLinkToAnotherReport( _GetCoverageHtmlReportPathForComponent(component), component, per_component_coverage_summary[component]) - html_generator.CreateTotalsEntry(totals_coverage_summary) + # Do not create a totals row for the component view as the value is incorrect + # due to failure to account for UNKNOWN component and some paths belonging to + # multiple components. + html_generator.WriteHtmlCoverageReport(no_file_view) logging.debug('Finished generating component view html index file.') diff --git a/tools/code_coverage/html_templates/table.html b/tools/code_coverage/html_templates/table.html index 28f88952614ab..63cca09ead963 100644 --- a/tools/code_coverage/html_templates/table.html +++ b/tools/code_coverage/html_templates/table.html @@ -31,16 +31,18 @@ </tr> {% endfor %} </tbody> - <tfoot> - <tr class="light-row-bold"> - <td> - <pre>Totals</pre> - </td> - {% for feature in ("lines", "functions", "regions") %} - <td class='column-entry-{{ total_entry[feature]["color_class"] }}'> - <pre>{{ total_entry[feature]["percentage"] }}% ({{ total_entry[feature]["covered"] }}/{{ total_entry[feature]["total"] }})</pre> - </td> - {% endfor %} - </tr> - </tfoot> + {% if total_entry %} + <tfoot> + <tr class="light-row-bold"> + <td> + <pre>Totals</pre> + </td> + {% for feature in ("lines", "functions", "regions") %} + <td class='column-entry-{{ total_entry[feature]["color_class"] }}'> + <pre>{{ total_entry[feature]["percentage"] }}% ({{ total_entry[feature]["covered"] }}/{{ total_entry[feature]["total"] }})</pre> + </td> + {% endfor %} + </tr> + </tfoot> + {% endif %} </table> \ No newline at end of file