Use provided dex filenames in oat file.
Remove OatFile::RemoveRelativeEncodedDexFileLocation() and
use the provided `dex_filenames' (see below) if not empty,
without checking for prefix match or host/target build type.
Also add extra primary/multi-dex location checking when
opening an oat file. Since some tests were already creating
oat files from multiple dex files, rewrite the interface to
better support that option, replacing the old argument
`abs_dex_location` with `dex_filenames` that can provide
paths to multiple dex files.
Test: m test-art-host
Test: testrunner.py --host --optimizing
Test: aosp_taimen-userdebug boots.
Change-Id: I36a9abca72872c41e4c10fdacbeadf551ca740dc
diff --git a/dex2oat/dex2oat_test.cc b/dex2oat/dex2oat_test.cc
index bd439b7..7ff9b73 100644
--- a/dex2oat/dex2oat_test.cc
+++ b/dex2oat/dex2oat_test.cc
@@ -168,8 +168,7 @@
odex_location.c_str(),
/*executable=*/ false,
/*low_4gb=*/ false,
- dex_location.c_str(),
- /*reservation=*/ nullptr,
+ dex_location,
&error_msg));
if (odex_file == nullptr) {
return ::testing::AssertionFailure() << "Could not open odex file: " << error_msg;
@@ -191,8 +190,7 @@
odex_location.c_str(),
/*executable=*/ false,
/*low_4gb=*/ false,
- dex_location.c_str(),
- /*reservation=*/ nullptr,
+ dex_location,
&error_msg));
if (odex_file != nullptr) {
return ::testing::AssertionFailure() << "Could open odex file: " << error_msg;
@@ -533,8 +531,7 @@
odex_location.c_str(),
/*executable=*/ false,
/*low_4gb=*/ false,
- dex_location.c_str(),
- /*reservation=*/ nullptr,
+ dex_location,
&error_msg));
ASSERT_TRUE(odex_file.get() != nullptr) << error_msg;
EXPECT_GT(app_image_file.length(), 0u);
@@ -803,8 +800,7 @@
odex_location.c_str(),
/*executable=*/ false,
/*low_4gb=*/ false,
- dex_location.c_str(),
- /*reservation=*/ nullptr,
+ dex_location,
&error_msg));
ASSERT_TRUE(odex_file.get() != nullptr) << error_msg;
@@ -964,8 +960,7 @@
odex_location.c_str(),
/*executable=*/ false,
/*low_4gb=*/ false,
- dex_location.c_str(),
- /*reservation=*/ nullptr,
+ dex_location,
&error_msg));
ASSERT_TRUE(odex_file.get() != nullptr) << error_msg;
ASSERT_GE(odex_file->GetOatDexFiles().size(), 1u);
@@ -1410,8 +1405,7 @@
oat_filename.c_str(),
/*executable=*/ false,
/*low_4gb=*/ false,
- dex->GetLocation().c_str(),
- /*reservation=*/ nullptr,
+ dex->GetLocation(),
&error_msg));
ASSERT_TRUE(odex_file != nullptr);
std::vector<const OatDexFile*> oat_dex_files = odex_file->GetOatDexFiles();
@@ -1519,8 +1513,7 @@
oat_filename.c_str(),
/*executable=*/ false,
/*low_4gb=*/ false,
- dex_location.c_str(),
- /*reservation=*/ nullptr,
+ dex_location,
&error_msg));
ASSERT_TRUE(odex_file != nullptr);
std::vector<const OatDexFile*> oat_dex_files = odex_file->GetOatDexFiles();
@@ -1783,8 +1776,7 @@
oat_filename.c_str(),
/*executable=*/ false,
/*low_4gb=*/ false,
- temp_dex.GetFilename().c_str(),
- /*reservation=*/ nullptr,
+ temp_dex.GetFilename(),
&error_msg));
ASSERT_TRUE(odex_file != nullptr);
std::vector<const OatDexFile*> oat_dex_files = odex_file->GetOatDexFiles();
@@ -1860,8 +1852,7 @@
odex_location.c_str(),
/*executable=*/ false,
/*low_4gb=*/ false,
- dex_location.c_str(),
- /*reservation=*/ nullptr,
+ dex_location,
&error_msg));
ASSERT_TRUE(odex_file != nullptr);
ASSERT_STREQ("install", odex_file->GetCompilationReason());
@@ -1885,8 +1876,7 @@
odex_location.c_str(),
/*executable=*/ false,
/*low_4gb=*/ false,
- dex_location.c_str(),
- /*reservation=*/ nullptr,
+ dex_location,
&error_msg));
ASSERT_TRUE(odex_file != nullptr);
ASSERT_EQ(nullptr, odex_file->GetCompilationReason());
@@ -1922,8 +1912,7 @@
odex_location.c_str(),
/*executable=*/ false,
/*low_4gb=*/ false,
- dex_location.c_str(),
- /*reservation=*/ nullptr,
+ dex_location,
&error_msg));
ASSERT_TRUE(odex_file != nullptr) << dex_location;
std::vector<const OatDexFile*> oat_dex_files = odex_file->GetOatDexFiles();
@@ -2165,8 +2154,6 @@
odex_location.c_str(),
/*executable=*/ false,
/*low_4gb=*/ false,
- odex_location.c_str(),
- /*reservation=*/ nullptr,
&error_msg));
ASSERT_TRUE(odex_file != nullptr);
ImageHeader header = {};
@@ -2278,8 +2265,6 @@
odex_location.c_str(),
/*executable=*/ false,
/*low_4gb=*/ false,
- odex_location.c_str(),
- /*reservation=*/ nullptr,
&error_msg));
ASSERT_TRUE(odex_file != nullptr);
// Check the strings in the app image intern table only contain the "startup" strigs.