[llvm] r281321 - [llvm-cov] - Included footer "Generated by llvm-cov -- llvm version <version number>" in the coverage report.
Ying Yi via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 13 04:28:32 PDT 2016
Author: yingyi
Date: Tue Sep 13 06:28:31 2016
New Revision: 281321
URL: http://llvm.org/viewvc/llvm-project?rev=281321&view=rev
Log:
[llvm-cov] - Included footer "Generated by llvm-cov -- llvm version <version number>" in the coverage report.
The llvm-cov version information will be useful to the user when comparing the code coverage across different versions of llvm-cov. This patch provides the llvm-cov version information in the generated coverage report.
Differential Revision: https://reviews.llvm.org/D24457
Modified:
llvm/trunk/test/tools/llvm-cov/showProjectSummary.cpp
llvm/trunk/tools/llvm-cov/CoverageViewOptions.h
llvm/trunk/tools/llvm-cov/SourceCoverageViewHTML.cpp
llvm/trunk/tools/llvm-cov/SourceCoverageViewText.cpp
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=281321&r1=281320&r2=281321&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-cov/showProjectSummary.cpp (original)
+++ llvm/trunk/test/tools/llvm-cov/showProjectSummary.cpp Tue Sep 13 06:28:31 2016
@@ -12,24 +12,27 @@ int main(int argc, char ** argv) {
}
// Test console output.
-// RUN: llvm-cov show %S/Inputs/showProjectSummary.covmapping -instr-profile %t.profdata -filename-equivalence %s | FileCheck -check-prefixes=TEXT,TEXT-FILE,TEXT-HEADER %s
-// 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
+// RUN: llvm-cov show %S/Inputs/showProjectSummary.covmapping -instr-profile %t.profdata -filename-equivalence %s | FileCheck -check-prefixes=TEXT,TEXT-FILE,TEXT-HEADER,TEXT-FOOTER %s
+// 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,TEXT-FOOTER %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,TEXT-FOOTER %s
+// RUN: llvm-cov show %S/Inputs/showProjectSummary.covmapping -instr-profile=%t.profdata -o %t.dir -filename-equivalence %s
+// RUN: FileCheck -check-prefixes=TEXT-FOOTER -input-file=%t.dir/index.txt %s
// TEXT-TITLE: Test Suite
// TEXT: Coverage Report
// TEXT: Created:
// TEXT-FILE: showProjectSummary.cpp:
// TEXT-FILE: showProjectSummary.covmapping:
// TEXT-FUNCTION: main:
+// TEXT-FOOTER: Generated by llvm-cov
// Test html output.
// RUN: llvm-cov show %S/Inputs/showProjectSummary.covmapping -format=html -o %t.dir -instr-profile %t.profdata -filename-equivalence %s
-// RUN: FileCheck -check-prefixes=HTML,HTML-FILE,HTML-HEADER -input-file %t.dir/coverage/tmp/showProjectSummary.cpp.html %s
+// RUN: FileCheck -check-prefixes=HTML,HTML-FILE,HTML-HEADER,HTML-FOOTER -input-file %t.dir/coverage/tmp/showProjectSummary.cpp.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 %s
-// RUN: FileCheck -check-prefixes=HTML-TITLE,HTML,HTML-FILE,HTML-HEADER -input-file %t.dir/coverage/tmp/showProjectSummary.cpp.html %s
-// RUN: FileCheck -check-prefixes=HTML-TITLE,HTML -input-file %t.dir/index.html %s
+// RUN: FileCheck -check-prefixes=HTML-TITLE,HTML,HTML-FILE,HTML-HEADER,HTML-FOOTER -input-file %t.dir/coverage/tmp/showProjectSummary.cpp.html %s
+// RUN: FileCheck -check-prefixes=HTML-TITLE,HTML,HTML-FOOTER -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
+// RUN: FileCheck -check-prefixes=HTML-FUNCTION,HTML-HEADER,HTML-FOOTER -input-file %t.dir/functions.html %s
// HTML-TITLE: <h1>Test Suite</h1>
// HTML: <h2>Coverage Report</h2>
// HTML: <h4>Created:{{.*}}</h4>
@@ -38,3 +41,4 @@ int main(int argc, char ** argv) {
// HTML-HEADER: <td><pre>Line No.</pre></td>
// HTML-HEADER: <td><pre>Count</pre></td>
// HTML-HEADER: <td><pre>Source (<a href='#L8'>jump to first uncovered line</a>)</pre></td>
+// HTML-FOOTER: <h5>Generated by llvm-cov{{.*}}</h5>
Modified: llvm/trunk/tools/llvm-cov/CoverageViewOptions.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-cov/CoverageViewOptions.h?rev=281321&r1=281320&r2=281321&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-cov/CoverageViewOptions.h (original)
+++ llvm/trunk/tools/llvm-cov/CoverageViewOptions.h Tue Sep 13 06:28:31 2016
@@ -56,6 +56,13 @@ struct CoverageViewOptions {
/// \brief Check if the created time of the profile data file is available.
bool hasCreatedTime() const { return !CreatedTimeStr.empty(); }
+
+ /// \brief Get the LLVM version string.
+ std::string getLLVMVersionString() const {
+ std::string VersionString = "Generated by llvm-cov -- llvm version ";
+ VersionString += LLVM_VERSION_STRING;
+ return VersionString;
+ }
};
}
Modified: llvm/trunk/tools/llvm-cov/SourceCoverageViewHTML.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-cov/SourceCoverageViewHTML.cpp?rev=281321&r1=281320&r2=281321&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-cov/SourceCoverageViewHTML.cpp (original)
+++ llvm/trunk/tools/llvm-cov/SourceCoverageViewHTML.cpp Tue Sep 13 06:28:31 2016
@@ -381,7 +381,8 @@ Error CoveragePrinterHTML::createIndexFi
for (unsigned I = 0, E = FileReports.size(); I < E; ++I)
emitFileSummary(OSRef, SourceFiles[I], FileReports[I]);
emitFileSummary(OSRef, "Totals", Totals, /*IsTotals=*/true);
- OSRef << EndTable << EndCenteredDiv;
+ OSRef << EndTable << EndCenteredDiv
+ << tag("h5", escape(Opts.getLLVMVersionString(), Opts));
emitEpilog(OSRef);
return Error::success();
@@ -392,7 +393,8 @@ void SourceCoverageViewHTML::renderViewH
}
void SourceCoverageViewHTML::renderViewFooter(raw_ostream &OS) {
- OS << EndTable << EndCenteredDiv;
+ OS << EndTable << EndCenteredDiv
+ << tag("h5", escape(getOptions().getLLVMVersionString(), getOptions()));
}
void SourceCoverageViewHTML::renderSourceName(raw_ostream &OS, bool WholeFile) {
Modified: llvm/trunk/tools/llvm-cov/SourceCoverageViewText.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-cov/SourceCoverageViewText.cpp?rev=281321&r1=281320&r2=281321&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-cov/SourceCoverageViewText.cpp (original)
+++ llvm/trunk/tools/llvm-cov/SourceCoverageViewText.cpp Tue Sep 13 06:28:31 2016
@@ -40,6 +40,9 @@ Error CoveragePrinterText::createIndexFi
CoverageReport Report(Opts, Coverage);
Report.renderFileReports(OSRef);
+ Opts.colored_ostream(OSRef, raw_ostream::CYAN) << "\n"
+ << Opts.getLLVMVersionString();
+
return Error::success();
}
@@ -64,7 +67,10 @@ unsigned getDividerWidth(const CoverageV
void SourceCoverageViewText::renderViewHeader(raw_ostream &) {}
-void SourceCoverageViewText::renderViewFooter(raw_ostream &) {}
+void SourceCoverageViewText::renderViewFooter(raw_ostream &OS) {
+ getOptions().colored_ostream(OS, raw_ostream::CYAN)
+ << "\n" << getOptions().getLLVMVersionString();
+}
void SourceCoverageViewText::renderSourceName(raw_ostream &OS, bool WholeFile) {
std::string ViewInfo = WholeFile ? getVerboseSourceName() : getSourceName();
More information about the llvm-commits
mailing list