1 Tests for conversion between text and binary encoded sample profiles.
3 1- Encode the original profile into binary form. All the tests below will use
5 RUN: llvm-profdata merge --sample %p/Inputs/inline-samples.afdo -o %t.profbin
7 2- Show all functions. This profile has a single main() function with several
9 RUN: llvm-profdata show --sample %t.profbin | FileCheck %s --check-prefix=SHOW1
10 SHOW1: Function: main: 366846, 0, 6 sampled lines
11 SHOW1: 2.3: inlined callee: _Z3fool: 246044, 0, 3 sampled lines
12 SHOW1: 1.3: inlined callee: _Z3bari: 0, 0, 2 sampled lines
13 SHOW1: 1.7: inlined callee: _Z3bari: 99492, 0, 2 sampled lines
15 SHOW1: 1.8: inlined callee: _Z3bari: 0, 0, 2 sampled lines
17 3- Convert the binary profile to text encoding and check that they are both
19 RUN: llvm-profdata merge --sample %t.profbin --text -o - | llvm-profdata show --sample - -o %t-bintext
20 RUN: llvm-profdata show --sample %p/Inputs/inline-samples.afdo -o %t-text
21 RUN: diff %t-bintext %t-text
23 4- Merge the binary and text encodings of the profile and check that the
24 counters have doubled.
25 RUN: llvm-profdata merge --sample --text %t.profbin %p/Inputs/inline-samples.afdo -o - | FileCheck %s --check-prefix=MERGE1
26 RUN: llvm-profdata merge --sample --text - < %t.profbin %p/Inputs/inline-samples.afdo -o - | FileCheck %s --check-prefix=MERGE1
29 MERGE1: 2.3: _Z3fool:492088
30 MERGE1: 1.7: _Z3bari:198984