diff options
author | Pavel Labath <labath@google.com> | 2018-07-19 14:38:30 +0000 |
---|---|---|
committer | Pavel Labath <labath@google.com> | 2018-07-19 14:38:30 +0000 |
commit | a274452924e5edf7a3e95c3ab4927c70c29b510c (patch) | |
tree | e71c2d9d5af9b446159a19153a0246b58f72e196 /lldb/unittests/ObjectFile/ELF/TestELFHeader.cpp | |
parent | ad760e3ec6936671cca3becefa28c398b60e7cde (diff) | |
download | bcm5719-llvm-a274452924e5edf7a3e95c3ab4927c70c29b510c.tar.gz bcm5719-llvm-a274452924e5edf7a3e95c3ab4927c70c29b510c.zip |
ELF: Replace the header-extension unit test with a lit one
The new test checks that we are actually able to read data from these
kinds of elf headers correctly instead of just that we read the section
number correctly. It is also easier to figure out what's going on in the
test.
llvm-svn: 337459
Diffstat (limited to 'lldb/unittests/ObjectFile/ELF/TestELFHeader.cpp')
-rw-r--r-- | lldb/unittests/ObjectFile/ELF/TestELFHeader.cpp | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/lldb/unittests/ObjectFile/ELF/TestELFHeader.cpp b/lldb/unittests/ObjectFile/ELF/TestELFHeader.cpp deleted file mode 100644 index 979011f66a2..00000000000 --- a/lldb/unittests/ObjectFile/ELF/TestELFHeader.cpp +++ /dev/null @@ -1,62 +0,0 @@ -//===-- TestELFHeader.cpp ---------------------------------------*- C++ -*-===// -// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include "Plugins/ObjectFile/ELF/ELFHeader.h" -#include "lldb/Utility/DataExtractor.h" -#include "gtest/gtest.h" - -using namespace lldb; -using namespace lldb_private; - - -TEST(ELFHeader, ParseHeaderExtension) { - uint8_t data[] = { - // e_ident - 0x7f, 0x45, 0x4c, 0x46, 0x02, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - - // e_type, e_machine, e_version, e_entry - 0x03, 0x00, 0x3e, 0x00, 0x01, 0x00, 0x00, 0x00, 0x90, 0x48, 0x40, 0x00, - 0x00, 0x00, 0x00, 0x00, - - // e_phoff, e_shoff - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - - // e_flags, e_ehsize, e_phentsize, e_phnum, e_shentsize, e_shnum, - // e_shstrndx - 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x38, 0x00, 0xff, 0xff, 0x40, 0x00, - 0x00, 0x00, 0xff, 0xff, - - // sh_name, sh_type, sh_flags - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - - // sh_addr, sh_offset - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - - // sh_size, sh_link, sh_info - 0x23, 0x45, 0x67, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x56, 0x78, 0x00, - 0x12, 0x34, 0x56, 0x00, - - // sh_addralign, sh_entsize - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - }; - - DataExtractor extractor(data, sizeof data, eByteOrderLittle, 8); - elf::ELFHeader header; - offset_t offset = 0; - ASSERT_TRUE(header.Parse(extractor, &offset)); - EXPECT_EQ(0x563412u, header.e_phnum); - EXPECT_EQ(0x785634u, header.e_shstrndx); - EXPECT_EQ(0x674523u, header.e_shnum); -} |