mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 18:54:02 +01:00
[llvm-cov] Improvements for summary report generated in HTML format.
Summary: This commit adds the following changes: 1) coverage numbers are aligned to the left and padded with spaces in order to provide better readability for percentage values, e.g.: ``` file1 | 89.13% (123 / 2323) | 100.00% (55 / 55) | 9.33% (14545 / 234234) file_asda | 1.78% ( 23 / 4323) | 32.31% (555 / 6555) | 67.89% (1545 / 2234) fileXXX | 100.00% (12323 / 12323) | 100.00% (555 / 555) | 100.00% (12345 / 12345) ``` 2) added "hover" attribute to CSS for highlighting table row under mouse cursor see screenshot attached to the phabricator review page {F5764813} 3) table title row and "totals" row now use bold text Reviewers: vsk, morehouse Reviewed By: vsk Subscribers: kcc, llvm-commits Differential Revision: https://reviews.llvm.org/D42093 llvm-svn: 323892
This commit is contained in:
parent
ba6797e185
commit
556771566c
@ -11,11 +11,11 @@ FILE-NOT: Unexecuted instantiation
|
||||
|
||||
RUN: FileCheck -check-prefix=INDEX %s -input-file %t.html.dir/index.html
|
||||
|
||||
INDEX: <td class='column-entry-left'>Filename</td>
|
||||
INDEX: <td class='column-entry'>Function Coverage</td>
|
||||
INDEX: <td class='column-entry'>Instantiation Coverage</td>
|
||||
INDEX: <td class='column-entry'>Line Coverage</td>
|
||||
INDEX: <td class='column-entry'>Region Coverage</td>
|
||||
INDEX: <td class='column-entry-bold'>Filename</td>
|
||||
INDEX: <td class='column-entry-bold'>Function Coverage</td>
|
||||
INDEX: <td class='column-entry-bold'>Instantiation Coverage</td>
|
||||
INDEX: <td class='column-entry-bold'>Line Coverage</td>
|
||||
INDEX: <td class='column-entry-bold'>Region Coverage</td>
|
||||
INDEX: <td class='column-entry-red'>
|
||||
INDEX: 50.00% (1/2)
|
||||
INDEX: <td class='column-entry-red'>
|
||||
|
@ -62,10 +62,10 @@ int main() { // TEXT: [[@LINE]]| 161|int main(
|
||||
//
|
||||
// RUN: FileCheck -check-prefix HTML-INDEX -input-file %t.html.dir/index.html %s
|
||||
// HTML-INDEX-LABEL: <table>
|
||||
// HTML-INDEX: <td class='column-entry-left'>Filename</td>
|
||||
// HTML-INDEX: <td class='column-entry'>Function Coverage</td>
|
||||
// HTML-INDEX: <td class='column-entry'>Line Coverage</td>
|
||||
// HTML-INDEX: <td class='column-entry'>Region Coverage</td>
|
||||
// HTML-INDEX: <td class='column-entry-bold'>Filename</td>
|
||||
// HTML-INDEX: <td class='column-entry-bold'>Function Coverage</td>
|
||||
// HTML-INDEX: <td class='column-entry-bold'>Line Coverage</td>
|
||||
// HTML-INDEX: <td class='column-entry-bold'>Region Coverage</td>
|
||||
// HTML-INDEX: <a href='coverage{{.*}}showLineExecutionCounts.cpp.html'{{.*}}showLineExecutionCounts.cpp</a>
|
||||
// HTML-INDEX: <td class='column-entry-green'>
|
||||
// HTML-INDEX: 100.00% (1/1)
|
||||
@ -73,4 +73,5 @@ int main() { // TEXT: [[@LINE]]| 161|int main(
|
||||
// HTML-INDEX: 90.00% (18/20)
|
||||
// HTML-INDEX: <td class='column-entry-red'>
|
||||
// HTML-INDEX: 72.73% (8/11)
|
||||
// HTML-INDEX: TOTALS
|
||||
// HTML-INDEX: <tr class='light-row-bold'>
|
||||
// HTML-INDEX: Totals
|
||||
|
@ -19,15 +19,23 @@ STYLE-DAG: .centered
|
||||
STYLE-DAG: .expansion-view
|
||||
STYLE-DAG: .line-number
|
||||
STYLE-DAG: .light-row
|
||||
STYLE-DAG: .light-row-bold
|
||||
STYLE-DAG: .column-entry
|
||||
STYLE-DAG: .column-entry-left
|
||||
STYLE-DAG: .column-entry-bold
|
||||
STYLE-DAG: .column-entry-yellow
|
||||
STYLE-DAG: .column-entry-yellow:hover
|
||||
STYLE-DAG: .column-entry-red
|
||||
STYLE-DAG: .column-entry-red:hover
|
||||
STYLE-DAG: .column-entry-green
|
||||
STYLE-DAG: .column-entry-green:hover
|
||||
STYLE-DAG: .covered-line
|
||||
STYLE-DAG: .uncovered-line
|
||||
STYLE-DAG: .tooltip
|
||||
STYLE-DAG: .tooltip span.tooltip-content
|
||||
STYLE-DAG: th, td
|
||||
STYLE-DAG: td:first-child
|
||||
STYLE-DAG: td:last-child
|
||||
STYLE-DAG: tr:hover
|
||||
|
||||
TOPLEVEL-NOT: <style>
|
||||
TOPLEVEL: <head>
|
||||
|
@ -116,24 +116,39 @@ table {
|
||||
background: #ffffff;
|
||||
border: 1px solid #dbdbdb;
|
||||
}
|
||||
.column-entry {
|
||||
text-align: right;
|
||||
.light-row-bold {
|
||||
background: #ffffff;
|
||||
border: 1px solid #dbdbdb;
|
||||
font-weight: bold;
|
||||
}
|
||||
.column-entry-left {
|
||||
.column-entry {
|
||||
text-align: left;
|
||||
}
|
||||
.column-entry-bold {
|
||||
font-weight: bold;
|
||||
text-align: left;
|
||||
}
|
||||
.column-entry-yellow {
|
||||
text-align: right;
|
||||
text-align: left;
|
||||
background-color: #ffffd0;
|
||||
}
|
||||
.column-entry-yellow:hover {
|
||||
background-color: #fffff0;
|
||||
}
|
||||
.column-entry-red {
|
||||
text-align: right;
|
||||
text-align: left;
|
||||
background-color: #ffd0d0;
|
||||
}
|
||||
.column-entry-red:hover {
|
||||
background-color: #fff0f0;
|
||||
}
|
||||
.column-entry-green {
|
||||
text-align: right;
|
||||
text-align: left;
|
||||
background-color: #d0ffd0;
|
||||
}
|
||||
.column-entry-green:hover {
|
||||
background-color: #f0fff0;
|
||||
}
|
||||
.line-number {
|
||||
text-align: right;
|
||||
color: #aaa;
|
||||
@ -184,10 +199,11 @@ table {
|
||||
}
|
||||
th, td {
|
||||
vertical-align: top;
|
||||
padding: 2px 5px;
|
||||
padding: 2px 8px;
|
||||
border-collapse: collapse;
|
||||
border-right: solid 1px #eee;
|
||||
border-left: solid 1px #eee;
|
||||
text-align: left;
|
||||
}
|
||||
td:first-child {
|
||||
border-left: none;
|
||||
@ -195,6 +211,9 @@ td:first-child {
|
||||
td:last-child {
|
||||
border-right: none;
|
||||
}
|
||||
tr:hover {
|
||||
background-color: #f0f0f0;
|
||||
}
|
||||
)";
|
||||
|
||||
const char *EndHeader = "</head>";
|
||||
@ -287,13 +306,14 @@ void CoveragePrinterHTML::closeViewFile(OwnedStream OS) {
|
||||
static void emitColumnLabelsForIndex(raw_ostream &OS,
|
||||
const CoverageViewOptions &Opts) {
|
||||
SmallVector<std::string, 4> Columns;
|
||||
Columns.emplace_back(tag("td", "Filename", "column-entry-left"));
|
||||
Columns.emplace_back(tag("td", "Function Coverage", "column-entry"));
|
||||
Columns.emplace_back(tag("td", "Filename", "column-entry-bold"));
|
||||
Columns.emplace_back(tag("td", "Function Coverage", "column-entry-bold"));
|
||||
if (Opts.ShowInstantiationSummary)
|
||||
Columns.emplace_back(tag("td", "Instantiation Coverage", "column-entry"));
|
||||
Columns.emplace_back(tag("td", "Line Coverage", "column-entry"));
|
||||
Columns.emplace_back(
|
||||
tag("td", "Instantiation Coverage", "column-entry-bold"));
|
||||
Columns.emplace_back(tag("td", "Line Coverage", "column-entry-bold"));
|
||||
if (Opts.ShowRegionSummary)
|
||||
Columns.emplace_back(tag("td", "Region Coverage", "column-entry"));
|
||||
Columns.emplace_back(tag("td", "Region Coverage", "column-entry-bold"));
|
||||
OS << tag("tr", join(Columns.begin(), Columns.end(), ""));
|
||||
}
|
||||
|
||||
@ -323,7 +343,7 @@ void CoveragePrinterHTML::emitFileSummary(raw_ostream &OS, StringRef SF,
|
||||
{
|
||||
raw_string_ostream RSO{S};
|
||||
if (Total)
|
||||
RSO << format("%*.2f", 7, Pctg) << "% ";
|
||||
RSO << format("%6.2f", 7, Pctg) << "% ";
|
||||
else
|
||||
RSO << "- ";
|
||||
RSO << '(' << Hit << '/' << Total << ')';
|
||||
@ -339,7 +359,7 @@ void CoveragePrinterHTML::emitFileSummary(raw_ostream &OS, StringRef SF,
|
||||
// Simplify the display file path, and wrap it in a link if requested.
|
||||
std::string Filename;
|
||||
if (IsTotals) {
|
||||
Filename = "TOTALS";
|
||||
Filename = SF;
|
||||
} else {
|
||||
Filename = buildLinkToFile(SF, FCS);
|
||||
}
|
||||
@ -360,7 +380,10 @@ void CoveragePrinterHTML::emitFileSummary(raw_ostream &OS, StringRef SF,
|
||||
FCS.RegionCoverage.getNumRegions(),
|
||||
FCS.RegionCoverage.getPercentCovered());
|
||||
|
||||
OS << tag("tr", join(Columns.begin(), Columns.end(), ""), "light-row");
|
||||
if (IsTotals)
|
||||
OS << tag("tr", join(Columns.begin(), Columns.end(), ""), "light-row-bold");
|
||||
else
|
||||
OS << tag("tr", join(Columns.begin(), Columns.end(), ""), "light-row");
|
||||
}
|
||||
|
||||
Error CoveragePrinterHTML::createIndexFile(
|
||||
|
Loading…
Reference in New Issue
Block a user