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) component_view_index_file_path)
html_generator = _CoverageReportHtmlGenerator(component_view_index_file_path, html_generator = _CoverageReportHtmlGenerator(component_view_index_file_path,
'Component') 'Component')
totals_coverage_summary = _CoverageSummary()
for component in per_component_coverage_summary: for component in per_component_coverage_summary:
totals_coverage_summary.AddSummary(
per_component_coverage_summary[component])
html_generator.AddLinkToAnotherReport( html_generator.AddLinkToAnotherReport(
_GetCoverageHtmlReportPathForComponent(component), component, _GetCoverageHtmlReportPathForComponent(component), component,
per_component_coverage_summary[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) html_generator.WriteHtmlCoverageReport(no_file_view)
logging.debug('Finished generating component view html index file.') logging.debug('Finished generating component view html index file.')

@@ -31,16 +31,18 @@
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
<tfoot> {% if total_entry %}
<tr class="light-row-bold"> <tfoot>
<td> <tr class="light-row-bold">
<pre>Totals</pre> <td>
</td> <pre>Totals</pre>
{% for feature in ("lines", "functions", "regions") %} </td>
<td class='column-entry-{{ total_entry[feature]["color_class"] }}'> {% for feature in ("lines", "functions", "regions") %}
<pre>{{ total_entry[feature]["percentage"] }}% ({{ total_entry[feature]["covered"] }}/{{ total_entry[feature]["total"] }})</pre> <td class='column-entry-{{ total_entry[feature]["color_class"] }}'>
</td> <pre>{{ total_entry[feature]["percentage"] }}% ({{ total_entry[feature]["covered"] }}/{{ total_entry[feature]["total"] }})</pre>
{% endfor %} </td>
</tr> {% endfor %}
</tfoot> </tr>
</tfoot>
{% endif %}
</table> </table>