summaryrefslogtreecommitdiff
path: root/runtime/class_linker_test.cc
diff options
context:
space:
mode:
author David Srbecky <dsrbecky@google.com> 2023-03-06 15:54:38 +0000
committer Treehugger Robot <treehugger-gerrit@google.com> 2023-03-06 18:37:19 +0000
commitb8a0d8b7fc4735ce20107a4f4a6a09dbcb2a6198 (patch)
tree30bce3c03fe020227108e822926586acb4eac2bd /runtime/class_linker_test.cc
parent92181e6b4622d456b9266eed43bf97ef6bd83784 (diff)
Add DexFileContainer for all DexFiles.
Ensure that all DexFiles have a container for consistency. Enforce that the container shall contain exactly one dex file, as specified the by file_size entry in the de header (that is, the memory range should not be truncated or too big). Bug: 266950186 Test: test.py -b --host --optimizing --64 Change-Id: I73ff074a980f9a9d5a0f4a9b51ac1a496971374f
Diffstat (limited to 'runtime/class_linker_test.cc')
-rw-r--r--runtime/class_linker_test.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/runtime/class_linker_test.cc b/runtime/class_linker_test.cc
index 274ca9d708..95b224f606 100644
--- a/runtime/class_linker_test.cc
+++ b/runtime/class_linker_test.cc
@@ -1543,12 +1543,14 @@ TEST_F(ClassLinkerTest, RegisterDexFileName) {
data)));
const DexFile* old_dex_file = dex_cache->GetDexFile();
+ auto container =
+ std::make_shared<MemoryDexFileContainer>(old_dex_file->Begin(), old_dex_file->Size());
std::unique_ptr<DexFile> dex_file(new StandardDexFile(old_dex_file->Begin(),
old_dex_file->Size(),
location->ToModifiedUtf8(),
0u,
nullptr,
- nullptr));
+ std::move(container)));
// Make a copy of the dex cache with changed name.
dex_cache.Assign(class_linker->AllocAndInitializeDexCache(Thread::Current(),
*dex_file,