git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254686 91177308-0d34-0410...
[oota-llvm.git] / test / tools / llvm-profdata / weight-sample.test
1 Tests for weighted merge of sample profiles.
2
3 1- Merge the foo and bar profiles with unity weight and verify the combined output
4 RUN: llvm-profdata merge --sample --text %p/Inputs/weight-sample-bar.proftext:1 %p/Inputs/weight-sample-foo.proftext:1 -o - | FileCheck %s --check-prefix=WEIGHT1
5 WEIGHT1: foo:1763288:35327
6 WEIGHT1:  7: 35327
7 WEIGHT1:  8: 35327
8 WEIGHT1:  9: 6930
9 WEIGHT1:  10: 29341
10 WEIGHT1:  11: 11906
11 WEIGHT1:  13: 18185 foo:19531
12 WEIGHT1:  15: 36458
13 WEIGHT1: bar:1772037:35370
14 WEIGHT1:  17: 35370
15 WEIGHT1:  18: 35370
16 WEIGHT1:  19: 7005
17 WEIGHT1:  20: 29407
18 WEIGHT1:  21: 12170
19 WEIGHT1:  23: 18150 bar:19829
20 WEIGHT1:  25: 36666
21
22 2- Merge the foo and bar profiles with weight 3x and 5x respectively and verify the combined output
23 RUN: llvm-profdata merge --sample --text %p/Inputs/weight-sample-bar.proftext:3 %p/Inputs/weight-sample-foo.proftext:5 -o - | FileCheck %s --check-prefix=WEIGHT2
24 WEIGHT2: foo:8816440:176635
25 WEIGHT2:  7: 176635
26 WEIGHT2:  8: 176635
27 WEIGHT2:  9: 34650
28 WEIGHT2:  10: 146705
29 WEIGHT2:  11: 59530
30 WEIGHT2:  13: 90925 foo:97655
31 WEIGHT2:  15: 182290
32 WEIGHT2: bar:5316111:106110
33 WEIGHT2:  17: 106110
34 WEIGHT2:  18: 106110
35 WEIGHT2:  19: 21015
36 WEIGHT2:  20: 88221
37 WEIGHT2:  21: 36510
38 WEIGHT2:  23: 54450 bar:59487
39 WEIGHT2:  25: 109998
40
41 3- Bad merge: foo and bar profiles with invalid weights
42 RUN: not llvm-profdata merge --sample --text %p/Inputs/weight-sample-bar.proftext:3 %p/Inputs/weight-sample-foo.proftext:-5 -o %t.out 2>&1 | FileCheck %s --check-prefix=ERROR3
43 ERROR3: error: Input weight must be a positive integer.