summaryrefslogtreecommitdiffstats
path: root/llvm/test/tools/llvm-profdata/raw-32-bits-be.test
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2014-03-23 03:38:12 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2014-03-23 03:38:12 +0000
commit4680361d7c881f80b6ddc96bc68d2118eda5cd25 (patch)
treef3dc00c5aaad728849ba6a7dda68115ed50fd445 /llvm/test/tools/llvm-profdata/raw-32-bits-be.test
parent96cf6c3892f08452273a9f3a2be495771bfa4edc (diff)
downloadbcm5719-llvm-4680361d7c881f80b6ddc96bc68d2118eda5cd25.tar.gz
bcm5719-llvm-4680361d7c881f80b6ddc96bc68d2118eda5cd25.zip
InstrProf: Check pointer size in raw profile
Since the profile can come from 32-bit machines, we need to check the pointer size. Change the magic number to facilitate this. Adds tests for reading 32-bit and 64-bit binaries (both big- and little-endian). The tests write a binary using printf in RUN lines (like raw-magic-but-no-header.test). Assuming the bots don't complain, this seems like a better way forward for testing RawInstrProfReader than committing binary files. <rdar://problem/16400648> llvm-svn: 204557
Diffstat (limited to 'llvm/test/tools/llvm-profdata/raw-32-bits-be.test')
-rw-r--r--llvm/test/tools/llvm-profdata/raw-32-bits-be.test42
1 files changed, 42 insertions, 0 deletions
diff --git a/llvm/test/tools/llvm-profdata/raw-32-bits-be.test b/llvm/test/tools/llvm-profdata/raw-32-bits-be.test
new file mode 100644
index 00000000000..86ac56d39f2
--- /dev/null
+++ b/llvm/test/tools/llvm-profdata/raw-32-bits-be.test
@@ -0,0 +1,42 @@
+RUN: printf '\377lprofR\201' > %t
+RUN: printf '\0\0\0\0\0\0\0\1' >> %t
+RUN: printf '\0\0\0\0\0\0\0\2' >> %t
+RUN: printf '\0\0\0\0\0\0\0\3' >> %t
+RUN: printf '\0\0\0\0\0\0\0\6' >> %t
+RUN: printf '\0\0\0\0\1\0\0\0' >> %t
+RUN: printf '\0\0\0\0\2\0\0\0' >> %t
+
+RUN: printf '\0\0\0\3' >> %t
+RUN: printf '\0\0\0\1' >> %t
+RUN: printf '\0\0\0\0\0\0\0\1' >> %t
+RUN: printf '\2\0\0\0' >> %t
+RUN: printf '\1\0\0\0' >> %t
+
+RUN: printf '\0\0\0\3' >> %t
+RUN: printf '\0\0\0\2' >> %t
+RUN: printf '\0\0\0\0\0\0\0\2' >> %t
+RUN: printf '\2\0\0\03' >> %t
+RUN: printf '\1\0\0\10' >> %t
+
+RUN: printf '\0\0\0\0\0\0\0\023' >> %t
+RUN: printf '\0\0\0\0\0\0\0\067' >> %t
+RUN: printf '\0\0\0\0\0\0\0\101' >> %t
+RUN: printf 'foobar' >> %t
+
+RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s
+
+CHECK: Counters:
+CHECK: foo:
+CHECK: Hash: 0x0000000000000001
+CHECK: Counters: 1
+CHECK: Function count: 19
+CHECK: Block counts: []
+CHECK: bar:
+CHECK: Hash: 0x0000000000000002
+CHECK: Counters: 2
+CHECK: Function count: 55
+CHECK: Block counts: [65]
+CHECK: Functions shown: 2
+CHECK: Total functions: 2
+CHECK: Maximum function count: 55
+CHECK: Maximum internal block count: 65
OpenPOWER on IntegriCloud