Revert "Reduce core image to core-{oj,libart,simple}."
This reverts commit ec91d48cade73c54f7a03c5d53d863bc2490976e.
Reason for revert: Breaks libcore tests.
Change-Id: I0ea55f74635332177eadd9a69fb831e7f5dc16c7
diff --git a/runtime/common_runtime_test.cc b/runtime/common_runtime_test.cc
index beec609..7388c2e 100644
--- a/runtime/common_runtime_test.cc
+++ b/runtime/common_runtime_test.cc
@@ -44,7 +44,6 @@
#include "dex/dex_file_loader.h"
#include "dex/primitive.h"
#include "gc/heap.h"
-#include "gc/space/image_space.h"
#include "gc_root-inl.h"
#include "gtest/gtest.h"
#include "handle_scope-inl.h"
@@ -112,14 +111,15 @@
std::string min_heap_string(StringPrintf("-Xms%zdm", gc::Heap::kDefaultInitialSize / MB));
std::string max_heap_string(StringPrintf("-Xmx%zdm", gc::Heap::kDefaultMaximumSize / MB));
+
RuntimeOptions options;
- std::string boot_class_path_string =
- GetClassPathOption("-Xbootclasspath:", GetLibCoreDexFileNames());
- std::string boot_class_path_locations_string =
- GetClassPathOption("-Xbootclasspath-locations:", GetLibCoreDexLocations());
+ std::string boot_class_path_string = "-Xbootclasspath";
+ for (const std::string &core_dex_file_name : GetLibCoreDexFileNames()) {
+ boot_class_path_string += ":";
+ boot_class_path_string += core_dex_file_name;
+ }
options.push_back(std::make_pair(boot_class_path_string, nullptr));
- options.push_back(std::make_pair(boot_class_path_locations_string, nullptr));
options.push_back(std::make_pair("-Xcheck:jni", nullptr));
options.push_back(std::make_pair(min_heap_string, nullptr));
options.push_back(std::make_pair(max_heap_string, nullptr));
@@ -382,38 +382,6 @@
}
}
-bool CommonRuntimeTestImpl::StartDex2OatCommandLine(/*out*/std::vector<std::string>* argv,
- /*out*/std::string* error_msg) {
- DCHECK(argv != nullptr);
- DCHECK(argv->empty());
-
- Runtime* runtime = Runtime::Current();
- const std::vector<gc::space::ImageSpace*>& image_spaces =
- runtime->GetHeap()->GetBootImageSpaces();
- if (image_spaces.empty()) {
- *error_msg = "No image location found for Dex2Oat.";
- return false;
- }
- std::string image_location = image_spaces[0]->GetImageLocation();
-
- argv->push_back(runtime->GetCompilerExecutable());
- if (runtime->IsJavaDebuggable()) {
- argv->push_back("--debuggable");
- }
- runtime->AddCurrentRuntimeFeaturesAsDex2OatArguments(argv);
-
- argv->push_back("--runtime-arg");
- argv->push_back(GetClassPathOption("-Xbootclasspath:", GetLibCoreDexFileNames()));
- argv->push_back("--runtime-arg");
- argv->push_back(GetClassPathOption("-Xbootclasspath-locations:", GetLibCoreDexLocations()));
-
- argv->push_back("--boot-image=" + image_location);
-
- std::vector<std::string> compiler_options = runtime->GetCompilerOptions();
- argv->insert(argv->end(), compiler_options.begin(), compiler_options.end());
- return true;
-}
-
CheckJniAbortCatcher::CheckJniAbortCatcher() : vm_(Runtime::Current()->GetJavaVM()) {
vm_->SetCheckJniAbortHook(Hook, &actual_);
}
diff --git a/runtime/common_runtime_test.h b/runtime/common_runtime_test.h
index f5b9058..c48ab36 100644
--- a/runtime/common_runtime_test.h
+++ b/runtime/common_runtime_test.h
@@ -97,9 +97,6 @@
return true;
}
- static bool StartDex2OatCommandLine(/*out*/std::vector<std::string>* argv,
- /*out*/std::string* error_msg);
-
protected:
// Allow subclases such as CommonCompilerTest to add extra options.
virtual void SetUpRuntimeOptions(RuntimeOptions* options ATTRIBUTE_UNUSED) {}
diff --git a/runtime/dexopt_test.cc b/runtime/dexopt_test.cc
index b46c933..f52a0f9 100644
--- a/runtime/dexopt_test.cc
+++ b/runtime/dexopt_test.cc
@@ -46,13 +46,26 @@
ReserveImageSpace();
}
-bool DexoptTest::Dex2Oat(const std::vector<std::string>& args, std::string* error_msg) {
- std::vector<std::string> argv;
- if (!CommonRuntimeTest::StartDex2OatCommandLine(&argv, error_msg)) {
- return false;
- }
-
+static std::string ImageLocation() {
Runtime* runtime = Runtime::Current();
+ const std::vector<gc::space::ImageSpace*>& image_spaces =
+ runtime->GetHeap()->GetBootImageSpaces();
+ if (image_spaces.empty()) {
+ return "";
+ }
+ return image_spaces[0]->GetImageLocation();
+}
+
+bool DexoptTest::Dex2Oat(const std::vector<std::string>& args, std::string* error_msg) {
+ Runtime* runtime = Runtime::Current();
+
+ std::vector<std::string> argv;
+ argv.push_back(runtime->GetCompilerExecutable());
+ if (runtime->IsJavaDebuggable()) {
+ argv.push_back("--debuggable");
+ }
+ runtime->AddCurrentRuntimeFeaturesAsDex2OatArguments(&argv);
+
if (runtime->GetHiddenApiEnforcementPolicy() != hiddenapi::EnforcementPolicy::kDisabled) {
argv.push_back("--runtime-arg");
argv.push_back("-Xhidden-api-checks");
@@ -62,6 +75,11 @@
argv.push_back("--host");
}
+ argv.push_back("--boot-image=" + ImageLocation());
+
+ std::vector<std::string> compiler_options = runtime->GetCompilerOptions();
+ argv.insert(argv.end(), compiler_options.begin(), compiler_options.end());
+
argv.insert(argv.end(), args.begin(), args.end());
std::string command_line(android::base::Join(argv, ' '));