workflows/scorecard: Run this job once per day instead of for every push
[llvm-project.git] / llvm / test / tools / llvm-profdata / malformed-ptr-to-counter-array.test
blob3c23bc7dd0f7f99a01f65df66cdad6d437404ec4
1 // Header
2 //
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, ValueKindLast, IPVK_Last)
15 RUN: printf '\201rforpl\377' > %t.profraw
16 RUN: printf '\11\0\0\0\0\0\0\0' >> %t.profraw
17 RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
18 RUN: printf '\1\0\0\0\0\0\0\0' >> %t.profraw
19 RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
20 RUN: printf '\2\0\0\0\0\0\0\0' >> %t.profraw
21 RUN: printf '\0\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 '\0\0\0\0\0\0\0\0' >> %t.profraw
24 RUN: printf '\10\0\0\0\0\0\0\0' >> %t.profraw
25 RUN: printf '\0\0\6\0\1\0\0\0' >> %t.profraw
26 RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
27 RUN: printf '\0\0\6\0\2\0\0\0' >> %t.profraw
28 RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
30 // Data Section
32 // struct ProfData {
33 // #define INSTR_PROF_DATA(Type, LLVMType, Name, Initializer) \
34 //    Type Name;
35 // #include "llvm/ProfileData/InstrProfData.inc"
36 // };
38 RUN: printf '\067\265\035\031\112\165\023\344' >> %t.profraw
39 RUN: printf '\02\0\0\0\0\0\0\0' >> %t.profraw
41 // Note: The CounterPtr here is off-by-one.
43 // Octal '\11' is 9 in decimal: this should push CounterOffset to 1. As there are two counters,
44 // the profile reader should error out.
45 RUN: printf '\11\0\6\0\1\0\0\0' >> %t.profraw
46 RUN: printf '\0\0\0\0\0\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 '\02\0\0\0\0\0\0\0' >> %t.profraw
51 RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
53 // Counter Section
55 RUN: printf '\067\0\0\0\0\0\0\0' >> %t.profraw
56 RUN: printf '\101\0\0\0\0\0\0\0' >> %t.profraw
58 // Name Section
60 RUN: printf '\3\0bar\0\0\0' >> %t.profraw
62 RUN: not llvm-profdata merge -o /dev/null %t.profraw 2>&1 | FileCheck %s
63 CHECK: warning: {{.+}}: malformed instrumentation profile data: number of counters 2 is greater than the maximum number of counters 0
64 CHECK: error: no profile can be merged