xref: /aosp_15_r20/external/llvm/test/tools/llvm-cov/report.cpp (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker // RUN: llvm-cov report %S/Inputs/report.covmapping -instr-profile %S/Inputs/report.profdata -filename-equivalence 2>&1 | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker // 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
3*9880d681SAndroid Build Coastguard Worker 
4*9880d681SAndroid Build Coastguard Worker // CHECK:      Filename   Regions  Miss   Cover  Functions  Executed
5*9880d681SAndroid Build Coastguard Worker // CHECK-NEXT: ---
6*9880d681SAndroid Build Coastguard Worker // CHECK-NEXT: report.cpp       5     2  60.00%          4    75.00%
7*9880d681SAndroid Build Coastguard Worker // CHECK-NEXT: ---
8*9880d681SAndroid Build Coastguard Worker // CHECK-NEXT: TOTAL            5     2  60.00%          4    75.00%
9*9880d681SAndroid Build Coastguard Worker 
10*9880d681SAndroid Build Coastguard Worker // FILT: File 'report.cpp':
11*9880d681SAndroid Build Coastguard Worker // FILT-NEXT: Name        Regions  Miss   Cover  Lines  Miss   Cover
12*9880d681SAndroid Build Coastguard Worker // FILT-NEXT: ---
13*9880d681SAndroid Build Coastguard Worker // FILT-NEXT: _Z3foob           2     1  50.00%      4     2  50.00%
14*9880d681SAndroid Build Coastguard Worker // FILT-NEXT: _Z3barv           1     0 100.00%      2     0 100.00%
15*9880d681SAndroid Build Coastguard Worker // FILT-NEXT: _Z4funcv          1     1   0.00%      2     2   0.00%
16*9880d681SAndroid Build Coastguard Worker // FILT-NEXT: main              1     0 100.00%      5     0 100.00%
17*9880d681SAndroid Build Coastguard Worker // FILT-NEXT: ---
18*9880d681SAndroid Build Coastguard Worker // FILT-NEXT: TOTAL             5     2  60.00%     13     4  69.23%
19*9880d681SAndroid Build Coastguard Worker 
foo(bool cond)20*9880d681SAndroid Build Coastguard Worker void foo(bool cond) {
21*9880d681SAndroid Build Coastguard Worker   if (cond) {
22*9880d681SAndroid Build Coastguard Worker   }
23*9880d681SAndroid Build Coastguard Worker }
24*9880d681SAndroid Build Coastguard Worker 
bar()25*9880d681SAndroid Build Coastguard Worker void bar() {
26*9880d681SAndroid Build Coastguard Worker }
27*9880d681SAndroid Build Coastguard Worker 
func()28*9880d681SAndroid Build Coastguard Worker void func() {
29*9880d681SAndroid Build Coastguard Worker }
30*9880d681SAndroid Build Coastguard Worker 
main()31*9880d681SAndroid Build Coastguard Worker int main() {
32*9880d681SAndroid Build Coastguard Worker   foo(false);
33*9880d681SAndroid Build Coastguard Worker   bar();
34*9880d681SAndroid Build Coastguard Worker   return 0;
35*9880d681SAndroid Build Coastguard Worker }
36*9880d681SAndroid Build Coastguard Worker 
37*9880d681SAndroid Build Coastguard Worker // Test that listing multiple functions in a function view works.
38*9880d681SAndroid Build Coastguard Worker // RUN: llvm-cov show -o %t.dir %S/Inputs/report.covmapping -instr-profile=%S/Inputs/report.profdata -filename-equivalence -name-regex=".*" %s
39*9880d681SAndroid Build Coastguard Worker // RUN: FileCheck -check-prefix=FUNCTIONS -input-file %t.dir/functions.txt %s
40*9880d681SAndroid Build Coastguard Worker // FUNCTIONS: _Z3foob
41*9880d681SAndroid Build Coastguard Worker // FUNCTIONS: _Z3barv
42*9880d681SAndroid Build Coastguard Worker // FUNCTIONS: _Z4func
43