diff options
author | Christopher Ferris <cferris@google.com> | 2017-07-19 15:47:21 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-07-19 15:47:21 +0000 |
commit | 2f80aa506fd17d84f00371f42b9bb274162cab6d (patch) | |
tree | dbdf7638e139f3d77a4e2f97afeaed3abba6623f /libunwindstack/tests/ElfTest.cpp | |
parent | 106c35568815f58d35ce6db7fbe30675f8d31c5b (diff) | |
parent | b945cc6de0312399099aee4d0578d0eb2291a06e (diff) |
Merge "Add signal handling to the register object." am: 33913ebfb5
am: b945cc6de0
Change-Id: I31c954a03229b264e1bb2a8a75ef5972e60b2bf2
Diffstat (limited to 'libunwindstack/tests/ElfTest.cpp')
-rw-r--r-- | libunwindstack/tests/ElfTest.cpp | 27 |
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_); |