summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--odrefresh/odrefresh.cc10
-rw-r--r--odrefresh/odrefresh_test.cc30
2 files changed, 30 insertions, 10 deletions
diff --git a/odrefresh/odrefresh.cc b/odrefresh/odrefresh.cc
index fc782bc697..92912b7bfa 100644
--- a/odrefresh/odrefresh.cc
+++ b/odrefresh/odrefresh.cc
@@ -1762,7 +1762,6 @@ WARN_UNUSED CompilationResult OnDeviceRefresh::RunDex2oat(
}
}
- args.Add("--oat-location=%s", artifacts.OatPath());
std::pair<std::string, const char*> location_kind_pairs[] = {
std::make_pair(artifacts.ImagePath(), artifacts.ImageKind()),
std::make_pair(artifacts.OatPath(), "oat"),
@@ -1910,9 +1909,16 @@ OnDeviceRefresh::RunDex2oatForBootClasspath(const std::string& staging_dir,
preloaded_classes_file,
strerror(errno)));
}
+ args.Add("--oat-location=%s", OdrArtifacts::ForBootImage(output_path).OatPath());
} else {
// Mainline extension.
args.Add("--compiler-filter=%s", kMainlineCompilerFilter);
+ // For boot image extensions, dex2oat takes the oat location of the primary boot image and
+ // expends it with the name of the first input dex file.
+ args.Add("--oat-location=%s",
+ OdrArtifacts::ForBootImage(
+ GetPrimaryBootImagePath(/*on_system=*/false, /*minimal=*/false, isa))
+ .OatPath());
}
const OdrSystemProperties& system_properties = config_.GetSystemProperties();
@@ -2080,6 +2086,8 @@ WARN_UNUSED CompilationResult OnDeviceRefresh::RunDex2oatForSystemServer(
args.Add("--class-loader-context-fds=%s", Join(fds, ':'));
}
+ args.Add("--oat-location=%s", OdrArtifacts::ForSystemServer(output_path).OatPath());
+
const OdrSystemProperties& system_properties = config_.GetSystemProperties();
args.AddRuntimeIfNonEmpty("-Xms%s", system_properties.GetOrEmpty("dalvik.vm.dex2oat-Xms"))
.AddRuntimeIfNonEmpty("-Xmx%s", system_properties.GetOrEmpty("dalvik.vm.dex2oat-Xmx"));
diff --git a/odrefresh/odrefresh_test.cc b/odrefresh/odrefresh_test.cc
index b19a4225b4..7f4e990ffe 100644
--- a/odrefresh/odrefresh_test.cc
+++ b/odrefresh/odrefresh_test.cc
@@ -48,12 +48,14 @@
namespace art {
namespace odrefresh {
+using ::android::base::Basename;
using ::android::base::Split;
using ::android::modules::sdklevel::IsAtLeastU;
using ::testing::_;
using ::testing::AllOf;
using ::testing::Contains;
using ::testing::ElementsAre;
+using ::testing::EndsWith;
using ::testing::Not;
using ::testing::ResultOf;
using ::testing::Return;
@@ -336,7 +338,7 @@ TEST_F(OdRefreshTest, BootImageMainlineExtension) {
FdOf(framework_jar_),
FdOf(conscrypt_jar_),
FdOf(framework_wifi_jar_)))),
- Contains(Flag("--oat-location=", dalvik_cache_dir_ + "/x86_64/boot-conscrypt.oat")),
+ Contains(Flag("--oat-location=", dalvik_cache_dir_ + "/x86_64/boot.oat")),
Not(Contains(Flag("--base=", _))),
Contains(Flag("--boot-image=", _)),
Contains(Flag("--cache-info-fd=", FdOf(cache_info_xml_))))))
@@ -435,11 +437,15 @@ TEST_F(OdRefreshTest, BootClasspathJarsFallback) {
}
TEST_F(OdRefreshTest, AllSystemServerJars) {
- EXPECT_CALL(*mock_exec_utils_,
- DoExecAndReturnCode(AllOf(Contains(Flag("--dex-file=", location_provider_jar_)),
- Contains("--class-loader-context=PCL[]"),
- Not(Contains(Flag("--class-loader-context-fds=", _))),
- Contains(Flag("--cache-info-fd=", FdOf(cache_info_xml_))))))
+ EXPECT_CALL(
+ *mock_exec_utils_,
+ DoExecAndReturnCode(AllOf(
+ Contains(Flag("--dex-file=", location_provider_jar_)),
+ Contains("--class-loader-context=PCL[]"),
+ Not(Contains(Flag("--class-loader-context-fds=", _))),
+ Contains(Flag("--cache-info-fd=", FdOf(cache_info_xml_))),
+ Contains(Flag("--oat-location=",
+ EndsWith("@" + Basename(location_provider_jar_) + "@classes.odex"))))))
.WillOnce(Return(0));
EXPECT_CALL(
*mock_exec_utils_,
@@ -447,7 +453,9 @@ TEST_F(OdRefreshTest, AllSystemServerJars) {
Contains(Flag("--dex-file=", services_jar_)),
Contains(Flag("--class-loader-context=", ART_FORMAT("PCL[{}]", location_provider_jar_))),
Contains(Flag("--class-loader-context-fds=", FdOf(location_provider_jar_))),
- Contains(Flag("--cache-info-fd=", FdOf(cache_info_xml_))))))
+ Contains(Flag("--cache-info-fd=", FdOf(cache_info_xml_))),
+ Contains(
+ Flag("--oat-location=", EndsWith("@" + Basename(services_jar_) + "@classes.odex"))))))
.WillOnce(Return(0));
EXPECT_CALL(
*mock_exec_utils_,
@@ -457,7 +465,9 @@ TEST_F(OdRefreshTest, AllSystemServerJars) {
ART_FORMAT("PCL[];PCL[{}:{}]", location_provider_jar_, services_jar_))),
Contains(ListFlag("--class-loader-context-fds=",
ElementsAre(FdOf(location_provider_jar_), FdOf(services_jar_)))),
- Contains(Flag("--cache-info-fd=", FdOf(cache_info_xml_))))))
+ Contains(Flag("--cache-info-fd=", FdOf(cache_info_xml_))),
+ Contains(Flag("--oat-location=",
+ EndsWith("@" + Basename(services_foo_jar_) + "@classes.odex"))))))
.WillOnce(Return(0));
EXPECT_CALL(
*mock_exec_utils_,
@@ -467,7 +477,9 @@ TEST_F(OdRefreshTest, AllSystemServerJars) {
ART_FORMAT("PCL[];PCL[{}:{}]", location_provider_jar_, services_jar_))),
Contains(ListFlag("--class-loader-context-fds=",
ElementsAre(FdOf(location_provider_jar_), FdOf(services_jar_)))),
- Contains(Flag("--cache-info-fd=", FdOf(cache_info_xml_))))))
+ Contains(Flag("--cache-info-fd=", FdOf(cache_info_xml_))),
+ Contains(Flag("--oat-location=",
+ EndsWith("@" + Basename(services_bar_jar_) + "@classes.odex"))))))
.WillOnce(Return(0));
EXPECT_EQ(