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, DataSize, DataSize)
6// INSTR_PROF_RAW_HEADER(uint64_t, CountersSize, CountersSize)
7// INSTR_PROF_RAW_HEADER(uint64_t, NamesSize,  NamesSize)
8// INSTR_PROF_RAW_HEADER(uint64_t, CountersDelta, (uintptr_t)CountersBegin)
9// INSTR_PROF_RAW_HEADER(uint64_t, NamesDelta, (uintptr_t)NamesBegin)
10// INSTR_PROF_RAW_HEADER(uint64_t, ValueKindLast, IPVK_Last)
11
12RUN: printf '\201rforpl\377' > %t.profraw
13RUN: printf '\5\0\0\0\0\0\0\0' >> %t.profraw
14RUN: printf '\1\0\0\0\0\0\0\0' >> %t.profraw
15RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
16RUN: printf '\2\0\0\0\0\0\0\0' >> %t.profraw
17RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
18RUN: printf '\10\0\0\0\0\0\0\0' >> %t.profraw
19RUN: printf '\0\0\6\0\1\0\0\0' >> %t.profraw
20RUN: printf '\0\0\6\0\2\0\0\0' >> %t.profraw
21RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
22
23// Data Section
24//
25// struct ProfData {
26// #define INSTR_PROF_DATA(Type, LLVMType, Name, Initializer) \
27//    Type Name;
28// #include "llvm/ProfileData/InstrProfData.inc"
29// };
30
31RUN: printf '\067\265\035\031\112\165\023\344' >> %t.profraw
32RUN: printf '\02\0\0\0\0\0\0\0' >> %t.profraw
33
34// Note: The CounterPtr here is off-by-one.
35//
36// Octal '\11' is 9 in decimal: this should push CounterOffset to 1. As there are two counters,
37// the profile reader should error out.
38RUN: printf '\11\0\6\0\1\0\0\0' >> %t.profraw
39
40RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
41RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
42RUN: printf '\02\0\0\0\0\0\0\0' >> %t.profraw
43
44// Counter Section
45
46RUN: printf '\067\0\0\0\0\0\0\0' >> %t.profraw
47RUN: printf '\101\0\0\0\0\0\0\0' >> %t.profraw
48
49// Name Section
50
51RUN: printf '\3\0bar\0\0\0' >> %t.profraw
52
53RUN: not llvm-profdata merge -o /dev/null %t.profraw 2>&1 | FileCheck %s
54CHECK: Malformed instrumentation profile data
55