Merge "A few cleanups."
am: 0c22c5646e
Change-Id: I557f9348d53d6c64efba4e25c7fa46970ca5e7a0
This commit is contained in:
commit
35f2bf43a7
4 changed files with 53 additions and 56 deletions
|
@ -39,19 +39,10 @@ cc_defaults {
|
|||
enabled: false,
|
||||
},
|
||||
},
|
||||
|
||||
multilib: {
|
||||
lib32: {
|
||||
suffix: "32",
|
||||
},
|
||||
lib64: {
|
||||
suffix: "64",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
cc_defaults {
|
||||
name: "libunwindstack_common",
|
||||
cc_library {
|
||||
name: "libunwindstack",
|
||||
defaults: ["libunwindstack_flags"],
|
||||
|
||||
srcs: [
|
||||
|
@ -89,16 +80,11 @@ cc_defaults {
|
|||
],
|
||||
}
|
||||
|
||||
cc_library {
|
||||
name: "libunwindstack",
|
||||
defaults: ["libunwindstack_common"],
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Unit Tests
|
||||
//-------------------------------------------------------------------------
|
||||
cc_defaults {
|
||||
name: "libunwindstack_test_common",
|
||||
cc_test {
|
||||
name: "libunwindstack_test",
|
||||
defaults: ["libunwindstack_flags"],
|
||||
|
||||
srcs: [
|
||||
|
@ -121,7 +107,7 @@ cc_defaults {
|
|||
"tests/MapInfoCreateMemoryTest.cpp",
|
||||
"tests/MapInfoGetElfTest.cpp",
|
||||
"tests/MapsTest.cpp",
|
||||
"tests/MemoryBuffer.cpp",
|
||||
"tests/MemoryBufferTest.cpp",
|
||||
"tests/MemoryFake.cpp",
|
||||
"tests/MemoryFileTest.cpp",
|
||||
"tests/MemoryLocalTest.cpp",
|
||||
|
@ -142,6 +128,7 @@ cc_defaults {
|
|||
"libbase",
|
||||
"liblog",
|
||||
"liblzma",
|
||||
"libunwindstack",
|
||||
],
|
||||
|
||||
static_libs: [
|
||||
|
@ -155,16 +142,6 @@ cc_defaults {
|
|||
],
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
// These unit tests run against the shared library.
|
||||
cc_test {
|
||||
name: "libunwindstack_test",
|
||||
defaults: ["libunwindstack_test_common"],
|
||||
|
||||
shared_libs: [
|
||||
"libunwindstack",
|
||||
],
|
||||
|
||||
data: [
|
||||
"tests/files/elf32.xz",
|
||||
|
@ -188,8 +165,6 @@ cc_defaults {
|
|||
static_libs: [
|
||||
"liblog",
|
||||
],
|
||||
|
||||
compile_multilib: "both",
|
||||
}
|
||||
|
||||
cc_binary {
|
||||
|
@ -205,20 +180,9 @@ cc_binary {
|
|||
// Once these files are generated, use the xz command to compress the data.
|
||||
cc_binary_host {
|
||||
name: "gen_gnudebugdata",
|
||||
|
||||
cflags: [
|
||||
"-Wall",
|
||||
"-Werror",
|
||||
"-Wextra",
|
||||
],
|
||||
defaults: ["libunwindstack_flags"],
|
||||
|
||||
srcs: [
|
||||
"tests/GenGnuDebugdata.cpp",
|
||||
],
|
||||
|
||||
target: {
|
||||
darwin: {
|
||||
enabled: false,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
@ -237,9 +237,13 @@ void DwarfMemoryTest::ReadEncodedValue_omit() {
|
|||
ASSERT_EQ(0U, value);
|
||||
}
|
||||
|
||||
TEST_F(DwarfMemoryTest, ReadEncodedValue_omit_uint32_t) { ReadEncodedValue_omit<uint32_t>(); }
|
||||
TEST_F(DwarfMemoryTest, ReadEncodedValue_omit_uint32_t) {
|
||||
ReadEncodedValue_omit<uint32_t>();
|
||||
}
|
||||
|
||||
TEST_F(DwarfMemoryTest, ReadEncodedValue_omit_uint64_t) { ReadEncodedValue_omit<uint64_t>(); }
|
||||
TEST_F(DwarfMemoryTest, ReadEncodedValue_omit_uint64_t) {
|
||||
ReadEncodedValue_omit<uint64_t>();
|
||||
}
|
||||
|
||||
TEST_F(DwarfMemoryTest, ReadEncodedValue_absptr_uint32_t) {
|
||||
uint64_t value = 100;
|
||||
|
@ -302,9 +306,13 @@ void DwarfMemoryTest::ReadEncodedValue_leb128() {
|
|||
ASSERT_EQ(0xffffffffffffe100ULL, value);
|
||||
}
|
||||
|
||||
TEST_F(DwarfMemoryTest, ReadEncodedValue_leb128_uint32_t) { ReadEncodedValue_leb128<uint32_t>(); }
|
||||
TEST_F(DwarfMemoryTest, ReadEncodedValue_leb128_uint32_t) {
|
||||
ReadEncodedValue_leb128<uint32_t>();
|
||||
}
|
||||
|
||||
TEST_F(DwarfMemoryTest, ReadEncodedValue_leb128_uint64_t) { ReadEncodedValue_leb128<uint64_t>(); }
|
||||
TEST_F(DwarfMemoryTest, ReadEncodedValue_leb128_uint64_t) {
|
||||
ReadEncodedValue_leb128<uint64_t>();
|
||||
}
|
||||
|
||||
template <typename AddressType>
|
||||
void DwarfMemoryTest::ReadEncodedValue_data1() {
|
||||
|
@ -319,9 +327,13 @@ void DwarfMemoryTest::ReadEncodedValue_data1() {
|
|||
ASSERT_EQ(0xffffffffffffffe0ULL, value);
|
||||
}
|
||||
|
||||
TEST_F(DwarfMemoryTest, ReadEncodedValue_data1_uint32_t) { ReadEncodedValue_data1<uint32_t>(); }
|
||||
TEST_F(DwarfMemoryTest, ReadEncodedValue_data1_uint32_t) {
|
||||
ReadEncodedValue_data1<uint32_t>();
|
||||
}
|
||||
|
||||
TEST_F(DwarfMemoryTest, ReadEncodedValue_data1_uint64_t) { ReadEncodedValue_data1<uint64_t>(); }
|
||||
TEST_F(DwarfMemoryTest, ReadEncodedValue_data1_uint64_t) {
|
||||
ReadEncodedValue_data1<uint64_t>();
|
||||
}
|
||||
|
||||
template <typename AddressType>
|
||||
void DwarfMemoryTest::ReadEncodedValue_data2() {
|
||||
|
@ -336,9 +348,13 @@ void DwarfMemoryTest::ReadEncodedValue_data2() {
|
|||
ASSERT_EQ(0xffffffffffffe000ULL, value);
|
||||
}
|
||||
|
||||
TEST_F(DwarfMemoryTest, ReadEncodedValue_data2_uint32_t) { ReadEncodedValue_data2<uint32_t>(); }
|
||||
TEST_F(DwarfMemoryTest, ReadEncodedValue_data2_uint32_t) {
|
||||
ReadEncodedValue_data2<uint32_t>();
|
||||
}
|
||||
|
||||
TEST_F(DwarfMemoryTest, ReadEncodedValue_data2_uint64_t) { ReadEncodedValue_data2<uint64_t>(); }
|
||||
TEST_F(DwarfMemoryTest, ReadEncodedValue_data2_uint64_t) {
|
||||
ReadEncodedValue_data2<uint64_t>();
|
||||
}
|
||||
|
||||
template <typename AddressType>
|
||||
void DwarfMemoryTest::ReadEncodedValue_data4() {
|
||||
|
@ -353,9 +369,13 @@ void DwarfMemoryTest::ReadEncodedValue_data4() {
|
|||
ASSERT_EQ(0xffffffffe0000000ULL, value);
|
||||
}
|
||||
|
||||
TEST_F(DwarfMemoryTest, ReadEncodedValue_data4_uint32_t) { ReadEncodedValue_data4<uint32_t>(); }
|
||||
TEST_F(DwarfMemoryTest, ReadEncodedValue_data4_uint32_t) {
|
||||
ReadEncodedValue_data4<uint32_t>();
|
||||
}
|
||||
|
||||
TEST_F(DwarfMemoryTest, ReadEncodedValue_data4_uint64_t) { ReadEncodedValue_data4<uint64_t>(); }
|
||||
TEST_F(DwarfMemoryTest, ReadEncodedValue_data4_uint64_t) {
|
||||
ReadEncodedValue_data4<uint64_t>();
|
||||
}
|
||||
|
||||
template <typename AddressType>
|
||||
void DwarfMemoryTest::ReadEncodedValue_data8() {
|
||||
|
@ -370,9 +390,13 @@ void DwarfMemoryTest::ReadEncodedValue_data8() {
|
|||
ASSERT_EQ(0xe000000000000000ULL, value);
|
||||
}
|
||||
|
||||
TEST_F(DwarfMemoryTest, ReadEncodedValue_data8_uint32_t) { ReadEncodedValue_data8<uint32_t>(); }
|
||||
TEST_F(DwarfMemoryTest, ReadEncodedValue_data8_uint32_t) {
|
||||
ReadEncodedValue_data8<uint32_t>();
|
||||
}
|
||||
|
||||
TEST_F(DwarfMemoryTest, ReadEncodedValue_data8_uint64_t) { ReadEncodedValue_data8<uint64_t>(); }
|
||||
TEST_F(DwarfMemoryTest, ReadEncodedValue_data8_uint64_t) {
|
||||
ReadEncodedValue_data8<uint64_t>();
|
||||
}
|
||||
|
||||
template <typename AddressType>
|
||||
void DwarfMemoryTest::ReadEncodedValue_non_zero_adjust() {
|
||||
|
|
|
@ -45,6 +45,15 @@ void TestInitEhdr(Ehdr* ehdr, uint32_t elf_class, uint32_t machine_type) {
|
|||
ehdr->e_ehsize = sizeof(Ehdr);
|
||||
}
|
||||
|
||||
static std::string GetTestFileDirectory() {
|
||||
std::string exec(testing::internal::GetArgvs()[0]);
|
||||
auto const value = exec.find_last_of('/');
|
||||
if (value == std::string::npos) {
|
||||
return "tests/files/";
|
||||
}
|
||||
return exec.substr(0, value + 1) + "tests/files/";
|
||||
}
|
||||
|
||||
template <typename Ehdr, typename Shdr>
|
||||
void TestInitGnuDebugdata(uint32_t elf_class, uint32_t machine, bool init_gnu_debugdata,
|
||||
TestCopyFuncType copy_func) {
|
||||
|
@ -91,7 +100,7 @@ void TestInitGnuDebugdata(uint32_t elf_class, uint32_t machine, bool init_gnu_de
|
|||
offset = symtab_offset + 0x100;
|
||||
if (init_gnu_debugdata) {
|
||||
// Read in the compressed elf data and copy it in.
|
||||
name = "tests/files/";
|
||||
name = GetTestFileDirectory();
|
||||
if (elf_class == ELFCLASS32) {
|
||||
name += "elf32.xz";
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue