mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 11:13:28 +01:00
[llvm-cov] - Add the coverage of lines in the summary report.
The llvm-cov ‘report' command displays a summary of the coverage of a binary file. The summary report currently only includes covered regions and covered functions. This patch adds the coverage of lines in the summary report. Differential Revision: https://reviews.llvm.org/D22569 llvm-svn: 276409
This commit is contained in:
parent
a96697aa5e
commit
23078261e3
@ -1,7 +1,7 @@
|
||||
// Checks that function instantiations don't go to a wrong file.
|
||||
|
||||
// INSTANTIATION-NOT: {{_Z5func[1,2]v}}
|
||||
// NAN-NOT: 0{{[ \t]+}}nan%{{[ \t]+}}0{{[ \t]+}}nan%
|
||||
// NAN-NOT: {{[ \t]+}}nan%
|
||||
|
||||
// RUN: llvm-profdata merge %S/Inputs/prevent_false_instantiations.proftext -o %t.profdata
|
||||
// RUN: llvm-cov show -format text %S/Inputs/prevent_false_instantiations.covmapping -instr-profile %t.profdata -filename-equivalence %s | FileCheck %s -check-prefix=INSTANTIATION
|
||||
|
@ -1,11 +1,11 @@
|
||||
// RUN: llvm-cov report %S/Inputs/report.covmapping -instr-profile %S/Inputs/report.profdata -filename-equivalence 2>&1 | FileCheck %s
|
||||
// RUN: llvm-cov report %S/Inputs/report.covmapping -instr-profile %S/Inputs/report.profdata -filename-equivalence report.cpp 2>&1 | FileCheck -check-prefix=FILT-NEXT %s
|
||||
|
||||
// CHECK: Filename Regions Miss Cover Functions Executed
|
||||
// CHECK: Filename Regions Missed Regions Cover Functions Missed Functions Executed Lines Missed Lines Cover
|
||||
// CHECK-NEXT: ---
|
||||
// CHECK-NEXT: report.cpp 5 2 60.00% 4 75.00%
|
||||
// CHECK-NEXT: report.cpp 5 2 60.00% 4 1 75.00% 13 4 69.23%
|
||||
// CHECK-NEXT: ---
|
||||
// CHECK-NEXT: TOTAL 5 2 60.00% 4 75.00%
|
||||
// CHECK-NEXT: TOTAL 5 2 60.00% 4 1 75.00% 13 4 69.23%
|
||||
|
||||
// FILT: File 'report.cpp':
|
||||
// FILT-NEXT: Name Regions Miss Cover Lines Miss Cover
|
||||
|
@ -88,7 +88,8 @@ static Column column(StringRef Str, unsigned Width, const T &Value) {
|
||||
return Column(Str, Width).set(Value);
|
||||
}
|
||||
|
||||
static size_t FileReportColumns[] = {25, 10, 8, 8, 10, 10};
|
||||
// Specify the default column widths.
|
||||
static size_t FileReportColumns[] = {25, 12, 18, 10, 12, 18, 10, 12, 18, 10};
|
||||
static size_t FunctionReportColumns[] = {25, 10, 8, 8, 10, 8, 8};
|
||||
|
||||
/// \brief Adjust column widths to fit long file paths and function names.
|
||||
@ -136,10 +137,24 @@ void CoverageReport::render(const FileCoverageSummary &File, raw_ostream &OS) {
|
||||
File.RegionCoverage.getPercentCovered()) << '%';
|
||||
OS << format("%*u", FileReportColumns[4],
|
||||
(unsigned)File.FunctionCoverage.NumFunctions);
|
||||
OS << format("%*u", FileReportColumns[5],
|
||||
(unsigned)(File.FunctionCoverage.NumFunctions -
|
||||
File.FunctionCoverage.Executed));
|
||||
Options.colored_ostream(
|
||||
OS, determineCoveragePercentageColor(File.FunctionCoverage))
|
||||
<< format("%*.2f", FileReportColumns[5] - 1,
|
||||
<< format("%*.2f", FileReportColumns[6] - 1,
|
||||
File.FunctionCoverage.getPercentCovered()) << '%';
|
||||
OS << format("%*u", FileReportColumns[7],
|
||||
(unsigned)File.LineCoverage.NumLines);
|
||||
Options.colored_ostream(OS, File.LineCoverage.isFullyCovered()
|
||||
? raw_ostream::GREEN
|
||||
: raw_ostream::RED)
|
||||
<< format("%*u", FileReportColumns[8],
|
||||
(unsigned)File.LineCoverage.NotCovered);
|
||||
Options.colored_ostream(OS,
|
||||
determineCoveragePercentageColor(File.LineCoverage))
|
||||
<< format("%*.2f", FileReportColumns[9] - 1,
|
||||
File.LineCoverage.getPercentCovered()) << '%';
|
||||
OS << "\n";
|
||||
}
|
||||
|
||||
@ -211,10 +226,15 @@ void CoverageReport::renderFileReports(raw_ostream &OS) {
|
||||
adjustColumnWidths(Coverage.get());
|
||||
OS << column("Filename", FileReportColumns[0])
|
||||
<< column("Regions", FileReportColumns[1], Column::RightAlignment)
|
||||
<< column("Miss", FileReportColumns[2], Column::RightAlignment)
|
||||
<< column("Missed Regions", FileReportColumns[2], Column::RightAlignment)
|
||||
<< column("Cover", FileReportColumns[3], Column::RightAlignment)
|
||||
<< column("Functions", FileReportColumns[4], Column::RightAlignment)
|
||||
<< column("Executed", FileReportColumns[5], Column::RightAlignment)
|
||||
<< column("Missed Functions", FileReportColumns[5],
|
||||
Column::RightAlignment)
|
||||
<< column("Executed", FileReportColumns[6], Column::RightAlignment)
|
||||
<< column("Lines", FileReportColumns[7], Column::RightAlignment)
|
||||
<< column("Missed Lines", FileReportColumns[8], Column::RightAlignment)
|
||||
<< column("Cover", FileReportColumns[9], Column::RightAlignment)
|
||||
<< "\n";
|
||||
renderDivider(FileReportColumns, OS);
|
||||
OS << "\n";
|
||||
|
Loading…
Reference in New Issue
Block a user