File: weight-sample.test

package info (click to toggle)
llvm-toolchain-3.9 1%3A3.9.1-8
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 441,060 kB
  • ctags: 428,777
  • sloc: cpp: 2,546,577; ansic: 538,318; asm: 119,677; objc: 103,316; python: 102,148; sh: 27,847; pascal: 5,626; ml: 5,510; perl: 5,293; lisp: 4,801; makefile: 2,177; xml: 686; cs: 362; php: 212; csh: 117
file content (56 lines) | stat: -rw-r--r-- 3,474 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
Tests for weighted merge of sample profiles.

1- Merge the foo and bar profiles with unity weight and verify the combined output
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
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
1X_1X_WEIGHT: foo:1763288:35327
1X_1X_WEIGHT-NEXT:  7: 35327
1X_1X_WEIGHT-NEXT:  8: 35327
1X_1X_WEIGHT-NEXT:  9: 6930
1X_1X_WEIGHT-NEXT:  10: 29341
1X_1X_WEIGHT-NEXT:  11: 11906
1X_1X_WEIGHT-NEXT:  13: 18185 foo:19531
1X_1X_WEIGHT-NEXT:  15: 36458
1X_1X_WEIGHT-NEXT: bar:1772037:35370
1X_1X_WEIGHT-NEXT:  17: 35370
1X_1X_WEIGHT-NEXT:  18: 35370
1X_1X_WEIGHT-NEXT:  19: 7005
1X_1X_WEIGHT-NEXT:  20: 29407
1X_1X_WEIGHT-NEXT:  21: 12170
1X_1X_WEIGHT-NEXT:  23: 18150 bar:19829
1X_1X_WEIGHT-NEXT:  25: 36666

2- Merge the foo and bar profiles with weight 3x and 5x respectively and verify the combined output
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
3X_5X_WEIGHT: foo:8816440:176635
3X_5X_WEIGHT-NEXT:  7: 176635
3X_5X_WEIGHT-NEXT:  8: 176635
3X_5X_WEIGHT-NEXT:  9: 34650
3X_5X_WEIGHT-NEXT:  10: 146705
3X_5X_WEIGHT-NEXT:  11: 59530
3X_5X_WEIGHT-NEXT:  13: 90925 foo:97655
3X_5X_WEIGHT-NEXT:  15: 182290
3X_5X_WEIGHT-NEXT: bar:5316111:106110
3X_5X_WEIGHT-NEXT:  17: 106110
3X_5X_WEIGHT-NEXT:  18: 106110
3X_5X_WEIGHT-NEXT:  19: 21015
3X_5X_WEIGHT-NEXT:  20: 88221
3X_5X_WEIGHT-NEXT:  21: 36510
3X_5X_WEIGHT-NEXT:  23: 54450 bar:59487
3X_5X_WEIGHT-NEXT:  25: 109998

3- Bad merge: invalid weight
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
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
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
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
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
INVALID_WEIGHT: error: Input weight must be a positive integer.

4- Bad merge: input path does not exist
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
INVALID_INPUT: {{.*}}: {{.*}}does-not-exist.proftext: {{[Nn]}}o such file or directory

5- No inputs
RUN: not llvm-profdata merge -sample -o %t.out 2>&1 | FileCheck %s -check-prefix=NO_INPUT
NO_INPUT: {{.*}}: No input files specified. See llvm-profdata{{(\.EXE|\.exe)?}} merge -help