0

Coverage: Don't show totals entry for component view.

A path can belong to multiple components, so totals entry shows
incorrect value.

R=mmoroz@chromium.org,liaoyuke@chromium.org

Bug: 842760
Change-Id: Ibbae86ed31a9d330ed02a6e7a24a5211634b2fc5
Reviewed-on: https://chromium-review.googlesource.com/1058167
Reviewed-by: Max Moroz <mmoroz@chromium.org>
Commit-Queue: Abhishek Arya <inferno@chromium.org>
Cr-Commit-Position: refs/heads/master@{#558437}
This commit is contained in:
Abhishek Arya
2018-05-14 20:19:48 +00:00
committed by Commit Bot
parent 9caad94d3c
commit efbe1df199
2 changed files with 18 additions and 18 deletions
tools/code_coverage
coverage.py
html_templates

@@ -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.')

@@ -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>