Coverage: Don't show totals entry for component view.
A path can belong to multiple components, so totals entry shows
incorrect value.
[email protected],[email protected]
Bug: 842760
Change-Id: Ibbae86ed31a9d330ed02a6e7a24a5211634b2fc5
Reviewed-on: https://chromium-review.googlesource.com/1058167
Reviewed-by: Max Moroz <[email protected]>
Commit-Queue: Abhishek Arya <[email protected]>
Cr-Commit-Position: refs/heads/master@{#558437}
diff --git a/tools/code_coverage/coverage.py b/tools/code_coverage/coverage.py
index 4f73bd27..7f45542 100755
--- a/tools/code_coverage/coverage.py
+++ b/tools/code_coverage/coverage.py
@@ -742,17 +742,15 @@
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 28f88952..63cca09 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