Test cleanup -- remove duplicate run lines
[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 -weighted-input=1,%p/Inputs/weight-sample-bar.proftext -weighted-input=1,%p/Inputs/weight-sample-foo.proftext -o - | FileCheck %s -check-prefix=1X_1X_WEIGHT
5 RUN: llvm-profdata merge -sample -text -weighted-input=1,%p/Inputs/weight-sample-bar.proftext %p/Inputs/weight-sample-foo.proftext -o - | FileCheck %s -check-prefix=1X_1X_WEIGHT
6 1X_1X_WEIGHT: foo:1763288:35327
7 1X_1X_WEIGHT-NEXT:  7: 35327
8 1X_1X_WEIGHT-NEXT:  8: 35327
9 1X_1X_WEIGHT-NEXT:  9: 6930
10 1X_1X_WEIGHT-NEXT:  10: 29341
11 1X_1X_WEIGHT-NEXT:  11: 11906
12 1X_1X_WEIGHT-NEXT:  13: 18185 foo:19531
13 1X_1X_WEIGHT-NEXT:  15: 36458
14 1X_1X_WEIGHT-NEXT: bar:1772037:35370
15 1X_1X_WEIGHT-NEXT:  17: 35370
16 1X_1X_WEIGHT-NEXT:  18: 35370
17 1X_1X_WEIGHT-NEXT:  19: 7005
18 1X_1X_WEIGHT-NEXT:  20: 29407
19 1X_1X_WEIGHT-NEXT:  21: 12170
20 1X_1X_WEIGHT-NEXT:  23: 18150 bar:19829
21 1X_1X_WEIGHT-NEXT:  25: 36666
22
23 2- Merge the foo and bar profiles with weight 3x and 5x respectively and verify the combined output
24 RUN: llvm-profdata merge -sample -text -weighted-input=3,%p/Inputs/weight-sample-bar.proftext -weighted-input=5,%p/Inputs/weight-sample-foo.proftext -o - | FileCheck %s -check-prefix=3X_5X_WEIGHT
25 3X_5X_WEIGHT: foo:8816440:176635
26 3X_5X_WEIGHT-NEXT:  7: 176635
27 3X_5X_WEIGHT-NEXT:  8: 176635
28 3X_5X_WEIGHT-NEXT:  9: 34650
29 3X_5X_WEIGHT-NEXT:  10: 146705
30 3X_5X_WEIGHT-NEXT:  11: 59530
31 3X_5X_WEIGHT-NEXT:  13: 90925 foo:97655
32 3X_5X_WEIGHT-NEXT:  15: 182290
33 3X_5X_WEIGHT-NEXT: bar:5316111:106110
34 3X_5X_WEIGHT-NEXT:  17: 106110
35 3X_5X_WEIGHT-NEXT:  18: 106110
36 3X_5X_WEIGHT-NEXT:  19: 21015
37 3X_5X_WEIGHT-NEXT:  20: 88221
38 3X_5X_WEIGHT-NEXT:  21: 36510
39 3X_5X_WEIGHT-NEXT:  23: 54450 bar:59487
40 3X_5X_WEIGHT-NEXT:  25: 109998
41
42 3- Bad merge: invalid weight
43 RUN: not llvm-profdata merge -sample -weighted-input=3,%p/Inputs/weight-sample-bar.proftext -weighted-input=0,%p/Inputs/weight-sample-foo.proftext -o %t.out 2>&1 | FileCheck %s -check-prefix=INVALID_WEIGHT
44 RUN: not llvm-profdata merge -sample -weighted-input=3,%p/Inputs/weight-sample-bar.proftext -weighted-input=0.75,%p/Inputs/weight-sample-foo.proftext -o %t.out 2>&1 | FileCheck %s -check-prefix=INVALID_WEIGHT
45 RUN: not llvm-profdata merge -sample -weighted-input=3,%p/Inputs/weight-sample-bar.proftext -weighted-input=-5,%p/Inputs/weight-sample-foo.proftext -o %t.out 2>&1 | FileCheck %s -check-prefix=INVALID_WEIGHT
46 RUN: not llvm-profdata merge -sample -weighted-input=3,%p/Inputs/weight-sample-bar.proftext -weighted-input=,%p/Inputs/weight-sample-foo.proftext -o %t.out 2>&1 | FileCheck %s -check-prefix=INVALID_WEIGHT
47 RUN: not llvm-profdata merge -sample -weighted-input=3,%p/Inputs/weight-sample-bar.proftext -weighted-input=%p/Inputs/weight-sample-foo.proftext -o %t.out 2>&1 | FileCheck %s -check-prefix=INVALID_WEIGHT
48 INVALID_WEIGHT: error: Input weight must be a positive integer.
49
50 4- Bad merge: input path does not exist
51 RUN: not llvm-profdata merge -sample -weighted-input=3,%p/Inputs/does-not-exist.proftext -weighted-input=2,%p/Inputs/does-not-exist-either.proftext -o %t.out 2>&1 | FileCheck %s -check-prefix=INVALID_INPUT
52 INVALID_INPUT: {{.*}}: {{.*}}does-not-exist.proftext: {{[Nn]}}o such file or directory
53
54 5- No inputs
55 RUN: not llvm-profdata merge -sample -o %t.out 2>&1 | FileCheck %s -check-prefix=NO_INPUT
56 NO_INPUT: {{.*}}: No input files specified. See llvm-profdata{{(\.EXE|\.exe)?}} merge -help