diff options
Diffstat (limited to 'test/tools/llvm-profdata')
29 files changed, 299 insertions, 129 deletions
diff --git a/test/tools/llvm-profdata/Inputs/bad-hash.profdata b/test/tools/llvm-profdata/Inputs/bad-hash.proftext index faa6f40152..faa6f40152 100644 --- a/test/tools/llvm-profdata/Inputs/bad-hash.profdata +++ b/test/tools/llvm-profdata/Inputs/bad-hash.proftext diff --git a/test/tools/llvm-profdata/Inputs/bar3-1.profdata b/test/tools/llvm-profdata/Inputs/bar3-1.proftext index 5486e9d84d..5486e9d84d 100644 --- a/test/tools/llvm-profdata/Inputs/bar3-1.profdata +++ b/test/tools/llvm-profdata/Inputs/bar3-1.proftext diff --git a/test/tools/llvm-profdata/Inputs/c-general.profdata b/test/tools/llvm-profdata/Inputs/c-general.profraw Binary files differindex e8cef21de5..e8cef21de5 100644 --- a/test/tools/llvm-profdata/Inputs/c-general.profdata +++ b/test/tools/llvm-profdata/Inputs/c-general.profraw diff --git a/test/tools/llvm-profdata/Inputs/compat.profdata.v1 b/test/tools/llvm-profdata/Inputs/compat.profdata.v1 Binary files differnew file mode 100644 index 0000000000..fd17459d09 --- /dev/null +++ b/test/tools/llvm-profdata/Inputs/compat.profdata.v1 diff --git a/test/tools/llvm-profdata/Inputs/empty.profdata b/test/tools/llvm-profdata/Inputs/empty.proftext index e69de29bb2..e69de29bb2 100644 --- a/test/tools/llvm-profdata/Inputs/empty.profdata +++ b/test/tools/llvm-profdata/Inputs/empty.proftext diff --git a/test/tools/llvm-profdata/Inputs/extra-word.profdata b/test/tools/llvm-profdata/Inputs/extra-word.proftext index 67a662909c..67a662909c 100644 --- a/test/tools/llvm-profdata/Inputs/extra-word.profdata +++ b/test/tools/llvm-profdata/Inputs/extra-word.proftext diff --git a/test/tools/llvm-profdata/Inputs/foo3-1.profdata b/test/tools/llvm-profdata/Inputs/foo3-1.proftext index 14a6200435..14a6200435 100644 --- a/test/tools/llvm-profdata/Inputs/foo3-1.profdata +++ b/test/tools/llvm-profdata/Inputs/foo3-1.proftext diff --git a/test/tools/llvm-profdata/Inputs/foo3-2.profdata b/test/tools/llvm-profdata/Inputs/foo3-2.proftext index 801846e440..801846e440 100644 --- a/test/tools/llvm-profdata/Inputs/foo3-2.profdata +++ b/test/tools/llvm-profdata/Inputs/foo3-2.proftext diff --git a/test/tools/llvm-profdata/Inputs/foo3bar3-1.profdata b/test/tools/llvm-profdata/Inputs/foo3bar3-1.proftext index 12157b9f9a..12157b9f9a 100644 --- a/test/tools/llvm-profdata/Inputs/foo3bar3-1.profdata +++ b/test/tools/llvm-profdata/Inputs/foo3bar3-1.proftext diff --git a/test/tools/llvm-profdata/Inputs/foo3bar3-2.profdata b/test/tools/llvm-profdata/Inputs/foo3bar3-2.profdata deleted file mode 100644 index f1f10bd6f3..0000000000 --- a/test/tools/llvm-profdata/Inputs/foo3bar3-2.profdata +++ /dev/null @@ -1,13 +0,0 @@ -foo -3 -3 -17 -19 -23 - -bar -3 -3 -29 -31 -37 diff --git a/test/tools/llvm-profdata/Inputs/foo4-1.profdata b/test/tools/llvm-profdata/Inputs/foo4-1.profdata deleted file mode 100644 index 31d2a2ce75..0000000000 --- a/test/tools/llvm-profdata/Inputs/foo4-1.profdata +++ /dev/null @@ -1,7 +0,0 @@ -foo -4 -4 -11 -22 -33 -44 diff --git a/test/tools/llvm-profdata/Inputs/foo4-2.profdata b/test/tools/llvm-profdata/Inputs/foo4-2.profdata deleted file mode 100644 index 01d8309b5c..0000000000 --- a/test/tools/llvm-profdata/Inputs/foo4-2.profdata +++ /dev/null @@ -1,7 +0,0 @@ -foo -4 -4 -7 -6 -5 -4 diff --git a/test/tools/llvm-profdata/Inputs/invalid-count-later.profdata b/test/tools/llvm-profdata/Inputs/invalid-count-later.proftext index 2b61c55a67..2b61c55a67 100644 --- a/test/tools/llvm-profdata/Inputs/invalid-count-later.profdata +++ b/test/tools/llvm-profdata/Inputs/invalid-count-later.proftext diff --git a/test/tools/llvm-profdata/Inputs/no-counts.profdata b/test/tools/llvm-profdata/Inputs/no-counts.proftext index 5c1fa15c08..5c1fa15c08 100644 --- a/test/tools/llvm-profdata/Inputs/no-counts.profdata +++ b/test/tools/llvm-profdata/Inputs/no-counts.proftext diff --git a/test/tools/llvm-profdata/Inputs/overflow.profdata b/test/tools/llvm-profdata/Inputs/overflow.profdata deleted file mode 100644 index c9a9d697ec..0000000000 --- a/test/tools/llvm-profdata/Inputs/overflow.profdata +++ /dev/null @@ -1,4 +0,0 @@ -overflow -1 -1 -9223372036854775808 diff --git a/test/tools/llvm-profdata/Inputs/sample-profile.proftext b/test/tools/llvm-profdata/Inputs/sample-profile.proftext new file mode 100644 index 0000000000..9dc6d4310d --- /dev/null +++ b/test/tools/llvm-profdata/Inputs/sample-profile.proftext @@ -0,0 +1,12 @@ +_Z3bari:20301:1437 +1: 1437 +_Z3fooi:7711:610 +1: 610 +main:184019:0 +4: 534 +4.2: 534 +5: 1075 +5.1: 1075 +6: 2080 +7: 534 +9: 2064 _Z3bari:1471 _Z3fooi:631 diff --git a/test/tools/llvm-profdata/c-general.test b/test/tools/llvm-profdata/c-general.test index 9b6cd7f482..01435303d4 100644 --- a/test/tools/llvm-profdata/c-general.test +++ b/test/tools/llvm-profdata/c-general.test @@ -7,10 +7,10 @@ REGENERATE: $ CFE=$SRC/tools/clang REGENERATE: $ TESTDIR=$SRC/test/tools/llvm-profdata REGENERATE: $ CFE_TESTDIR=$CFE/test/Profile REGENERATE: $ clang -o a.out -fprofile-instr-generate $CFE_TESTDIR/test/Profile/c-general.c -REGENERATE: $ LLVM_PROFILE_FILE=$TESTDIR/Inputs/c-general.profdata ./a.out +REGENERATE: $ LLVM_PROFILE_FILE=$TESTDIR/Inputs/c-general.profraw ./a.out -RUN: llvm-profdata show %p/Inputs/c-general.profdata -o - | FileCheck %s -check-prefix=CHECK -RUN: llvm-profdata show %p/Inputs/c-general.profdata -o - --function=switches | FileCheck %s -check-prefix=SWITCHES -check-prefix=CHECK +RUN: llvm-profdata show %p/Inputs/c-general.profraw -o - | FileCheck %s -check-prefix=CHECK +RUN: llvm-profdata show %p/Inputs/c-general.profraw -o - --function=switches | FileCheck %s -check-prefix=SWITCHES -check-prefix=CHECK SWITCHES-LABEL: Counters: SWITCHES-NEXT: switches: diff --git a/test/tools/llvm-profdata/compat.proftext b/test/tools/llvm-profdata/compat.proftext new file mode 100644 index 0000000000..14da3374b5 --- /dev/null +++ b/test/tools/llvm-profdata/compat.proftext @@ -0,0 +1,47 @@ +# Compatibility tests for older profile format versions. These ensure +# that we don't break compatibility with an older profile version +# without noticing it. + +# The input file at %S/Inputs/compat.profdata.v1 was generated with +# llvm-profdata merge from r214548. + +# RUN: llvm-profdata show %S/Inputs/compat.profdata.v1 --function function_count_only --counts | FileCheck %s -check-prefix=FUNC_COUNT_ONLY +function_count_only +0 +1 +97531 +# FUNC_COUNT_ONLY: Hash: 0x{{0+$}} +# FUNC_COUNT_ONLY-NEXT: Counters: 1 +# FUNC_COUNT_ONLY-NEXT: Function count: 97531 +# FUNC_COUNT_ONLY-NEXT: Block counts: [] + +# RUN: llvm-profdata show %S/Inputs/compat.profdata.v1 --function "name with spaces" --counts | FileCheck %s -check-prefix=SPACES +name with spaces +1024 +2 +0 +0 +# SPACES: Hash: 0x{{0+}}400 +# SPACES-NEXT: Counters: 2 +# SPACES-NEXT: Function count: 0 +# SPACES-NEXT: Block counts: [0] + +# RUN: llvm-profdata show %S/Inputs/compat.profdata.v1 --function large_numbers --counts | FileCheck %s -check-prefix=LARGENUM +large_numbers +4611686018427387903 +6 +2305843009213693952 +1152921504606846976 +576460752303423488 +288230376151711744 +144115188075855872 +72057594037927936 +# LARGENUM: Hash: 0x3fffffffffffffff +# LARGENUM-NEXT: Counters: 6 +# LARGENUM-NEXT: Function count: 2305843009213693952 +# LARGENUM-NEXT: Block counts: [1152921504606846976, 576460752303423488, 288230376151711744, 144115188075855872, 72057594037927936] + +# RUN: llvm-profdata show %S/Inputs/compat.profdata.v1 | FileCheck %s -check-prefix=SUMMARY +# SUMMARY: Total functions: 3 +# SUMMARY: Maximum function count: 2305843009213693952 +# SUMMARY: Maximum internal block count: 1152921504606846976 diff --git a/test/tools/llvm-profdata/count-mismatch.proftext b/test/tools/llvm-profdata/count-mismatch.proftext new file mode 100644 index 0000000000..1a2e73fbff --- /dev/null +++ b/test/tools/llvm-profdata/count-mismatch.proftext @@ -0,0 +1,40 @@ +# Make sure we don't try to combine counters with the same function +# name and a matching hash if the number of counters differs + +# RUN: llvm-profdata merge %s -o %t.profdata 2>&1 | FileCheck -check-prefix=MERGE_ERRS %s +# RUN: llvm-profdata show %t.profdata -all-functions -counts > %t.out +# RUN: FileCheck %s -input-file %t.out +foo +1024 +4 +1 +2 +4 +8 + +# The hash matches, but we can't combine these because the number of +# counters differs. +# MERGE_ERRS: count-mismatch.proftext: foo: Function count mismatch +foo +1024 +3 +2 +4 +8 + +# This one does match, so it should combine with the first just fine. +# CHECK: Hash: 0x{{0+}}400 +# CHECK-NEXT: Counters: 4 +# CHECK-NEXT: Function count: 5 +# CHECK-NEXT: Block counts: [10, 20, 40] +foo +1024 +4 +4 +8 +16 +32 + +# CHECK: Total functions: 1 +# CHECK: Maximum function count: 5 +# CHECK: Maximum internal block count: 40 diff --git a/test/tools/llvm-profdata/errors.test b/test/tools/llvm-profdata/errors.test deleted file mode 100644 index 28262efe06..0000000000 --- a/test/tools/llvm-profdata/errors.test +++ /dev/null @@ -1,16 +0,0 @@ -RUN: llvm-profdata merge %p/Inputs/foo3-1.profdata %p/Inputs/foo4-1.profdata -o %t.out 2>&1 | FileCheck %s --check-prefix=HASH -HASH: foo4-1.profdata: foo: Function hash mismatch - -RUN: llvm-profdata merge %p/Inputs/overflow.profdata %p/Inputs/overflow.profdata -o %t.out 2>&1 | FileCheck %s --check-prefix=OVERFLOW -OVERFLOW: overflow.profdata: overflow: Counter overflow - -RUN: not llvm-profdata show %p/Inputs/invalid-count-later.profdata 2>&1 | FileCheck %s --check-prefix=INVALID-COUNT-LATER -RUN: not llvm-profdata merge %p/Inputs/invalid-count-later.profdata %p/Inputs/invalid-count-later.profdata -o %t.out 2>&1 | FileCheck %s --check-prefix=INVALID-COUNT-LATER -INVALID-COUNT-LATER: error: {{.*}}invalid-count-later.profdata: Malformed profile data - -RUN: not llvm-profdata show %p/Inputs/bad-hash.profdata 2>&1 | FileCheck %s --check-prefix=BAD-HASH -RUN: not llvm-profdata merge %p/Inputs/bad-hash.profdata %p/Inputs/bad-hash.profdata -o %t.out 2>&1 | FileCheck %s --check-prefix=BAD-HASH -BAD-HASH: error: {{.*}}bad-hash.profdata: Malformed profile data - -RUN: not llvm-profdata show %p/Inputs/no-counts.profdata 2>&1 | FileCheck %s --check-prefix=NO-COUNTS -NO-COUNTS: error: {{.*}}no-counts.profdata: Malformed profile data diff --git a/test/tools/llvm-profdata/general.proftext b/test/tools/llvm-profdata/general.proftext new file mode 100644 index 0000000000..591d2628d7 --- /dev/null +++ b/test/tools/llvm-profdata/general.proftext @@ -0,0 +1,56 @@ + + +# RUN: llvm-profdata merge %s -o %t.profdata + +# RUN: llvm-profdata show %t.profdata --function function_count_only --counts | FileCheck %s -check-prefix=FUNC_COUNT_ONLY +function_count_only +0 +1 +97531 +# FUNC_COUNT_ONLY: Hash: 0x{{0+$}} +# FUNC_COUNT_ONLY-NEXT: Counters: 1 +# FUNC_COUNT_ONLY-NEXT: Function count: 97531 +# FUNC_COUNT_ONLY-NEXT: Block counts: [] + +# RUN: llvm-profdata show %t.profdata --function "name with spaces" --counts | FileCheck %s -check-prefix=SPACES +name with spaces +1024 +2 +0 +0 +# SPACES: Hash: 0x{{0+}}400 +# SPACES-NEXT: Counters: 2 +# SPACES-NEXT: Function count: 0 +# SPACES-NEXT: Block counts: [0] + +# RUN: llvm-profdata show %t.profdata --function large_numbers --counts | FileCheck %s -check-prefix=LARGENUM +large_numbers +4611686018427387903 +6 +2305843009213693952 +1152921504606846976 +576460752303423488 +288230376151711744 +144115188075855872 +72057594037927936 +# LARGENUM: Hash: 0x3fffffffffffffff +# LARGENUM-NEXT: Counters: 6 +# LARGENUM-NEXT: Function count: 2305843009213693952 +# LARGENUM-NEXT: Block counts: [1152921504606846976, 576460752303423488, 288230376151711744, 144115188075855872, 72057594037927936] + +# RUN: llvm-profdata show %t.profdata --function NOSUCHFUNC | FileCheck %s -check-prefix=NOSUCHFUNC +# NOSUCHFUNC-NOT: Counters: +# NOSUCHFUNC: Functions shown: 0 + +# RUN: llvm-profdata show %t.profdata --function _ | FileCheck %s -check-prefix=SOMEFUNCS +# SOMEFUNCS: Counters: +# SOMEFUNCS: function_count_only: +# SOMEFUNCS: large_numbers: +# SOMEFUNCS: Functions shown: 2 + +# RUN: llvm-profdata show %t.profdata | FileCheck %s -check-prefix=SUMMARY +# SUMMARY-NOT: Counters: +# SUMMARY-NOT: Functions shown: +# SUMMARY: Total functions: 3 +# SUMMARY: Maximum function count: 2305843009213693952 +# SUMMARY: Maximum internal block count: 1152921504606846976 diff --git a/test/tools/llvm-profdata/hash-mismatch.proftext b/test/tools/llvm-profdata/hash-mismatch.proftext new file mode 100644 index 0000000000..fe0d4fb4f6 --- /dev/null +++ b/test/tools/llvm-profdata/hash-mismatch.proftext @@ -0,0 +1,37 @@ +# If we see the same function name, but with different hashes, make +# sure we keep both. + +# RUN: llvm-profdata merge %s -o %t 2>&1 +# RUN: llvm-profdata show %t -all-functions -counts > %t.out + +# The function ordering is non-deterministic, so we need to do our +# checks in multiple runs. +# RUN: FileCheck -check-prefix=FOO3 -check-prefix=BOTH %s -input-file %t.out +# RUN: FileCheck -check-prefix=FOO4 -check-prefix=BOTH %s -input-file %t.out + +# FOO3: Hash: 0x{{0+}}3 +# FOO3-NEXT: Counters: 3 +# FOO3-NEXT: Function count: 1 +# FOO3-NEXT: Block counts: [2, 3] +foo +3 +3 +1 +2 +3 + +# FOO4: Hash: 0x{{0+}}4 +# FOO4-NEXT: Counters: 4 +# FOO4-NEXT: Function count: 11 +# FOO4-NEXT: Block counts: [22, 33, 44] +foo +4 +4 +11 +22 +33 +44 + +# BOTH: Total functions: 2 +# BOTH: Maximum function count: 11 +# BOTH: Maximum internal block count: 44 diff --git a/test/tools/llvm-profdata/lit.local.cfg b/test/tools/llvm-profdata/lit.local.cfg new file mode 100644 index 0000000000..d44913a823 --- /dev/null +++ b/test/tools/llvm-profdata/lit.local.cfg @@ -0,0 +1 @@ +config.suffixes.add('.proftext') diff --git a/test/tools/llvm-profdata/multiple-inputs.test b/test/tools/llvm-profdata/multiple-inputs.test new file mode 100644 index 0000000000..616efe92bb --- /dev/null +++ b/test/tools/llvm-profdata/multiple-inputs.test @@ -0,0 +1,51 @@ +Some very basic tests for the multiple input cases. + +RUN: llvm-profdata merge %p/Inputs/foo3-1.proftext %p/Inputs/foo3-2.proftext -o %t +RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefix=FOO3 +RUN: llvm-profdata merge %p/Inputs/foo3-2.proftext %p/Inputs/foo3-1.proftext -o %t +RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefix=FOO3 +FOO3: foo: +FOO3: Counters: 3 +FOO3: Function count: 8 +FOO3: Block counts: [7, 6] +FOO3: Total functions: 1 +FOO3: Maximum function count: 8 +FOO3: Maximum internal block count: 7 + +RUN: llvm-profdata merge %p/Inputs/empty.proftext %p/Inputs/foo3-1.proftext -o %t +RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefix=FOO3EMPTY +FOO3EMPTY: foo: +FOO3EMPTY: Counters: 3 +FOO3EMPTY: Function count: 1 +FOO3EMPTY: Block counts: [2, 3] +FOO3EMPTY: Total functions: 1 +FOO3EMPTY: Maximum function count: 1 +FOO3EMPTY: Maximum internal block count: 3 + +RUN: llvm-profdata merge %p/Inputs/foo3-1.proftext %p/Inputs/foo3bar3-1.proftext -o %t +RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefix=FOO3FOO3BAR3 +FOO3FOO3BAR3: foo: +FOO3FOO3BAR3: Counters: 3 +FOO3FOO3BAR3: Function count: 3 +FOO3FOO3BAR3: Block counts: [5, 8] +FOO3FOO3BAR3: bar: +FOO3FOO3BAR3: Counters: 3 +FOO3FOO3BAR3: Function count: 7 +FOO3FOO3BAR3: Block counts: [11, 13] +FOO3FOO3BAR3: Total functions: 2 +FOO3FOO3BAR3: Maximum function count: 7 +FOO3FOO3BAR3: Maximum internal block count: 13 + +RUN: llvm-profdata merge %p/Inputs/foo3-1.proftext %p/Inputs/bar3-1.proftext -o %t +RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefix=DISJOINT +DISJOINT: foo: +DISJOINT: Counters: 3 +DISJOINT: Function count: 1 +DISJOINT: Block counts: [2, 3] +DISJOINT: bar: +DISJOINT: Counters: 3 +DISJOINT: Function count: 1 +DISJOINT: Block counts: [2, 3] +DISJOINT: Total functions: 2 +DISJOINT: Maximum function count: 1 +DISJOINT: Maximum internal block count: 3 diff --git a/test/tools/llvm-profdata/overflow.proftext b/test/tools/llvm-profdata/overflow.proftext new file mode 100644 index 0000000000..cbf3bf1618 --- /dev/null +++ b/test/tools/llvm-profdata/overflow.proftext @@ -0,0 +1,12 @@ +# RUN: llvm-profdata merge %s -o %t.out 2>&1 | FileCheck %s +# CHECK: overflow.proftext: overflow: Counter overflow + +overflow +1 +1 +9223372036854775808 + +overflow +1 +1 +9223372036854775808 diff --git a/test/tools/llvm-profdata/raw-two-profiles.test b/test/tools/llvm-profdata/raw-two-profiles.test index 3260836ba6..be78793215 100644 --- a/test/tools/llvm-profdata/raw-two-profiles.test +++ b/test/tools/llvm-profdata/raw-two-profiles.test @@ -39,11 +39,9 @@ RUN: printf '\0\0\0\0\0' >> %t-foo-padded.profraw RUN: cat %t-bar.profraw > %t-bar-padded.profraw RUN: printf '\0\0\0\0\0' >> %t-bar-padded.profraw -RUN: cat %t-foo.profraw %t-bar.profraw > %t-nopad.profraw RUN: cat %t-foo-padded.profraw %t-bar.profraw > %t-pad-between.profraw RUN: cat %t-foo-padded.profraw %t-bar-padded.profraw > %t-pad.profraw -RUN: llvm-profdata show %t-nopad.profraw -all-functions -counts | FileCheck %s RUN: llvm-profdata show %t-pad-between.profraw -all-functions -counts | FileCheck %s RUN: llvm-profdata show %t-pad.profraw -all-functions -counts | FileCheck %s diff --git a/test/tools/llvm-profdata/sample-profile-basic.test b/test/tools/llvm-profdata/sample-profile-basic.test new file mode 100644 index 0000000000..0651c513e9 --- /dev/null +++ b/test/tools/llvm-profdata/sample-profile-basic.test @@ -0,0 +1,30 @@ +Basic tests for sample profiles. + +1- Show all functions +RUN: llvm-profdata show --sample %p/Inputs/sample-profile.proftext | FileCheck %s --check-prefix=SHOW1 +SHOW1: Function: main: 184019, 0, 7 sampled lines +SHOW1: line offset: 9, discriminator: 0, number of samples: 2064, calls: _Z3fooi:631 _Z3bari:1471 +SHOW1: Function: _Z3fooi: 7711, 610, 1 sampled lines +SHOW1: Function: _Z3bari: 20301, 1437, 1 sampled lines +SHOW1: line offset: 1, discriminator: 0, number of samples: 1437 + +2- Show only bar +RUN: llvm-profdata show --sample --function=_Z3bari %p/Inputs/sample-profile.proftext | FileCheck %s --check-prefix=SHOW2 +SHOW2: Function: _Z3bari: 20301, 1437, 1 sampled lines +SHOW2: line offset: 1, discriminator: 0, number of samples: 1437 +SHOW2-NOT: Function: main: 184019, 0, 7 sampled lines +SHOW2-NOT: Function: _Z3fooi: 7711, 610, 1 sampled lines + +3- Convert the profile to binary encoding and check that they are both + identical. +RUN: llvm-profdata merge --sample %p/Inputs/sample-profile.proftext --binary -o - | llvm-profdata show --sample - -o %t-binary +RUN: llvm-profdata show --sample %p/Inputs/sample-profile.proftext -o %t-text +RUN: diff %t-binary %t-text + +4- Merge the binary and text encodings of the profile and check that the + counters have doubled. +RUN: llvm-profdata merge --sample %p/Inputs/sample-profile.proftext -o %t-binprof +RUN: llvm-profdata merge --sample --text %p/Inputs/sample-profile.proftext %t-binprof -o - | FileCheck %s --check-prefix=MERGE1 +MERGE1: main:368038:0 +MERGE1: 9: 4128 _Z3fooi:1262 _Z3bari:2942 +MERGE1: _Z3fooi:15422:1220 diff --git a/test/tools/llvm-profdata/simple.test b/test/tools/llvm-profdata/simple.test deleted file mode 100644 index 18741dd2ba..0000000000 --- a/test/tools/llvm-profdata/simple.test +++ /dev/null @@ -1,77 +0,0 @@ -RUN: llvm-profdata merge %p/Inputs/foo3-1.profdata %p/Inputs/foo3-2.profdata -o %t -RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefix=FOO3 -RUN: llvm-profdata merge %p/Inputs/foo3-2.profdata %p/Inputs/foo3-1.profdata -o %t -RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefix=FOO3 -FOO3: foo: -FOO3: Counters: 3 -FOO3: Function count: 8 -FOO3: Block counts: [7, 6] -FOO3: Total functions: 1 -FOO3: Maximum function count: 8 -FOO3: Maximum internal block count: 7 - -RUN: llvm-profdata merge %p/Inputs/foo4-1.profdata %p/Inputs/foo4-2.profdata -o %t -RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefix=FOO4 -RUN: llvm-profdata merge %p/Inputs/foo4-2.profdata %p/Inputs/foo4-1.profdata -o %t -RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefix=FOO4 -FOO4: foo: -FOO4: Counters: 4 -FOO4: Function count: 18 -FOO4: Block counts: [28, 38, 48] -FOO4: Total functions: 1 -FOO4: Maximum function count: 18 -FOO4: Maximum internal block count: 48 - -RUN: llvm-profdata merge %p/Inputs/foo3bar3-1.profdata %p/Inputs/foo3bar3-2.profdata -o %t -RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefix=FOO3BAR3 -RUN: llvm-profdata merge %p/Inputs/foo3bar3-2.profdata %p/Inputs/foo3bar3-1.profdata -o %t -RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefix=FOO3BAR3 -FOO3BAR3: foo: -FOO3BAR3: Counters: 3 -FOO3BAR3: Function count: 19 -FOO3BAR3: Block counts: [22, 28] -FOO3BAR3: bar: -FOO3BAR3: Counters: 3 -FOO3BAR3: Function count: 36 -FOO3BAR3: Block counts: [42, 50] -FOO3BAR3: Total functions: 2 -FOO3BAR3: Maximum function count: 36 -FOO3BAR3: Maximum internal block count: 50 - -RUN: llvm-profdata merge %p/Inputs/empty.profdata %p/Inputs/foo3-1.profdata -o %t -RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefix=FOO3EMPTY -FOO3EMPTY: foo: -FOO3EMPTY: Counters: 3 -FOO3EMPTY: Function count: 1 -FOO3EMPTY: Block counts: [2, 3] -FOO3EMPTY: Total functions: 1 -FOO3EMPTY: Maximum function count: 1 -FOO3EMPTY: Maximum internal block count: 3 - -RUN: llvm-profdata merge %p/Inputs/foo3-1.profdata %p/Inputs/foo3bar3-1.profdata -o %t -RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefix=FOO3FOO3BAR3 -FOO3FOO3BAR3: foo: -FOO3FOO3BAR3: Counters: 3 -FOO3FOO3BAR3: Function count: 3 -FOO3FOO3BAR3: Block counts: [5, 8] -FOO3FOO3BAR3: bar: -FOO3FOO3BAR3: Counters: 3 -FOO3FOO3BAR3: Function count: 7 -FOO3FOO3BAR3: Block counts: [11, 13] -FOO3FOO3BAR3: Total functions: 2 -FOO3FOO3BAR3: Maximum function count: 7 -FOO3FOO3BAR3: Maximum internal block count: 13 - -RUN: llvm-profdata merge %p/Inputs/foo3-1.profdata %p/Inputs/bar3-1.profdata -o %t -RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefix=DISJOINT -DISJOINT: foo: -DISJOINT: Counters: 3 -DISJOINT: Function count: 1 -DISJOINT: Block counts: [2, 3] -DISJOINT: bar: -DISJOINT: Counters: 3 -DISJOINT: Function count: 1 -DISJOINT: Block counts: [2, 3] -DISJOINT: Total functions: 2 -DISJOINT: Maximum function count: 1 -DISJOINT: Maximum internal block count: 3 diff --git a/test/tools/llvm-profdata/text-format-errors.test b/test/tools/llvm-profdata/text-format-errors.test new file mode 100644 index 0000000000..01513e4fcb --- /dev/null +++ b/test/tools/llvm-profdata/text-format-errors.test @@ -0,0 +1,10 @@ +RUN: not llvm-profdata show %p/Inputs/invalid-count-later.proftext 2>&1 | FileCheck %s --check-prefix=INVALID-COUNT-LATER +RUN: not llvm-profdata merge %p/Inputs/invalid-count-later.proftext %p/Inputs/invalid-count-later.profdata -o %t.out 2>&1 | FileCheck %s --check-prefix=INVALID-COUNT-LATER +INVALID-COUNT-LATER: error: {{.*}}invalid-count-later.proftext: Malformed profile data + +RUN: not llvm-profdata show %p/Inputs/bad-hash.proftext 2>&1 | FileCheck %s --check-prefix=BAD-HASH +RUN: not llvm-profdata merge %p/Inputs/bad-hash.proftext %p/Inputs/bad-hash.proftext -o %t.out 2>&1 | FileCheck %s --check-prefix=BAD-HASH +BAD-HASH: error: {{.*}}bad-hash.proftext: Malformed profile data + +RUN: not llvm-profdata show %p/Inputs/no-counts.proftext 2>&1 | FileCheck %s --check-prefix=NO-COUNTS +NO-COUNTS: error: {{.*}}no-counts.proftext: Malformed profile data |