summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVedant Kumar <vsk@apple.com>2019-10-12 00:23:15 +0000
committerVedant Kumar <vsk@apple.com>2019-10-12 00:23:15 +0000
commit852e3b207651ce4cc8e9382282eca5e91ac1476b (patch)
tree68049b9ed0919df2e0dcc5c93f7fa7feee144e33
parentb15c886ba5b6474b64a782b35b1c66098fc60920 (diff)
downloadbcm5719-llvm-852e3b207651ce4cc8e9382282eca5e91ac1476b.tar.gz
bcm5719-llvm-852e3b207651ce4cc8e9382282eca5e91ac1476b.zip
[llvm-profdata] Make "malformed-ptr-to-counter-array.test" textual
As pointed out in https://reviews.llvm.org/D66979 post-commit, making this test textual would make it more maintainable. Differential Revision: https://reviews.llvm.org/D68718 llvm-svn: 374617
-rw-r--r--llvm/test/tools/llvm-profdata/Inputs/malformed-ptr-to-counter-array.profrawbin563560 -> 0 bytes
-rw-r--r--llvm/test/tools/llvm-profdata/malformed-ptr-to-counter-array.test49
2 files changed, 47 insertions, 2 deletions
diff --git a/llvm/test/tools/llvm-profdata/Inputs/malformed-ptr-to-counter-array.profraw b/llvm/test/tools/llvm-profdata/Inputs/malformed-ptr-to-counter-array.profraw
deleted file mode 100644
index 72fddd76fc6..00000000000
--- a/llvm/test/tools/llvm-profdata/Inputs/malformed-ptr-to-counter-array.profraw
+++ /dev/null
Binary files differ
diff --git a/llvm/test/tools/llvm-profdata/malformed-ptr-to-counter-array.test b/llvm/test/tools/llvm-profdata/malformed-ptr-to-counter-array.test
index 24a68e35fad..0cfc93b01f2 100644
--- a/llvm/test/tools/llvm-profdata/malformed-ptr-to-counter-array.test
+++ b/llvm/test/tools/llvm-profdata/malformed-ptr-to-counter-array.test
@@ -1,5 +1,50 @@
-REQUIRES: zlib
+// Header
+//
+// INSTR_PROF_RAW_HEADER(uint64_t, Magic, __llvm_profile_get_magic())
+// INSTR_PROF_RAW_HEADER(uint64_t, Version, __llvm_profile_get_version())
+// INSTR_PROF_RAW_HEADER(uint64_t, DataSize, DataSize)
+// INSTR_PROF_RAW_HEADER(uint64_t, CountersSize, CountersSize)
+// INSTR_PROF_RAW_HEADER(uint64_t, NamesSize, NamesSize)
+// INSTR_PROF_RAW_HEADER(uint64_t, CountersDelta, (uintptr_t)CountersBegin)
+// INSTR_PROF_RAW_HEADER(uint64_t, NamesDelta, (uintptr_t)NamesBegin)
+// INSTR_PROF_RAW_HEADER(uint64_t, ValueKindLast, IPVK_Last)
-RUN: not llvm-profdata merge -o /dev/null %p/Inputs/malformed-ptr-to-counter-array.profraw 2>&1 | FileCheck %s
+RUN: printf '\201rforpl\377' > %t.profraw
+RUN: printf '\4\0\0\0\0\0\0\0' >> %t.profraw
+RUN: printf '\1\0\0\0\0\0\0\0' >> %t.profraw
+RUN: printf '\2\0\0\0\0\0\0\0' >> %t.profraw
+RUN: printf '\10\0\0\0\0\0\0\0' >> %t.profraw
+RUN: printf '\0\0\6\0\1\0\0\0' >> %t.profraw
+RUN: printf '\0\0\6\0\2\0\0\0' >> %t.profraw
+RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
+
+// Data Section
+//
+// struct ProfData {
+// #define INSTR_PROF_DATA(Type, LLVMType, Name, Initializer) \
+// Type Name;
+// #include "llvm/ProfileData/InstrProfData.inc"
+// };
+
+RUN: printf '\067\265\035\031\112\165\023\344' >> %t.profraw
+RUN: printf '\02\0\0\0\0\0\0\0' >> %t.profraw
+
+// Note: The CounterPtr here is off-by-one. This should trigger a malformed profile error.
+RUN: printf '\0\0\6\0\1\0\0\1' >> %t.profraw
+
+RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
+RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
+RUN: printf '\02\0\0\0\0\0\0\0' >> %t.profraw
+
+// Counter Section
+
+RUN: printf '\067\0\0\0\0\0\0\0' >> %t.profraw
+RUN: printf '\101\0\0\0\0\0\0\0' >> %t.profraw
+
+// Name Section
+
+RUN: printf '\3\0bar\0\0\0' >> %t.profraw
+
+RUN: not llvm-profdata merge -o /dev/null %t.profraw 2>&1 | FileCheck %s
CHECK: Malformed instrumentation profile data
OpenPOWER on IntegriCloud