From e644f39c976671bb8786db49a1c5de7795b87db1 Mon Sep 17 00:00:00 2001 From: David Srbecky Date: Tue, 1 Aug 2023 17:21:12 +0100 Subject: Allow location duplicates when encoding class loader context Bug: 293664704 Test: Run the app from the above bug Test: m test-art-host-gtest-art_runtime_tests64 Change-Id: Ib2e3f0987c6cbc5f3cad1639a2259fc9882e0477 --- runtime/class_loader_context_test.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'runtime/class_loader_context_test.cc') diff --git a/runtime/class_loader_context_test.cc b/runtime/class_loader_context_test.cc index 98b8eed5d5..47a7f2d739 100644 --- a/runtime/class_loader_context_test.cc +++ b/runtime/class_loader_context_test.cc @@ -1258,6 +1258,17 @@ TEST_F(ClassLoaderContextTest, EncodeForDex2oatIMC) { ASSERT_EQ(expected_encoding, context->EncodeContextForDex2oat("")); } +TEST_F(ClassLoaderContextTest, EncodeForDex2oatDuplicates) { + std::string dex_name = GetTestDexFileName("Main"); + std::unique_ptr context = + ClassLoaderContext::Create("PCL[" + dex_name + ":" + dex_name + "]"); + ASSERT_TRUE(context->OpenDexFiles()); + + std::string encoding = context->EncodeContextForDex2oat(""); + std::string expected_encoding = "PCL[" + dex_name + "]"; + ASSERT_EQ(expected_encoding, context->EncodeContextForDex2oat("")); +} + TEST_F(ClassLoaderContextTest, EncodeContextsSinglePath) { jobject class_loader = LoadDexInPathClassLoader("Main", nullptr); std::unique_ptr context = -- cgit v1.2.3-59-g8ed1b