From 704c13e7ab3c422791f05c4efb182a991327816b Mon Sep 17 00:00:00 2001 From: "ted.mielczarek@gmail.com" Date: Fri, 29 Mar 2013 15:06:43 +0000 Subject: Add tests for section headers in synth_elf unittest A=Mike Hommey R=ted at https://breakpad.appspot.com/542003/ git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1137 4c0a9323-5329-0410-9bdc-e9ce6186880e --- src/common/linux/synth_elf_unittest.cc | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) 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(contents.data() + header->e_shoff); + EXPECT_EQ(0U, shdr[0].sh_name); + EXPECT_EQ(static_cast(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(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__) -- cgit v1.2.1