Nathan Slingerland | 7f5b47d | 2015-12-15 17:37:09 +0000 | [diff] [blame] | 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 |
Vedant Kumar | 7f5b3d6 | 2017-04-26 15:39:53 +0000 | [diff] [blame] | 6 | 1X_1X_WEIGHT-DAG: foo:1763288:35327 |
| 7 | 1X_1X_WEIGHT-DAG: 7: 35327 |
| 8 | 1X_1X_WEIGHT-DAG: 8: 35327 |
| 9 | 1X_1X_WEIGHT-DAG: 9: 6930 |
| 10 | 1X_1X_WEIGHT-DAG: 10: 29341 |
| 11 | 1X_1X_WEIGHT-DAG: 11: 11906 |
| 12 | 1X_1X_WEIGHT-DAG: 13: 18185 foo:19531 |
| 13 | 1X_1X_WEIGHT-DAG: 15: 36458 |
| 14 | 1X_1X_WEIGHT-DAG: bar:1772037:35370 |
| 15 | 1X_1X_WEIGHT-DAG: 17: 35370 |
| 16 | 1X_1X_WEIGHT-DAG: 18: 35370 |
| 17 | 1X_1X_WEIGHT-DAG: 19: 7005 |
| 18 | 1X_1X_WEIGHT-DAG: 20: 29407 |
| 19 | 1X_1X_WEIGHT-DAG: 21: 12170 |
| 20 | 1X_1X_WEIGHT-DAG: 23: 18150 bar:19829 |
| 21 | 1X_1X_WEIGHT-DAG: 25: 36666 |
Nathan Slingerland | 7f5b47d | 2015-12-15 17:37:09 +0000 | [diff] [blame] | 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 |
Vedant Kumar | 7f5b3d6 | 2017-04-26 15:39:53 +0000 | [diff] [blame] | 25 | 3X_5X_WEIGHT-DAG: foo:8816440:176635 |
| 26 | 3X_5X_WEIGHT-DAG: 7: 176635 |
| 27 | 3X_5X_WEIGHT-DAG: 8: 176635 |
| 28 | 3X_5X_WEIGHT-DAG: 9: 34650 |
| 29 | 3X_5X_WEIGHT-DAG: 10: 146705 |
| 30 | 3X_5X_WEIGHT-DAG: 11: 59530 |
| 31 | 3X_5X_WEIGHT-DAG: 13: 90925 foo:97655 |
| 32 | 3X_5X_WEIGHT-DAG: 15: 182290 |
| 33 | 3X_5X_WEIGHT-DAG: bar:5316111:106110 |
| 34 | 3X_5X_WEIGHT-DAG: 17: 106110 |
| 35 | 3X_5X_WEIGHT-DAG: 18: 106110 |
| 36 | 3X_5X_WEIGHT-DAG: 19: 21015 |
| 37 | 3X_5X_WEIGHT-DAG: 20: 88221 |
| 38 | 3X_5X_WEIGHT-DAG: 21: 36510 |
| 39 | 3X_5X_WEIGHT-DAG: 23: 54450 bar:59487 |
| 40 | 3X_5X_WEIGHT-DAG: 25: 109998 |
Nathan Slingerland | 7f5b47d | 2015-12-15 17:37:09 +0000 | [diff] [blame] | 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 |