3 // INSTR_PROF_RAW_HEADER(uint64_t, Magic, __llvm_profile_get_magic())
4 // INSTR_PROF_RAW_HEADER(uint64_t, Version, __llvm_profile_get_version())
5 // INSTR_PROF_RAW_HEADER(uint64_t, BinaryIdsSize, __llvm_write_binary_ids(NULL))
6 // INSTR_PROF_RAW_HEADER(uint64_t, DataSize, DataSize)
7 // INSTR_PROF_RAW_HEADER(uint64_t, CountersSize, CountersSize)
8 // INSTR_PROF_RAW_HEADER(uint64_t, NumBitmaskBytes, NumBitmaskBytes)
9 // INSTR_PROF_RAW_HEADER(uint64_t, NamesSize, NamesSize)
10 // INSTR_PROF_RAW_HEADER(uint64_t, CountersDelta, (uintptr_t)CountersBegin)
11 // INSTR_PROF_RAW_HEADER(uint64_t, BitmaskDelta, (uintptr_t)BitmaskBegin)
12 // INSTR_PROF_RAW_HEADER(uint64_t, NamesDelta, (uintptr_t)NamesBegin)
13 // INSTR_PROF_RAW_HEADER(uint64_t, VNamesSize, VNamesSize)
14 // INSTR_PROF_RAW_HEADER(uint64_t, NumVTables, NumVTables)
15 // INSTR_PROF_RAW_HEADER(uint64_t, ValueKindLast, IPVK_Last)
17 // gnuwin32 printf does not work for this test because it will print \15 (CR)
18 // whenever \12 (LF) is in the input string.
19 UNSUPPORTED: system-windows
20 RUN: printf '\201rforpl\377' > %t.profraw
21 RUN: printf '\12\0\0\0\0\0\0\0' >> %t.profraw
22 RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
23 RUN: printf '\1\0\0\0\0\0\0\0' >> %t.profraw
24 RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
25 RUN: printf '\1\0\0\0\0\0\0\0' >> %t.profraw
26 RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
27 RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
28 RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
29 RUN: printf '\10\0\0\0\0\0\0\0' >> %t.profraw
30 RUN: printf '\0\0\4\0\1\0\0\0' >> %t.profraw
31 RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
32 RUN: printf '\0\0\4\0\2\0\0\0' >> %t.profraw
33 RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
34 RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
35 RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
40 // #define INSTR_PROF_DATA(Type, LLVMType, Name, Initializer) \
42 // #include "llvm/ProfileData/InstrProfData.inc"
45 RUN: printf '\254\275\030\333\114\302\370\134' >> %t.profraw
46 RUN: printf '\1\0\0\0\0\0\0\0' >> %t.profraw
47 RUN: printf '\0\0\4\0\1\0\0\0' >> %t.profraw
48 RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
49 RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
50 RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
52 // Make two copies for another test.
53 RUN: cp %t.profraw %t-bad.profraw
54 RUN: cp %t.profraw %t-good.profraw
56 // Make NumCounters = 0 so that we get "number of counters is zero" error message
57 RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
58 RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
60 RUN: printf '\023\0\0\0\0\0\0\0' >> %t.profraw
61 RUN: printf '\3\0foo\0\0\0' >> %t.profraw
63 RUN: not llvm-profdata show %t.profraw 2>&1 | FileCheck %s --check-prefix=ZERO
64 ZERO: malformed instrumentation profile data: number of counters is zero
66 // Test a counter value greater than 2^56.
67 RUN: printf '\1\0\0\0\0\0\0\0' >> %t-bad.profraw
68 RUN: printf '\0\0\0\0\0\0\0\0' >> %t-bad.profraw
69 // Counter value is 72057594037927937
70 RUN: printf '\1\0\0\0\0\0\0\1' >> %t-bad.profraw
71 RUN: printf '\3\0foo\0\0\0' >> %t-bad.profraw
73 RUN: printf '\1\0\0\0\0\0\0\0' >> %t-good.profraw
74 RUN: printf '\0\0\0\0\0\0\0\0' >> %t-good.profraw
75 // Counter value is 72057594037927937
76 RUN: printf '\1\0\0\0\0\0\0\0' >> %t-good.profraw
77 RUN: printf '\3\0foo\0\0\0' >> %t-good.profraw
79 // llvm-profdata fails if there is a warning for any input file under default failure mode (any).
80 RUN: not llvm-profdata merge %t-bad.profraw %t-good.profraw -o %t.profdata 2>&1 | FileCheck %s --check-prefix=ANY
81 ANY: {{.*}} excessively large counter value suggests corrupted profile data: 72057594037927937
83 // -failure-mode=all only fails if there is a warning for every input file.
84 RUN: not llvm-profdata merge %t-bad.profraw -failure-mode=all -o %t.profdata 2>&1 | FileCheck %s --check-prefix=ALL-ERR
85 ALL-ERR: {{.*}} excessively large counter value suggests corrupted profile data: 72057594037927937
87 RUN: llvm-profdata merge %t-bad.profraw %t-good.profraw -failure-mode=all -o %t.profdata 2>&1 | FileCheck %s --check-prefix=ALL-WARN
88 ALL-WARN: {{.*}} excessively large counter value suggests corrupted profile data: 72057594037927937
90 // -failure-mode=warn does not fail at all. It only prints warnings.
91 RUN: llvm-profdata merge %t-bad.profraw -failure-mode=warn -o %t.profdata 2>&1 | FileCheck %s --check-prefix=WARN
92 WARN: {{.*}} excessively large counter value suggests corrupted profile data: 72057594037927937