xref: /aosp_15_r20/external/llvm/test/tools/llvm-profdata/gcc-gcov-sample-profile.test (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard WorkerThe input gcov file has been generated on a little endian machine. Expect
2*9880d681SAndroid Build Coastguard Workerfailures on big endian systems.
3*9880d681SAndroid Build Coastguard Worker
4*9880d681SAndroid Build Coastguard WorkerXFAIL: powerpc64-, s390x, mips-, mips64-, sparc
5*9880d681SAndroid Build Coastguard Worker
6*9880d681SAndroid Build Coastguard WorkerTests for sample profiles encoded in GCC's gcov format.
7*9880d681SAndroid Build Coastguard Worker
8*9880d681SAndroid Build Coastguard Worker1- Show all functions. This profile has a single main() function with several
9*9880d681SAndroid Build Coastguard Worker   inlined callees.
10*9880d681SAndroid Build Coastguard WorkerRUN: llvm-profdata show --sample %p/Inputs/gcc-sample-profile.gcov | FileCheck %s --check-prefix=SHOW1
11*9880d681SAndroid Build Coastguard WorkerSHOW1: Function: main: 364084, 0, 6 sampled lines
12*9880d681SAndroid Build Coastguard WorkerSHOW1: 2.3: inlined callee: _Z3fool: 243786, 0, 3 sampled lines
13*9880d681SAndroid Build Coastguard WorkerSHOW1:   1.3: inlined callee: _Z3bari: 0, 0, 2 sampled lines
14*9880d681SAndroid Build Coastguard WorkerSHOW1:   1.7: inlined callee: _Z3bari: 98558, 0, 2 sampled lines
15*9880d681SAndroid Build Coastguard WorkerSHOW1:   1.8: inlined callee: _Z3bari: 0, 0, 2 sampled lines
16*9880d681SAndroid Build Coastguard Worker
17*9880d681SAndroid Build Coastguard Worker2- Convert the profile to text encoding and check that they are both
18*9880d681SAndroid Build Coastguard Worker   identical.
19*9880d681SAndroid Build Coastguard WorkerRUN: llvm-profdata merge --sample %p/Inputs/gcc-sample-profile.gcov --text -o - | llvm-profdata show --sample - -o %t-text
20*9880d681SAndroid Build Coastguard WorkerRUN: llvm-profdata show --sample %p/Inputs/gcc-sample-profile.gcov -o %t-gcov
21*9880d681SAndroid Build Coastguard WorkerRUN: diff %t-text %t-gcov
22*9880d681SAndroid Build Coastguard Worker
23*9880d681SAndroid Build Coastguard Worker4- Merge the gcov and text encodings of the profile and check that the
24*9880d681SAndroid Build Coastguard Worker   counters have doubled.
25*9880d681SAndroid Build Coastguard WorkerRUN: llvm-profdata merge --sample --text %p/Inputs/gcc-sample-profile.gcov -o %t-gcov
26*9880d681SAndroid Build Coastguard WorkerRUN: llvm-profdata merge --sample --text %p/Inputs/gcc-sample-profile.gcov %t-gcov -o - | FileCheck %s --check-prefix=MERGE1
27*9880d681SAndroid Build Coastguard WorkerMERGE1: main:728168:0
28*9880d681SAndroid Build Coastguard WorkerMERGE1: 2.3: 120298
29*9880d681SAndroid Build Coastguard WorkerMERGE1: 2.3: _Z3fool:487572
30