[libFuzzer] fix 32-bit build
[oota-llvm.git] / test / tools / llvm-profdata / gcc-gcov-sample-profile.test
1 Tests for sample profiles encoded in GCC's gcov format.
2
3 1- Show all functions. This profile has a single main() function with several
4    inlined callees.
5 RUN: llvm-profdata show --sample %p/Inputs/gcc-sample-profile.gcov | FileCheck %s --check-prefix=SHOW1
6 SHOW1: Function: main: 364084, 0, 6 sampled lines
7 SHOW1: line offset: 2, discriminator: 3, inlined callee: _Z3fool: 243786, 0, 3 sampled lines
8 SHOW1:   line offset: 1, discriminator: 3, inlined callee: _Z3bari: 0, 0, 2 sampled lines
9 SHOW1:   line offset: 1, discriminator: 8, inlined callee: _Z3bari: 0, 0, 2 sampled lines
10 SHOW1:   line offset: 1, discriminator: 7, inlined callee: _Z3bari: 98558, 0, 2 sampled lines
11
12 2- Convert the profile to text encoding and check that they are both
13    identical.
14 RUN: llvm-profdata merge --sample %p/Inputs/gcc-sample-profile.gcov --text -o - | llvm-profdata show --sample - -o %t-text
15 RUN: llvm-profdata show --sample %p/Inputs/gcc-sample-profile.gcov -o %t-gcov
16 RUN: diff %t-text %t-gcov
17
18 4- Merge the gcov and text encodings of the profile and check that the
19    counters have doubled.
20 RUN: llvm-profdata merge --sample --text %p/Inputs/gcc-sample-profile.gcov -o %t-gcov
21 RUN: llvm-profdata merge --sample --text %p/Inputs/gcc-sample-profile.gcov %t-gcov -o - | FileCheck %s --check-prefix=MERGE1
22 MERGE1: main:728168:0
23 MERGE1: 2.3: 120298
24 MERGE1: 2.3: _Z3fool:487572