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/runtime/gc/space/image_space_test.cc b/runtime/gc/space/image_space_test.cc
index 008793b..580b490 100644
--- a/runtime/gc/space/image_space_test.cc
+++ b/runtime/gc/space/image_space_test.cc
@@ -51,11 +51,23 @@
oat_location.c_str(),
/*executable=*/ false,
/*low_4gb=*/ false,
- /*abs_dex_location=*/ nullptr,
- /*reservation=*/ nullptr,
&error_msg));
ASSERT_TRUE(oat != nullptr) << error_msg;
+ {
+ // Test opening the oat file also with explicit dex filenames.
+ std::vector<std::string> dex_filenames{ dex1, multidex1, dex2 };
+ std::unique_ptr<OatFile> oat2(OatFile::Open(/*zip_fd=*/ -1,
+ oat_location.c_str(),
+ oat_location.c_str(),
+ /*executable=*/ false,
+ /*low_4gb=*/ false,
+ ArrayRef<const std::string>(dex_filenames),
+ /*reservation=*/ nullptr,
+ &error_msg));
+ ASSERT_TRUE(oat2 != nullptr) << error_msg;
+ }
+
// Originally all the dex checksums should be up to date.
EXPECT_TRUE(ImageSpace::ValidateOatFile(*oat, &error_msg)) << error_msg;