aboutsummaryrefslogtreecommitdiff
path: root/src/common/linux
diff options
context:
space:
mode:
authorted.mielczarek@gmail.com <ted.mielczarek@gmail.com@4c0a9323-5329-0410-9bdc-e9ce6186880e>2013-03-29 15:06:43 +0000
committerted.mielczarek@gmail.com <ted.mielczarek@gmail.com@4c0a9323-5329-0410-9bdc-e9ce6186880e>2013-03-29 15:06:43 +0000
commit704c13e7ab3c422791f05c4efb182a991327816b (patch)
treef076e220a469b2b2a2041fcc6b62bcee1c7bc163 /src/common/linux
parentRefactor BasicElf synth_elf unitest (diff)
downloadbreakpad-704c13e7ab3c422791f05c4efb182a991327816b.tar.xz
Add tests for section headers in synth_elf unittest
A=Mike Hommey <mh@glandium.org> R=ted at https://breakpad.appspot.com/542003/ git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1137 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src/common/linux')
-rw-r--r--src/common/linux/synth_elf_unittest.cc24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/common/linux/synth_elf_unittest.cc b/src/common/linux/synth_elf_unittest.cc
index 7aa252e3..b1586151 100644
--- a/src/common/linux/synth_elf_unittest.cc
+++ b/src/common/linux/synth_elf_unittest.cc
@@ -234,6 +234,30 @@ TYPED_TEST(BasicElf, EmptyLE) {
EXPECT_EQ(sizeof(Shdr), header->e_shentsize);
EXPECT_EQ(2, header->e_shnum);
EXPECT_EQ(1, header->e_shstrndx);
+
+ const Shdr* shdr =
+ reinterpret_cast<const Shdr*>(contents.data() + header->e_shoff);
+ EXPECT_EQ(0U, shdr[0].sh_name);
+ EXPECT_EQ(static_cast<unsigned int>(SHT_NULL), shdr[0].sh_type);
+ EXPECT_EQ(0U, shdr[0].sh_flags);
+ EXPECT_EQ(0U, shdr[0].sh_addr);
+ EXPECT_EQ(0U, shdr[0].sh_offset);
+ EXPECT_EQ(0U, shdr[0].sh_size);
+ EXPECT_EQ(0U, shdr[0].sh_link);
+ EXPECT_EQ(0U, shdr[0].sh_info);
+ EXPECT_EQ(0U, shdr[0].sh_addralign);
+ EXPECT_EQ(0U, shdr[0].sh_entsize);
+
+ EXPECT_EQ(1U, shdr[1].sh_name);
+ EXPECT_EQ(static_cast<unsigned int>(SHT_STRTAB), shdr[1].sh_type);
+ EXPECT_EQ(0U, shdr[1].sh_flags);
+ EXPECT_EQ(0U, shdr[1].sh_addr);
+ EXPECT_EQ(sizeof(Ehdr), shdr[1].sh_offset);
+ EXPECT_EQ(kStringTableSize, shdr[1].sh_size);
+ EXPECT_EQ(0U, shdr[1].sh_link);
+ EXPECT_EQ(0U, shdr[1].sh_info);
+ EXPECT_EQ(0U, shdr[1].sh_addralign);
+ EXPECT_EQ(0U, shdr[1].sh_entsize);
}
#endif // defined(__i386__) || defined(__x86_64__)