diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2019-01-12 00:33:41 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2019-01-12 00:33:41 +0000 |
commit | 1c4ad71dffa5862a0a9649bee7dbf1d7991d4652 (patch) | |
tree | 6f84e1f91eaaa51ae4bb103f71fb3c43537d5ab8 | |
parent | a89bd8b72198364a89ab91277f5c870b95754189 (diff) | |
parent | 2677b802bf7ba044a6fc0c5d18d435ab9d6fb293 (diff) | |
download | system_core-1c4ad71dffa5862a0a9649bee7dbf1d7991d4652.tar.gz system_core-1c4ad71dffa5862a0a9649bee7dbf1d7991d4652.tar.bz2 system_core-1c4ad71dffa5862a0a9649bee7dbf1d7991d4652.zip |
Merge "Remove dependency on libdexfile internal header."
-rw-r--r-- | libunwindstack/Android.bp | 1 | ||||
-rw-r--r-- | libunwindstack/tests/DexFileTest.cpp | 26 |
2 files changed, 4 insertions, 23 deletions
diff --git a/libunwindstack/Android.bp b/libunwindstack/Android.bp index 89d4fc0e8..e267f5864 100644 --- a/libunwindstack/Android.bp +++ b/libunwindstack/Android.bp @@ -221,7 +221,6 @@ cc_test { "liblog", "liblzma", "libunwindstack", - "libdexfile", "libdexfile_support", ], diff --git a/libunwindstack/tests/DexFileTest.cpp b/libunwindstack/tests/DexFileTest.cpp index 21ca47b52..0149a42c7 100644 --- a/libunwindstack/tests/DexFileTest.cpp +++ b/libunwindstack/tests/DexFileTest.cpp @@ -21,7 +21,6 @@ #include <unordered_map> #include <android-base/file.h> -#include <dex/dex_file.h> #include <gtest/gtest.h> #include <unwindstack/MapInfo.h> #include <unwindstack/Memory.h> @@ -40,17 +39,15 @@ TEST(DexFileTest, from_file_open_too_small) { TemporaryFile tf; ASSERT_TRUE(tf.fd != -1); - ASSERT_EQ(sizeof(art::DexFile::Header) - 1, - static_cast<size_t>( - TEMP_FAILURE_RETRY(write(tf.fd, kDexData, sizeof(art::DexFile::Header) - 1)))); + ASSERT_EQ(size_t{10}, static_cast<size_t>(TEMP_FAILURE_RETRY(write(tf.fd, kDexData, 10)))); // Header too small. EXPECT_TRUE(DexFileFromFile::Create(0, tf.path) == nullptr); // Header correct, file too small. ASSERT_EQ(0, lseek(tf.fd, 0, SEEK_SET)); - ASSERT_EQ(sizeof(art::DexFile::Header), static_cast<size_t>(TEMP_FAILURE_RETRY(write( - tf.fd, kDexData, sizeof(art::DexFile::Header))))); + ASSERT_EQ(sizeof(kDexData) - 1, + static_cast<size_t>(TEMP_FAILURE_RETRY(write(tf.fd, kDexData, sizeof(kDexData) - 1)))); EXPECT_TRUE(DexFileFromFile::Create(0, tf.path) == nullptr); } @@ -78,7 +75,7 @@ TEST(DexFileTest, from_file_open_non_zero_offset) { TEST(DexFileTest, from_memory_fail_too_small_for_header) { MemoryFake memory; - memory.SetMemory(0x1000, kDexData, sizeof(art::DexFile::Header) - 1); + memory.SetMemory(0x1000, kDexData, 10); EXPECT_TRUE(DexFileFromMemory::Create(0x1000, &memory, "") == nullptr); } @@ -187,15 +184,6 @@ TEST(DexFileTest, get_method) { ASSERT_TRUE(dex_file->GetMethodInformation(0x118, &method, &method_offset)); EXPECT_EQ("Main.main", method); EXPECT_EQ(0U, method_offset); - - // Make sure that any data that is cached is still retrievable. - ASSERT_TRUE(dex_file->GetMethodInformation(0x104, &method, &method_offset)); - EXPECT_EQ("Main.<init>", method); - EXPECT_EQ(4U, method_offset); - - ASSERT_TRUE(dex_file->GetMethodInformation(0x119, &method, &method_offset)); - EXPECT_EQ("Main.main", method); - EXPECT_EQ(1U, method_offset); } TEST(DexFileTest, get_method_empty) { @@ -210,12 +198,6 @@ TEST(DexFileTest, get_method_empty) { EXPECT_FALSE(dex_file->GetMethodInformation(0x100000, &method, &method_offset)); EXPECT_FALSE(dex_file->GetMethodInformation(0x98, &method, &method_offset)); - - // Make sure that once the whole dex file has been cached, no problems occur. - EXPECT_FALSE(dex_file->GetMethodInformation(0x98, &method, &method_offset)); - - // Choose a value that is in the cached map, but not in a valid method. - EXPECT_FALSE(dex_file->GetMethodInformation(0x110, &method, &method_offset)); } } // namespace unwindstack |