[llvm] r281145 - [llvm-cov] Minor visual tweaks for html reports
Vedant Kumar via llvm-commits
llvm-commits at lists.llvm.org
Sat Sep 10 12:37:21 PDT 2016
Author: vedantk
Date: Sat Sep 10 14:37:20 2016
New Revision: 281145
URL: http://llvm.org/viewvc/llvm-project?rev=281145&view=rev
Log:
[llvm-cov] Minor visual tweaks for html reports
- Change the location of the 'Region Coverage' column.
- Use less css and text for some labels.
Modified:
llvm/trunk/test/tools/llvm-cov/native_separators.c
llvm/trunk/test/tools/llvm-cov/showLineExecutionCounts.cpp
llvm/trunk/test/tools/llvm-cov/showProjectSummary.cpp
llvm/trunk/test/tools/llvm-cov/style.test
llvm/trunk/tools/llvm-cov/SourceCoverageView.cpp
llvm/trunk/tools/llvm-cov/SourceCoverageViewHTML.cpp
Modified: llvm/trunk/test/tools/llvm-cov/native_separators.c
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-cov/native_separators.c?rev=281145&r1=281144&r2=281145&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-cov/native_separators.c (original)
+++ llvm/trunk/test/tools/llvm-cov/native_separators.c Sat Sep 10 14:37:20 2016
@@ -15,16 +15,10 @@
// TEXT-INDEX: \tmp\native_separators.c
// HTML-INDEX: >tmp\native_separators.c</a>
-// HTML: <pre>Source: \tmp\native_separators.c (Binary: native_separators.covmapping)</pre>
+// HTML: <pre>\tmp\native_separators.c (Binary: native_separators.covmapping)</pre>
int main() {}
// RUN: llvm-cov show %S/Inputs/native_separators.covmapping -instr-profile=%t.profdata -filename-equivalence %s -o %t.dir
// RUN: FileCheck -check-prefixes=TEXT -input-file=%t.dir/coverage/tmp/native_separators.c.txt %s
-// TEXT: Source: \tmp\native_separators.c (Binary: native_separators.covmapping)
-
-// Re-purpose this file to test that "Go to first unexecuted line" feature.
-
-// RUN: llvm-cov show %S/Inputs/native_separators.covmapping -instr-profile %t.profdata -filename-equivalence -format html -o %t.dir %s
-// RUN: FileCheck -input-file %t.dir/coverage/tmp/native_separators.c.html %s
-// CHECK-NOT: >Go to first unexecuted line<
+// TEXT: \tmp\native_separators.c (Binary: native_separators.covmapping)
Modified: llvm/trunk/test/tools/llvm-cov/showLineExecutionCounts.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-cov/showLineExecutionCounts.cpp?rev=281145&r1=281144&r2=281145&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-cov/showLineExecutionCounts.cpp (original)
+++ llvm/trunk/test/tools/llvm-cov/showLineExecutionCounts.cpp Sat Sep 10 14:37:20 2016
@@ -78,15 +78,15 @@ 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'>Filename</td>
-// HTML-INDEX: <td class='column-entry'>Region Coverage</td>
+// 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: <a href='coverage{{.*}}showLineExecutionCounts.cpp.html'{{.*}}showLineExecutionCounts.cpp</a>
-// HTML-INDEX: <td class='column-entry-red'>
-// HTML-INDEX: 70.00% (7/10)
// HTML-INDEX: <td class='column-entry-green'>
// HTML-INDEX: 100.00% (1/1)
// HTML-INDEX: <td class='column-entry-yellow'>
// HTML-INDEX: 80.00% (16/20)
+// HTML-INDEX: <td class='column-entry-red'>
+// HTML-INDEX: 70.00% (7/10)
// HTML-INDEX: TOTALS
Modified: llvm/trunk/test/tools/llvm-cov/showProjectSummary.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-cov/showProjectSummary.cpp?rev=281145&r1=281144&r2=281145&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-cov/showProjectSummary.cpp (original)
+++ llvm/trunk/test/tools/llvm-cov/showProjectSummary.cpp Sat Sep 10 14:37:20 2016
@@ -16,7 +16,7 @@ int main(int argc, char ** argv) {
// RUN: llvm-cov show %S/Inputs/showProjectSummary.covmapping -instr-profile %t.profdata -project-title "Test Suite" -filename-equivalence %s | FileCheck -check-prefixes=TEXT-TITLE,TEXT,TEXT-FILE,TEXT-HEADER %s
// RUN: llvm-cov show %S/Inputs/showProjectSummary.covmapping -instr-profile %t.profdata -project-title "Test Suite" -name=main -filename-equivalence %s | FileCheck -check-prefixes=TEXT-FUNCTION,TEXT-HEADER %s
// TEXT-TITLE: Test Suite
-// TEXT: Code Coverage Report
+// TEXT: Coverage Report
// TEXT: Created:
// TEXT-FILE: showProjectSummary.cpp:
// TEXT-FILE: showProjectSummary.covmapping:
@@ -30,13 +30,10 @@ int main(int argc, char ** argv) {
// RUN: FileCheck -check-prefixes=HTML-TITLE,HTML -input-file %t.dir/index.html %s
// RUN: llvm-cov show %S/Inputs/showProjectSummary.covmapping -format=html -o %t.dir -instr-profile %t.profdata -project-title "Test Suite" -filename-equivalence -name=main %s
// RUN: FileCheck -check-prefixes=HTML-FUNCTION,HTML-HEADER -input-file %t.dir/functions.html %s
-// HTML-TITLE: <div class='project-title'>
-// HTML-TITLE: <span>Test Suite</span>
-// HTML: <div class='report-title'>
-// HTML: <span>Code Coverage Report</span>
-// HTML: <div class='created-time'>
-// HTML: <span>Created:
-// HTML-FILE: <pre>Source: {{.*}}showProjectSummary.cpp (Binary: showProjectSummary.covmapping)</pre>
+// HTML-TITLE: <h1>Test Suite</h1>
+// HTML: <h2>Coverage Report</h2>
+// HTML: <h4>Created:{{.*}}</h4>
+// HTML-FILE: <pre>{{.*}}showProjectSummary.cpp (Binary: showProjectSummary.covmapping)</pre>
// HTML-FUNCTION: <pre>main</pre>
// HTML-UNCOVEREDLINE: <a href='#L8'>Go to first unexecuted line</a>
// HTML-HEADER: <tr><td><span><pre>Line No.</pre></span></td>
Modified: llvm/trunk/test/tools/llvm-cov/style.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-cov/style.test?rev=281145&r1=281144&r2=281145&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-cov/style.test (original)
+++ llvm/trunk/test/tools/llvm-cov/style.test Sat Sep 10 14:37:20 2016
@@ -17,6 +17,7 @@ STYLE-DAG: .expansion-view
STYLE-DAG: .line-number
STYLE-DAG: .light-row
STYLE-DAG: .column-entry
+STYLE-DAG: .column-entry-left
STYLE-DAG: .column-entry-yellow
STYLE-DAG: .column-entry-red
STYLE-DAG: .column-entry-green
Modified: llvm/trunk/tools/llvm-cov/SourceCoverageView.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-cov/SourceCoverageView.cpp?rev=281145&r1=281144&r2=281145&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-cov/SourceCoverageView.cpp (original)
+++ llvm/trunk/tools/llvm-cov/SourceCoverageView.cpp Sat Sep 10 14:37:20 2016
@@ -150,7 +150,7 @@ std::string SourceCoverageView::getSourc
}
std::string SourceCoverageView::getVerboseSourceName() const {
- return "Source: " + getSourceName() + " (Binary: " +
+ return getSourceName() + " (Binary: " +
sys::path::filename(getOptions().ObjectFilename).str() + ")";
}
@@ -169,7 +169,7 @@ void SourceCoverageView::addInstantiatio
void SourceCoverageView::print(raw_ostream &OS, bool WholeFile,
bool ShowSourceName, unsigned ViewDepth) {
if (WholeFile)
- renderCellInTitle(OS, "Code Coverage Report");
+ renderCellInTitle(OS, "Coverage Report");
renderViewHeader(OS);
Modified: llvm/trunk/tools/llvm-cov/SourceCoverageViewHTML.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-cov/SourceCoverageViewHTML.cpp?rev=281145&r1=281144&r2=281145&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-cov/SourceCoverageViewHTML.cpp (original)
+++ llvm/trunk/tools/llvm-cov/SourceCoverageViewHTML.cpp Sat Sep 10 14:37:20 2016
@@ -119,6 +119,9 @@ table {
.column-entry {
text-align: right;
}
+.column-entry-left {
+ text-align: left;
+}
.column-entry-yellow {
text-align: right;
background-color: #ffffd0;
@@ -192,23 +195,6 @@ td:first-child {
td:last-child {
border-right: none;
}
-.project-title {
- font-size:36.0pt;
- line-height:200%;
- font-family:Calibri;
- font-weight: bold;
-}
-.report-title {
- font-size:16.0pt;
- line-height:120%;
- font-family:Arial;
- font-weight: bold;
-}
-.created-time {
- font-size:14.0pt;
- line-height:120%;
- font-family:Arial;
-}
)";
const char *EndHeader = "</head>";
@@ -237,19 +223,11 @@ const char *BeginTable = "<table>";
const char *EndTable = "</table>";
-const char *BeginProjectTitleDiv = "<div class='project-title'>";
-
-const char *EndProjectTitleDiv = "</div>";
-
-const char *BeginReportTitleDiv = "<div class='report-title'>";
+const char *ProjectTitleTag = "h1";
-const char *EndReportTitleDiv = "</div>";
+const char *ReportTitleTag = "h2";
-const char *BeginCreatedTimeDiv = "<div class='created-time'>";
-
-const char *EndCreatedTimeDiv = "</div>";
-
-const char *LineBreak = "<br>";
+const char *CreatedTimeTag = "h4";
std::string getPathToStyle(StringRef ViewPath) {
std::string PathToStyle = "";
@@ -308,8 +286,9 @@ void CoveragePrinterHTML::closeViewFile(
/// Emit column labels for the table in the index.
static void emitColumnLabelsForIndex(raw_ostream &OS) {
SmallVector<std::string, 4> Columns;
+ Columns.emplace_back(tag("td", "Filename", "column-entry-left"));
for (const char *Label :
- {"Filename", "Region Coverage", "Function Coverage", "Line Coverage"})
+ {"Function Coverage", "Line Coverage", "Region Coverage"})
Columns.emplace_back(tag("td", Label, "column-entry"));
OS << tag("tr", join(Columns.begin(), Columns.end(), ""));
}
@@ -334,7 +313,7 @@ void CoveragePrinterHTML::emitFileSummar
CellClass = "column-entry-red";
else if (Hit == Total)
CellClass = "column-entry-green";
- Columns.emplace_back(tag("td", tag("pre", S, "code"), CellClass));
+ Columns.emplace_back(tag("td", tag("pre", S), CellClass));
};
// Simplify the display file path, and wrap it in a link if requested.
@@ -351,16 +330,16 @@ void CoveragePrinterHTML::emitFileSummar
Filename = a(LinkTarget, LinkText);
}
- Columns.emplace_back(tag("td", tag("pre", Filename, "code")));
- AddCoverageTripleToColumn(
- FCS.RegionCoverage.NumRegions - FCS.RegionCoverage.NotCovered,
- FCS.RegionCoverage.NumRegions, FCS.RegionCoverage.getPercentCovered());
+ Columns.emplace_back(tag("td", tag("pre", Filename)));
AddCoverageTripleToColumn(FCS.FunctionCoverage.Executed,
FCS.FunctionCoverage.NumFunctions,
FCS.FunctionCoverage.getPercentCovered());
AddCoverageTripleToColumn(
FCS.LineCoverage.NumLines - FCS.LineCoverage.NotCovered,
FCS.LineCoverage.NumLines, FCS.LineCoverage.getPercentCovered());
+ AddCoverageTripleToColumn(
+ FCS.RegionCoverage.NumRegions - FCS.RegionCoverage.NotCovered,
+ FCS.RegionCoverage.NumRegions, FCS.RegionCoverage.getPercentCovered());
OS << tag("tr", join(Columns.begin(), Columns.end(), ""), "light-row");
}
@@ -388,16 +367,10 @@ Error CoveragePrinterHTML::createIndexFi
// Emit some basic information about the coverage report.
if (Opts.hasProjectTitle())
- OSRef << BeginProjectTitleDiv
- << tag("span", escape(Opts.ProjectTitle, Opts)) << EndProjectTitleDiv;
- OSRef << BeginReportTitleDiv
- << tag("span", escape("Code Coverage Report", Opts))
- << EndReportTitleDiv;
+ OSRef << tag(ProjectTitleTag, escape(Opts.ProjectTitle, Opts));
+ OSRef << tag(ReportTitleTag, "Coverage Report");
if (Opts.hasCreatedTime())
- OSRef << BeginCreatedTimeDiv
- << tag("span", escape(Opts.CreatedTimeStr, Opts))
- << EndCreatedTimeDiv;
- OSRef << LineBreak;
+ OSRef << tag(CreatedTimeTag, escape(Opts.CreatedTimeStr, Opts));
// Emit a table containing links to reports for each file in the covmapping.
CoverageReport Report(Opts, Coverage);
@@ -415,7 +388,7 @@ Error CoveragePrinterHTML::createIndexFi
}
void SourceCoverageViewHTML::renderViewHeader(raw_ostream &OS) {
- OS << LineBreak << BeginCenteredDiv << BeginTable;
+ OS << BeginCenteredDiv << BeginTable;
}
void SourceCoverageViewHTML::renderViewFooter(raw_ostream &OS) {
@@ -627,17 +600,11 @@ void SourceCoverageViewHTML::renderInsta
void SourceCoverageViewHTML::renderCellInTitle(raw_ostream &OS,
StringRef CellText) {
if (getOptions().hasProjectTitle())
- OS << BeginProjectTitleDiv
- << tag("span", escape(getOptions().ProjectTitle, getOptions()))
- << EndProjectTitleDiv;
-
- OS << BeginReportTitleDiv << tag("span", escape(CellText, getOptions()))
- << EndReportTitleDiv;
-
+ OS << tag(ProjectTitleTag, escape(getOptions().ProjectTitle, getOptions()));
+ OS << tag(ReportTitleTag, escape(CellText, getOptions()));
if (getOptions().hasCreatedTime())
- OS << BeginCreatedTimeDiv
- << tag("span", escape(getOptions().CreatedTimeStr, getOptions()))
- << EndCreatedTimeDiv;
+ OS << tag(CreatedTimeTag,
+ escape(getOptions().CreatedTimeStr, getOptions()));
}
void SourceCoverageViewHTML::renderTableHeader(raw_ostream &OS,
More information about the llvm-commits
mailing list