summaryrefslogtreecommitdiff
path: root/libunwindstack/tests/ElfTest.cpp
diff options
context:
space:
mode:
authorChristopher Ferris <cferris@google.com>2017-07-19 15:44:24 +0000
committerandroid-build-merger <android-build-merger@google.com>2017-07-19 15:44:24 +0000
commitb945cc6de0312399099aee4d0578d0eb2291a06e (patch)
tree069a6bcfd56de7dbfce5498ce93a216f8eb08c1c /libunwindstack/tests/ElfTest.cpp
parent6208cd1322914831c7265506781f6411983c0907 (diff)
parent33913ebfb5ca699d09459227284b3d324343fa43 (diff)
Merge "Add signal handling to the register object."
am: 33913ebfb5 Change-Id: Icfaa2cca55a5aef4b48f58026a64395a267a517b
Diffstat (limited to 'libunwindstack/tests/ElfTest.cpp')
-rw-r--r--libunwindstack/tests/ElfTest.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/libunwindstack/tests/ElfTest.cpp b/libunwindstack/tests/ElfTest.cpp
index 72ceb85ee4..ed1be3b334 100644
--- a/libunwindstack/tests/ElfTest.cpp
+++ b/libunwindstack/tests/ElfTest.cpp
@@ -26,6 +26,7 @@
#include <unwindstack/MapInfo.h>
#include "ElfTestUtils.h"
+#include "LogFake.h"
#include "MemoryFake.h"
#if !defined(PT_ARM_EXIDX)
@@ -131,6 +132,32 @@ TEST_F(ElfTest, elf_invalid) {
ASSERT_FALSE(elf.Step(0, nullptr, nullptr));
}
+TEST_F(ElfTest, elf32_invalid_machine) {
+ Elf elf(memory_);
+
+ InitElf32(EM_PPC);
+
+ ResetLogs();
+ ASSERT_FALSE(elf.Init());
+
+ ASSERT_EQ("", GetFakeLogBuf());
+ ASSERT_EQ("4 unwind 32 bit elf that is neither arm nor x86: e_machine = 20\n\n",
+ GetFakeLogPrint());
+}
+
+TEST_F(ElfTest, elf64_invalid_machine) {
+ Elf elf(memory_);
+
+ InitElf64(EM_PPC64);
+
+ ResetLogs();
+ ASSERT_FALSE(elf.Init());
+
+ ASSERT_EQ("", GetFakeLogBuf());
+ ASSERT_EQ("4 unwind 64 bit elf that is neither aarch64 nor x86_64: e_machine = 21\n\n",
+ GetFakeLogPrint());
+}
+
TEST_F(ElfTest, elf_arm) {
Elf elf(memory_);