diff options
author | 2019-11-28 10:55:16 +0000 | |
---|---|---|
committer | 2019-11-28 15:42:23 +0000 | |
commit | 36ec598a4d887746291d003c97c2cb28b5987768 (patch) | |
tree | 65ad09ff02502ed74328f2f930f9301de85ad929 /runtime/class_loader_context_test.cc | |
parent | 457e9fa3833ef11530056d010f247ad087fd2184 (diff) |
Simplify name verification in ClassLoaderContext.
Do not go through OatFile::ResolveRelativeEncodedDexLocation
to avoid unnecessary handling of multi-dex suffix. That was
broken anyway because `abs_dex_location` is not expected to
be a multi-dex location as demonstrated by an additional
test which would have previously failed.
Test: Improved test in class_loader_context_test.
Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing
Change-Id: I0a292ed1442393a3de4e8a360593b607b1b37cfd
Diffstat (limited to 'runtime/class_loader_context_test.cc')
-rw-r--r-- | runtime/class_loader_context_test.cc | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/runtime/class_loader_context_test.cc b/runtime/class_loader_context_test.cc index 0c36fd42c2..008327834b 100644 --- a/runtime/class_loader_context_test.cc +++ b/runtime/class_loader_context_test.cc @@ -1402,7 +1402,18 @@ TEST_F(ClassLoaderContextTest, VerifyClassLoaderContextMatchAfterEncodingMultide std::unique_ptr<ClassLoaderContext> context = CreateContextForClassLoader(class_loader); - ASSERT_EQ(context->VerifyClassLoaderContextMatch(context->EncodeContextForOatFile("")), + std::string context_with_no_base_dir = context->EncodeContextForOatFile(""); + ASSERT_EQ(context->VerifyClassLoaderContextMatch(context_with_no_base_dir), + ClassLoaderContext::VerificationResult::kVerifies); + + std::string dex_location = GetTestDexFileName("MultiDex"); + size_t pos = dex_location.rfind('/'); + ASSERT_NE(std::string::npos, pos); + std::string parent = dex_location.substr(0, pos); + + std::string context_with_base_dir = context->EncodeContextForOatFile(parent); + ASSERT_NE(context_with_base_dir, context_with_no_base_dir); + ASSERT_EQ(context->VerifyClassLoaderContextMatch(context_with_base_dir), ClassLoaderContext::VerificationResult::kVerifies); } |