summaryrefslogtreecommitdiff
path: root/libunwindstack/tests/ElfInterfaceTest.cpp
diff options
context:
space:
mode:
authorChristopher Ferris <cferris@google.com>2019-01-16 17:23:39 -0800
committerChristopher Ferris <cferris@google.com>2019-01-17 20:14:00 -0800
commitbf373edc3c12a6e6df91770fde36075cc9d3e257 (patch)
treef0281cb2e53007d0ef9b3c2455db292da53dc234 /libunwindstack/tests/ElfInterfaceTest.cpp
parentb94c2e52a674d43705045d0662e6a427aee2e873 (diff)
Add caching of build id in MapInfo object.
Change the GetBuildID function to return a std::string. Added benchmark to check how long it takes to get the build id from a file versus an elf object. Added a way to get an elf without passing in a valid process_memory and added tests for this. Test: New unit tests. Change-Id: I3029019767e0181c758d611fe635bc1bf72d6e8e
Diffstat (limited to 'libunwindstack/tests/ElfInterfaceTest.cpp')
-rw-r--r--libunwindstack/tests/ElfInterfaceTest.cpp17
1 files changed, 5 insertions, 12 deletions
diff --git a/libunwindstack/tests/ElfInterfaceTest.cpp b/libunwindstack/tests/ElfInterfaceTest.cpp
index 6023dc4b8..7239749c6 100644
--- a/libunwindstack/tests/ElfInterfaceTest.cpp
+++ b/libunwindstack/tests/ElfInterfaceTest.cpp
@@ -1228,9 +1228,7 @@ void ElfInterfaceTest::BuildID() {
uint64_t load_bias = 0;
ASSERT_TRUE(elf->Init(&load_bias));
- std::string build_id;
- ASSERT_TRUE(elf->GetBuildID(&build_id));
- EXPECT_STREQ(build_id.c_str(), "BUILDID");
+ ASSERT_EQ("BUILDID", elf->GetBuildID());
}
template <typename Ehdr, typename Shdr, typename Nhdr, typename ElfInterfaceType>
@@ -1292,9 +1290,7 @@ void ElfInterfaceTest::BuildIDTwoNotes() {
uint64_t load_bias = 0;
ASSERT_TRUE(elf->Init(&load_bias));
- std::string build_id;
- ASSERT_TRUE(elf->GetBuildID(&build_id));
- EXPECT_STREQ(build_id.c_str(), "BUILDID");
+ ASSERT_EQ("BUILDID", elf->GetBuildID());
}
template <typename Ehdr, typename Shdr, typename Nhdr, typename ElfInterfaceType>
@@ -1346,8 +1342,7 @@ void ElfInterfaceTest::BuildIDSectionTooSmallForName () {
uint64_t load_bias = 0;
ASSERT_TRUE(elf->Init(&load_bias));
- std::string build_id;
- ASSERT_FALSE(elf->GetBuildID(&build_id));
+ ASSERT_EQ("", elf->GetBuildID());
}
template <typename Ehdr, typename Shdr, typename Nhdr, typename ElfInterfaceType>
@@ -1399,8 +1394,7 @@ void ElfInterfaceTest::BuildIDSectionTooSmallForDesc () {
uint64_t load_bias = 0;
ASSERT_TRUE(elf->Init(&load_bias));
- std::string build_id;
- ASSERT_FALSE(elf->GetBuildID(&build_id));
+ ASSERT_EQ("", elf->GetBuildID());
}
template <typename Ehdr, typename Shdr, typename Nhdr, typename ElfInterfaceType>
@@ -1452,8 +1446,7 @@ void ElfInterfaceTest::BuildIDSectionTooSmallForHeader () {
uint64_t load_bias = 0;
ASSERT_TRUE(elf->Init(&load_bias));
- std::string build_id;
- ASSERT_FALSE(elf->GetBuildID(&build_id));
+ ASSERT_EQ("", elf->GetBuildID());
}
TEST_F(ElfInterfaceTest, build_id32) {