2015-03-10 02:54:58 +08:00
|
|
|
// Basic handling of line counts.
|
|
|
|
// RUN: llvm-profdata merge %S/Inputs/lineExecutionCounts.proftext -o %t.profdata
|
2014-08-23 06:56:03 +08:00
|
|
|
|
2016-08-10 03:53:35 +08:00
|
|
|
// before any coverage // WHOLE-FILE: [[@LINE]]| |// before
|
|
|
|
// FILTER-NOT: [[@LINE-1]]| |// before
|
|
|
|
int main() { // TEXT: [[@LINE]]| 161|int main(
|
|
|
|
int x = 0; // TEXT: [[@LINE]]| 161| int x
|
|
|
|
// TEXT: [[@LINE]]| 161|
|
2017-08-04 08:36:24 +08:00
|
|
|
if (x) { // TEXT: [[@LINE]]| 161| if (x)
|
2016-08-10 03:53:35 +08:00
|
|
|
x = 0; // TEXT: [[@LINE]]| 0| x = 0
|
|
|
|
} else { // TEXT: [[@LINE]]| 161| } else
|
|
|
|
x = 1; // TEXT: [[@LINE]]| 161| x = 1
|
|
|
|
} // TEXT: [[@LINE]]| 161| }
|
|
|
|
// TEXT: [[@LINE]]| 161|
|
|
|
|
for (int i = 0; i < 100; ++i) { // TEXT: [[@LINE]]| 16.2k| for (
|
|
|
|
x = 1; // TEXT: [[@LINE]]| 16.1k| x = 1
|
|
|
|
} // TEXT: [[@LINE]]| 16.1k| }
|
|
|
|
// TEXT: [[@LINE]]| 161|
|
|
|
|
x = x < 10 ? x + 1 : x - 1; // TEXT: [[@LINE]]| 161| x =
|
|
|
|
x = x > 10 ? // TEXT: [[@LINE]]| 161| x =
|
|
|
|
x - 1: // TEXT: [[@LINE]]| 0| x
|
|
|
|
x + 1; // TEXT: [[@LINE]]| 161| x
|
|
|
|
// TEXT: [[@LINE]]| 161|
|
|
|
|
return 0; // TEXT: [[@LINE]]| 161| return
|
|
|
|
} // TEXT: [[@LINE]]| 161|}
|
|
|
|
// after coverage // WHOLE-FILE: [[@LINE]]| |// after
|
|
|
|
// FILTER-NOT: [[@LINE-1]]| |// after
|
2014-08-23 08:47:24 +08:00
|
|
|
|
2017-08-14 18:20:12 +08:00
|
|
|
// RUN: llvm-cov show %S/Inputs/lineExecutionCounts.covmapping -instr-profile %t.profdata -path-equivalence=/tmp,%S %s | FileCheck -check-prefixes=TEXT,WHOLE-FILE %s
|
|
|
|
// RUN: llvm-cov show %S/Inputs/lineExecutionCounts.covmapping -instr-profile %t.profdata -path-equivalence=/tmp,%S -name=main %s | FileCheck -check-prefixes=TEXT,FILTER %s
|
2016-06-28 10:09:39 +08:00
|
|
|
|
|
|
|
// Test -output-dir.
|
2017-08-14 18:20:12 +08:00
|
|
|
// RUN: llvm-cov show %S/Inputs/lineExecutionCounts.covmapping -o %t.dir -instr-profile %t.profdata -path-equivalence=/tmp,%S %s
|
2017-09-28 18:07:30 +08:00
|
|
|
// RUN: llvm-cov show %S/Inputs/lineExecutionCounts.covmapping -output-dir %t.filtered.dir -instr-profile %t.profdata -path-equivalence=/tmp,%S -name=main %s
|
2016-06-30 01:47:08 +08:00
|
|
|
// RUN: FileCheck -check-prefixes=TEXT,WHOLE-FILE -input-file %t.dir/coverage/tmp/showLineExecutionCounts.cpp.txt %s
|
2017-09-28 18:07:30 +08:00
|
|
|
// RUN: FileCheck -check-prefixes=TEXT,FILTER -input-file %t.filtered.dir/coverage/tmp/showLineExecutionCounts.cpp.txt %s
|
2016-06-29 00:12:24 +08:00
|
|
|
//
|
2017-12-12 07:17:46 +08:00
|
|
|
// RUN: llvm-cov export %S/Inputs/lineExecutionCounts.covmapping -instr-profile %t.profdata 2>/dev/null -summary-only > %t.export-summary.json
|
|
|
|
// RUN: not grep '"name":"main"' %t.export-summary.json
|
|
|
|
//
|
2016-07-07 05:44:05 +08:00
|
|
|
// Test html output.
|
2017-08-14 18:20:12 +08:00
|
|
|
// RUN: llvm-cov show %S/Inputs/lineExecutionCounts.covmapping -format html -o %t.html.dir -instr-profile %t.profdata -path-equivalence=/tmp,%S %s
|
2017-09-28 18:07:30 +08:00
|
|
|
// RUN: llvm-cov show %S/Inputs/lineExecutionCounts.covmapping -format html -o %t.html.filtered.dir -instr-profile %t.profdata -path-equivalence=/tmp,%S -name=main %s
|
2016-07-07 05:44:05 +08:00
|
|
|
// RUN: FileCheck -check-prefixes=HTML,HTML-WHOLE-FILE -input-file %t.html.dir/coverage/tmp/showLineExecutionCounts.cpp.html %s
|
2017-09-28 18:07:30 +08:00
|
|
|
// RUN: FileCheck -check-prefixes=HTML,HTML-FILTER -input-file %t.html.filtered.dir/coverage/tmp/showLineExecutionCounts.cpp.html %s
|
2016-07-07 05:44:05 +08:00
|
|
|
//
|
2017-12-12 07:34:50 +08:00
|
|
|
// HTML-WHOLE-FILE: <td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// before
|
|
|
|
// HTML-FILTER-NOT: <td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// before
|
|
|
|
// HTML: <td class='line-number'><a name='L6' href='#L6'><pre>6</pre></a></td><td class='covered-line'><pre>161</pre></td><td class='code'><pre>int main() {
|
|
|
|
// HTML-WHOLE-FILE: <td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// after
|
|
|
|
// HTML-FILTER-NOT: <td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='uncovered-line'></td><td class='code'><pre>// after
|
2016-09-09 09:32:55 +08:00
|
|
|
//
|
|
|
|
// Test index creation.
|
|
|
|
// RUN: FileCheck -check-prefix=TEXT-INDEX -input-file %t.dir/index.txt %s
|
|
|
|
// TEXT-INDEX: Filename
|
|
|
|
// TEXT-INDEX-NEXT: ---
|
|
|
|
// TEXT-INDEX-NEXT: {{.*}}showLineExecutionCounts.cpp
|
|
|
|
//
|
|
|
|
// RUN: FileCheck -check-prefix HTML-INDEX -input-file %t.html.dir/index.html %s
|
|
|
|
// HTML-INDEX-LABEL: <table>
|
2018-02-01 01:37:21 +08:00
|
|
|
// 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>
|
2016-09-09 09:32:55 +08:00
|
|
|
// HTML-INDEX: <a href='coverage{{.*}}showLineExecutionCounts.cpp.html'{{.*}}showLineExecutionCounts.cpp</a>
|
|
|
|
// HTML-INDEX: <td class='column-entry-green'>
|
|
|
|
// HTML-INDEX: 100.00% (1/1)
|
|
|
|
// HTML-INDEX: <td class='column-entry-yellow'>
|
2017-09-19 10:00:12 +08:00
|
|
|
// HTML-INDEX: 90.00% (18/20)
|
2016-09-11 03:37:20 +08:00
|
|
|
// HTML-INDEX: <td class='column-entry-red'>
|
2017-09-09 02:44:47 +08:00
|
|
|
// HTML-INDEX: 72.73% (8/11)
|
2018-02-01 01:37:21 +08:00
|
|
|
// HTML-INDEX: <tr class='light-row-bold'>
|
|
|
|
// HTML-INDEX: Totals
|