Vedant Kumar | 43247f0 | 2017-11-09 02:33:43 +0000 | [diff] [blame] | 1 | // RUN: llvm-cov report %S/Inputs/report.covmapping -instr-profile %S/Inputs/report.profdata -path-equivalence=/tmp,%S 2>&1 -show-region-summary -show-instantiation-summary | FileCheck %s |
| 2 | // RUN: llvm-cov report -show-functions %S/Inputs/report.covmapping -instr-profile %S/Inputs/report.profdata -path-equivalence=/tmp,%S %s 2>&1 | FileCheck -check-prefix=FILT %s |
| 3 | // RUN: llvm-cov report -show-functions %S/Inputs/report.covmapping -instr-profile %S/Inputs/report.profdata -path-equivalence=/tmp,%S %s does-not-exist.cpp 2>&1 | FileCheck -check-prefix=FILT %s |
| 4 | // RUN: not llvm-cov report -show-functions %S/Inputs/report.covmapping -instr-profile %S/Inputs/report.profdata -path-equivalence=/tmp,%S 2>&1 | FileCheck -check-prefix=NO_FILES %s |
Vedant Kumar | feb3f52 | 2017-09-25 23:10:03 +0000 | [diff] [blame] | 5 | |
| 6 | // NO_FILES: Source files must be specified when -show-functions=true is specified |
Alex Lorenz | cb1702d | 2014-09-30 12:45:13 +0000 | [diff] [blame] | 7 | |
Vedant Kumar | 016111f | 2016-09-19 00:38:23 +0000 | [diff] [blame] | 8 | // CHECK: Regions Missed Regions Cover Functions Missed Functions Executed Instantiations Missed Insts. Executed Lines Missed Lines Cover |
Justin Bogner | 0ef7a2a | 2015-02-14 02:05:05 +0000 | [diff] [blame] | 9 | // CHECK-NEXT: --- |
Vedant Kumar | 43247f0 | 2017-11-09 02:33:43 +0000 | [diff] [blame] | 10 | // CHECK-NEXT: report.cpp 6 2 66.67% 4 1 75.00% 4 1 75.00% 13 3 76.92% |
Justin Bogner | 0ef7a2a | 2015-02-14 02:05:05 +0000 | [diff] [blame] | 11 | // CHECK-NEXT: --- |
Vedant Kumar | 43247f0 | 2017-11-09 02:33:43 +0000 | [diff] [blame] | 12 | // CHECK-NEXT: TOTAL 6 2 66.67% 4 1 75.00% 4 1 75.00% 13 3 76.92% |
Justin Bogner | 0ef7a2a | 2015-02-14 02:05:05 +0000 | [diff] [blame] | 13 | |
Vedant Kumar | 43247f0 | 2017-11-09 02:33:43 +0000 | [diff] [blame] | 14 | // FILT: File '{{.*}}report.cpp': |
Justin Bogner | 0ef7a2a | 2015-02-14 02:05:05 +0000 | [diff] [blame] | 15 | // FILT-NEXT: Name Regions Miss Cover Lines Miss Cover |
| 16 | // FILT-NEXT: --- |
Vedant Kumar | 43247f0 | 2017-11-09 02:33:43 +0000 | [diff] [blame] | 17 | // FILT-NEXT: _Z3foob 3 1 66.67% 4 1 75.00% |
Justin Bogner | 0ef7a2a | 2015-02-14 02:05:05 +0000 | [diff] [blame] | 18 | // FILT-NEXT: _Z3barv 1 0 100.00% 2 0 100.00% |
| 19 | // FILT-NEXT: _Z4funcv 1 1 0.00% 2 2 0.00% |
| 20 | // FILT-NEXT: main 1 0 100.00% 5 0 100.00% |
| 21 | // FILT-NEXT: --- |
Vedant Kumar | 43247f0 | 2017-11-09 02:33:43 +0000 | [diff] [blame] | 22 | // FILT-NEXT: TOTAL 6 2 66.67% 13 3 76.92% |
Alex Lorenz | cb1702d | 2014-09-30 12:45:13 +0000 | [diff] [blame] | 23 | |
| 24 | void foo(bool cond) { |
| 25 | if (cond) { |
| 26 | } |
| 27 | } |
| 28 | |
| 29 | void bar() { |
| 30 | } |
| 31 | |
| 32 | void func() { |
| 33 | } |
| 34 | |
| 35 | int main() { |
| 36 | foo(false); |
| 37 | bar(); |
| 38 | return 0; |
| 39 | } |
Vedant Kumar | 8d74cb2 | 2016-06-29 00:38:21 +0000 | [diff] [blame] | 40 | |
| 41 | // Test that listing multiple functions in a function view works. |
Vedant Kumar | 43247f0 | 2017-11-09 02:33:43 +0000 | [diff] [blame] | 42 | // RUN: llvm-cov show -o %t.dir %S/Inputs/report.covmapping -instr-profile=%S/Inputs/report.profdata -path-equivalence=/tmp,%S -name-regex=".*" %s |
| 43 | // RUN: FileCheck -check-prefix=FUNCTIONS -input-file %t.dir/coverage/tmp/report.cpp.txt %s |
Vedant Kumar | 8d74cb2 | 2016-06-29 00:38:21 +0000 | [diff] [blame] | 44 | // FUNCTIONS: _Z3foob |
| 45 | // FUNCTIONS: _Z3barv |
| 46 | // FUNCTIONS: _Z4func |