diff options
| author | Vladimir Marko <vmarko@google.com> | 2018-12-03 18:47:23 +0000 |
|---|---|---|
| committer | Vladimir Marko <vmarko@google.com> | 2018-12-04 17:17:19 +0000 |
| commit | 7a85e70b2bf646d1d7a226fbb4e7fafb66871dd5 (patch) | |
| tree | 790ee4c1cee812535c856a08355c50c2032c5cd4 | |
| parent | 6a98f89c4ad645b04d6c80d3d7e260c59bf6f193 (diff) | |
| download | art-7a85e70b2bf646d1d7a226fbb4e7fafb66871dd5.tar.gz art-7a85e70b2bf646d1d7a226fbb4e7fafb66871dd5.tar.bz2 art-7a85e70b2bf646d1d7a226fbb4e7fafb66871dd5.zip | |
Reduce core image to 6 modules.
This was
Revert^2 "Reduce core image to core-{oj,libart,simple}."
but we're now keeping three additional modules, namely
conscrypt, okhttp and bouncycastle. And we fix the boot
class path used by vogar with the companion change
https://android-review.googlesource.com/840810 .
This reverts commit 00fe35e4021e9a8679eca3ffaede48fd89b56258.
Change-Id: I6137edd91c03c17be50de200267eb9adc971e8fb
Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing
Test: Pixel 3 XL boots.
Test: m test-art-target-gtest
Test: testrunner.py --target --optimizing
Test: art/tools/run-libcore-tests.sh --mode=device --variant=X64
Bug: 119868597
| -rw-r--r-- | build/Android.common_path.mk | 17 | ||||
| -rw-r--r-- | build/Android.common_test.mk | 4 | ||||
| -rw-r--r-- | build/Android.gtest.mk | 5 | ||||
| -rw-r--r-- | dex2oat/dex2oat_test.cc | 23 | ||||
| -rw-r--r-- | dex2oat/linker/image_test.h | 3 | ||||
| -rw-r--r-- | dexoptanalyzer/dexoptanalyzer_test.cc | 4 | ||||
| -rw-r--r-- | imgdiag/imgdiag_test.cc | 28 | ||||
| -rw-r--r-- | libartbase/base/common_art_test.cc | 46 | ||||
| -rw-r--r-- | libartbase/base/common_art_test.h | 6 | ||||
| -rw-r--r-- | oatdump/oatdump_test.h | 9 | ||||
| -rw-r--r-- | runtime/common_runtime_test.cc | 44 | ||||
| -rw-r--r-- | runtime/common_runtime_test.h | 3 | ||||
| -rw-r--r-- | runtime/dexopt_test.cc | 24 | ||||
| -rw-r--r-- | test/118-noimage-dex2oat/run | 21 | ||||
| -rw-r--r-- | test/Android.run-test.mk | 2 | ||||
| -rwxr-xr-x | test/etc/run-test-jar | 45 | ||||
| -rwxr-xr-x | tools/bootjars.sh | 26 |
17 files changed, 193 insertions, 117 deletions
diff --git a/build/Android.common_path.mk b/build/Android.common_path.mk index 96d3648ff6..03e68ae93c 100644 --- a/build/Android.common_path.mk +++ b/build/Android.common_path.mk @@ -74,18 +74,21 @@ HOST_CORE_IMG_LOCATION := $(HOST_OUT_JAVA_LIBRARIES)/core.art TARGET_CORE_IMG_LOCATION := $(ART_TARGET_TEST_OUT)/core.art # Jar files for core.art. -HOST_CORE_DEX_LOCATIONS := $(foreach jar,$(HOST_CORE_JARS), $(HOST_OUT_JAVA_LIBRARIES)/$(jar).jar) +TEST_CORE_JARS := core-oj core-libart core-simple conscrypt okhttp bouncycastle +HOST_TEST_CORE_JARS := $(addsuffix -hostdex,$(TEST_CORE_JARS)) +TARGET_TEST_CORE_JARS := $(addsuffix -testdex,$(TEST_CORE_JARS)) +HOST_CORE_DEX_LOCATIONS := $(foreach jar,$(HOST_TEST_CORE_JARS), $(HOST_OUT_JAVA_LIBRARIES)/$(jar).jar) ifeq ($(ART_TEST_ANDROID_ROOT),) -TARGET_CORE_DEX_LOCATIONS := $(foreach jar,$(TARGET_CORE_JARS),/$(DEXPREOPT_BOOT_JAR_DIR)/$(jar).jar) +TARGET_CORE_DEX_LOCATIONS := $(foreach jar,$(TARGET_TEST_CORE_JARS),/$(DEXPREOPT_BOOT_JAR_DIR)/$(jar).jar) else -TARGET_CORE_DEX_LOCATIONS := $(foreach jar,$(TARGET_CORE_JARS),$(ART_TEST_ANDROID_ROOT)/framework/$(jar).jar) +TARGET_CORE_DEX_LOCATIONS := $(foreach jar,$(TARGET_TEST_CORE_JARS),$(ART_TEST_ANDROID_ROOT)/framework/$(jar).jar) endif -HOST_CORE_DEX_FILES := $(foreach jar,$(HOST_CORE_JARS), $(call intermediates-dir-for,JAVA_LIBRARIES,$(jar),t,COMMON)/javalib.jar) -TARGET_CORE_DEX_FILES := $(foreach jar,$(TARGET_CORE_JARS),$(call intermediates-dir-for,JAVA_LIBRARIES,$(jar), ,COMMON)/javalib.jar) +HOST_CORE_DEX_FILES := $(foreach jar,$(HOST_TEST_CORE_JARS), $(call intermediates-dir-for,JAVA_LIBRARIES,$(jar),t,COMMON)/javalib.jar) +TARGET_CORE_DEX_FILES := $(foreach jar,$(TARGET_TEST_CORE_JARS),$(call intermediates-dir-for,JAVA_LIBRARIES,$(jar), ,COMMON)/javalib.jar) -ART_HOST_DEX_DEPENDENCIES := $(foreach jar,$(HOST_CORE_JARS),$(HOST_OUT_JAVA_LIBRARIES)/$(jar).jar) -ART_TARGET_DEX_DEPENDENCIES := $(foreach jar,$(TARGET_CORE_JARS),$(TARGET_OUT_JAVA_LIBRARIES)/$(jar).jar) +ART_HOST_DEX_DEPENDENCIES := $(foreach jar,$(HOST_TEST_CORE_JARS),$(HOST_OUT_JAVA_LIBRARIES)/$(jar).jar) +ART_TARGET_DEX_DEPENDENCIES := $(foreach jar,$(TARGET_TEST_CORE_JARS),$(TARGET_OUT_JAVA_LIBRARIES)/$(jar).jar) ART_CORE_SHARED_LIBRARIES := libjavacore libopenjdk libopenjdkjvm libopenjdkjvmti ART_CORE_SHARED_DEBUG_LIBRARIES := libopenjdkd libopenjdkjvmd libopenjdkjvmtid diff --git a/build/Android.common_test.mk b/build/Android.common_test.mk index 17d0232c04..d8014bd55f 100644 --- a/build/Android.common_test.mk +++ b/build/Android.common_test.mk @@ -129,7 +129,7 @@ define build-art-test-dex LOCAL_DEX_PREOPT := false LOCAL_ADDITIONAL_DEPENDENCIES := art/build/Android.common_test.mk $(4) LOCAL_MODULE_TAGS := tests - LOCAL_JAVA_LIBRARIES := $(TARGET_CORE_JARS) + LOCAL_JAVA_LIBRARIES := $(TARGET_TEST_CORE_JARS) LOCAL_MODULE_PATH := $(3) LOCAL_DEX_PREOPT_IMAGE_LOCATION := $(TARGET_CORE_IMG_OUT) ifneq ($(wildcard $(LOCAL_PATH)/$(2)/main.list),) @@ -145,7 +145,7 @@ define build-art-test-dex LOCAL_NO_STANDARD_LIBRARIES := true LOCAL_DEX_PREOPT := false LOCAL_ADDITIONAL_DEPENDENCIES := art/build/Android.common_test.mk $(4) - LOCAL_JAVA_LIBRARIES := $(HOST_CORE_JARS) + LOCAL_JAVA_LIBRARIES := $(HOST_TEST_CORE_JARS) LOCAL_DEX_PREOPT_IMAGE := $(HOST_CORE_IMG_LOCATION) ifneq ($(wildcard $(LOCAL_PATH)/$(2)/main.list),) LOCAL_DX_FLAGS := --multi-dex --main-dex-list=$(LOCAL_PATH)/$(2)/main.list --minimal-main-dex diff --git a/build/Android.gtest.mk b/build/Android.gtest.mk index 9a5e26b178..6885946c40 100644 --- a/build/Android.gtest.mk +++ b/build/Android.gtest.mk @@ -454,7 +454,10 @@ define define-art-gtest-rule-target $$($(3)TARGET_OUT_SHARED_LIBRARIES)/libopenjdkd.so \ $$(TARGET_OUT_JAVA_LIBRARIES)/core-libart-testdex.jar \ $$(TARGET_OUT_JAVA_LIBRARIES)/core-oj-testdex.jar \ - $$(TARGET_OUT_JAVA_LIBRARIES)/core-simple-testdex.jar + $$(TARGET_OUT_JAVA_LIBRARIES)/core-simple-testdex.jar \ + $$(TARGET_OUT_JAVA_LIBRARIES)/conscrypt-testdex.jar \ + $$(TARGET_OUT_JAVA_LIBRARIES)/okhttp-testdex.jar \ + $$(TARGET_OUT_JAVA_LIBRARIES)/bouncycastle-testdex.jar ART_TEST_TARGET_GTEST_DEPENDENCIES += $$(gtest_deps) diff --git a/dex2oat/dex2oat_test.cc b/dex2oat/dex2oat_test.cc index 97a5f2453e..92dd9328b3 100644 --- a/dex2oat/dex2oat_test.cc +++ b/dex2oat/dex2oat_test.cc @@ -192,24 +192,12 @@ class Dex2oatTest : public Dex2oatEnvironmentTest { } int Dex2Oat(const std::vector<std::string>& dex2oat_args, std::string* error_msg) { - 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(); - std::vector<std::string> argv; - argv.push_back(runtime->GetCompilerExecutable()); - - if (runtime->IsJavaDebuggable()) { - argv.push_back("--debuggable"); + if (!CommonRuntimeTest::StartDex2OatCommandLine(&argv, error_msg)) { + return false; } - runtime->AddCurrentRuntimeFeaturesAsDex2OatArguments(&argv); + Runtime* runtime = Runtime::Current(); if (!runtime->IsVerificationEnabled()) { argv.push_back("--compiler-filter=assume-verified"); } @@ -226,11 +214,6 @@ class Dex2oatTest : public Dex2oatEnvironmentTest { argv.push_back("--host"); } - 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()); - argv.insert(argv.end(), dex2oat_args.begin(), dex2oat_args.end()); // We must set --android-root. diff --git a/dex2oat/linker/image_test.h b/dex2oat/linker/image_test.h index 844a72803e..6ffcef12a7 100644 --- a/dex2oat/linker/image_test.h +++ b/dex2oat/linker/image_test.h @@ -442,6 +442,9 @@ inline void ImageTest::TestWriteRead(ImageHeader::StorageMode storage_mode, MemMap::Init(); RuntimeOptions options; + options.emplace_back(GetClassPathOption("-Xbootclasspath:", GetLibCoreDexFileNames()), nullptr); + options.emplace_back( + GetClassPathOption("-Xbootclasspath-locations:", GetLibCoreDexLocations()), nullptr); std::string image("-Ximage:"); image.append(helper.image_locations[0].GetFilename()); options.push_back(std::make_pair(image.c_str(), static_cast<void*>(nullptr))); diff --git a/dexoptanalyzer/dexoptanalyzer_test.cc b/dexoptanalyzer/dexoptanalyzer_test.cc index b9116f0fb8..f6fd1fb014 100644 --- a/dexoptanalyzer/dexoptanalyzer_test.cc +++ b/dexoptanalyzer/dexoptanalyzer_test.cc @@ -46,6 +46,10 @@ class DexoptAnalyzerTest : public DexoptTest { if (assume_profile_changed) { argv_str.push_back("--assume-profile-changed"); } + argv_str.push_back("--runtime-arg"); + argv_str.push_back(GetClassPathOption("-Xbootclasspath:", GetLibCoreDexFileNames())); + argv_str.push_back("--runtime-arg"); + argv_str.push_back(GetClassPathOption("-Xbootclasspath-locations:", GetLibCoreDexLocations())); argv_str.push_back("--image=" + GetImageLocation()); argv_str.push_back("--android-data=" + android_data_); diff --git a/imgdiag/imgdiag_test.cc b/imgdiag/imgdiag_test.cc index 73df2a2b03..739d9b8329 100644 --- a/imgdiag/imgdiag_test.cc +++ b/imgdiag/imgdiag_test.cc @@ -34,12 +34,8 @@ namespace art { -static const char* kImgDiagDiffPid = "--image-diff-pid"; -static const char* kImgDiagBootImage = "--boot-image"; static const char* kImgDiagBinaryName = "imgdiag"; -static const char* kImgDiagZygoteDiffPid = "--zygote-diff-pid"; - // from kernel <include/linux/threads.h> #define PID_MAX_LIMIT (4*1024*1024) // Upper bound. Most kernel configs will have smaller max pid. @@ -93,25 +89,15 @@ class ImgDiagTest : public CommonRuntimeTest { EXPECT_TRUE(OS::FileExists(file_path.c_str())) << file_path << " should be a valid file path"; // Run imgdiag --image-diff-pid=$image_diff_pid and wait until it's done with a 0 exit code. - std::string diff_pid_args; - std::string zygote_diff_pid_args; - { - std::stringstream diff_pid_args_ss; - diff_pid_args_ss << kImgDiagDiffPid << "=" << image_diff_pid; - diff_pid_args = diff_pid_args_ss.str(); - } - { - std::stringstream zygote_pid_args_ss; - zygote_pid_args_ss << kImgDiagZygoteDiffPid << "=" << image_diff_pid; - zygote_diff_pid_args = zygote_pid_args_ss.str(); - } - std::string boot_image_args = std::string(kImgDiagBootImage) + "=" + boot_image; - std::vector<std::string> exec_argv = { file_path, - diff_pid_args, - zygote_diff_pid_args, - boot_image_args + "--image-diff-pid=" + std::to_string(image_diff_pid), + "--zygote-diff-pid=" + std::to_string(image_diff_pid), + "--runtime-arg", + GetClassPathOption("-Xbootclasspath:", GetLibCoreDexFileNames()), + "--runtime-arg", + GetClassPathOption("-Xbootclasspath-locations:", GetLibCoreDexLocations()), + "--boot-image=" + boot_image }; return ::art::Exec(exec_argv, error_msg); diff --git a/libartbase/base/common_art_test.cc b/libartbase/base/common_art_test.cc index 5a0b425bca..278203da23 100644 --- a/libartbase/base/common_art_test.cc +++ b/libartbase/base/common_art_test.cc @@ -24,6 +24,7 @@ #include "nativehelper/scoped_local_ref.h" #include "android-base/stringprintf.h" +#include "android-base/strings.h" #include "android-base/unique_fd.h" #include <unicode/uvernum.h> @@ -328,9 +329,48 @@ static std::string GetDexFileName(const std::string& jar_prefix, bool host) { } std::vector<std::string> CommonArtTestImpl::GetLibCoreDexFileNames() { - return std::vector<std::string>({GetDexFileName("core-oj", IsHost()), - GetDexFileName("core-libart", IsHost()), - GetDexFileName("core-simple", IsHost())}); + // Note: This must match the TEST_CORE_JARS in Android.common_path.mk + // because that's what we use for compiling the core.art image. + static const char* const kLibcoreModules[] = { + "core-oj", + "core-libart", + "core-simple", + "conscrypt", + "okhttp", + "bouncycastle", + }; + + std::vector<std::string> result; + result.reserve(arraysize(kLibcoreModules)); + for (const char* module : kLibcoreModules) { + result.push_back(GetDexFileName(module, IsHost())); + } + return result; +} + +std::vector<std::string> CommonArtTestImpl::GetLibCoreDexLocations() { + std::vector<std::string> result = GetLibCoreDexFileNames(); + if (IsHost()) { + // Strip the ANDROID_BUILD_TOP directory including the directory separator '/'. + const char* host_dir = getenv("ANDROID_BUILD_TOP"); + CHECK(host_dir != nullptr); + std::string prefix = host_dir; + CHECK(!prefix.empty()); + if (prefix.back() != '/') { + prefix += '/'; + } + for (std::string& location : result) { + CHECK_GT(location.size(), prefix.size()); + CHECK_EQ(location.compare(0u, prefix.size(), prefix), 0); + location.erase(0u, prefix.size()); + } + } + return result; +} + +std::string CommonArtTestImpl::GetClassPathOption(const char* option, + const std::vector<std::string>& class_path) { + return option + android::base::Join(class_path, ':'); } std::string CommonArtTestImpl::GetTestAndroidRoot() { diff --git a/libartbase/base/common_art_test.h b/libartbase/base/common_art_test.h index 0f4800dfc5..3e2340f0a7 100644 --- a/libartbase/base/common_art_test.h +++ b/libartbase/base/common_art_test.h @@ -99,6 +99,12 @@ class CommonArtTestImpl { // Gets the paths of the libcore dex files. static std::vector<std::string> GetLibCoreDexFileNames(); + // Gets the locations of the libcore dex files. + static std::vector<std::string> GetLibCoreDexLocations(); + + static std::string GetClassPathOption(const char* option, + const std::vector<std::string>& class_path); + // Returns bin directory which contains host's prebuild tools. static std::string GetAndroidHostToolsDir(); diff --git a/oatdump/oatdump_test.h b/oatdump/oatdump_test.h index 4ee510130b..728939f93c 100644 --- a/oatdump/oatdump_test.h +++ b/oatdump/oatdump_test.h @@ -122,6 +122,10 @@ class OatDumpTest : public CommonRuntimeTest { "-Xmx512m", "--runtime-arg", "-Xnorelocate", + "--runtime-arg", + GetClassPathOption("-Xbootclasspath:", GetLibCoreDexFileNames()), + "--runtime-arg", + GetClassPathOption("-Xbootclasspath-locations:", GetLibCoreDexLocations()), "--boot-image=" + GetCoreArtLocation(), "--instruction-set=" + std::string(GetInstructionSetString(kRuntimeISA)), "--dex-file=" + GetTestDexFileName(GetAppBaseName().c_str()), @@ -181,6 +185,11 @@ class OatDumpTest : public CommonRuntimeTest { expected_prefixes.push_back("IMAGE BEGIN:"); expected_prefixes.push_back("kDexCaches:"); } else if (mode == kModeOatWithBootImage) { + exec_argv.push_back("--runtime-arg"); + exec_argv.push_back(GetClassPathOption("-Xbootclasspath:", GetLibCoreDexFileNames())); + exec_argv.push_back("--runtime-arg"); + exec_argv.push_back( + GetClassPathOption("-Xbootclasspath-locations:", GetLibCoreDexLocations())); exec_argv.push_back("--boot-image=" + GetCoreArtLocation()); exec_argv.push_back("--instruction-set=" + std::string( GetInstructionSetString(kRuntimeISA))); diff --git a/runtime/common_runtime_test.cc b/runtime/common_runtime_test.cc index 0300fa155f..a101976a87 100644 --- a/runtime/common_runtime_test.cc +++ b/runtime/common_runtime_test.cc @@ -44,6 +44,7 @@ #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" @@ -111,15 +112,14 @@ void CommonRuntimeTestImpl::SetUp() { 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 = "-Xbootclasspath"; - for (const std::string &core_dex_file_name : GetLibCoreDexFileNames()) { - boot_class_path_string += ":"; - boot_class_path_string += core_dex_file_name; - } + std::string boot_class_path_string = + GetClassPathOption("-Xbootclasspath:", GetLibCoreDexFileNames()); + std::string boot_class_path_locations_string = + GetClassPathOption("-Xbootclasspath-locations:", GetLibCoreDexLocations()); 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)); @@ -386,6 +386,38 @@ void CommonRuntimeTestImpl::SetUpRuntimeOptionsForFillHeap(RuntimeOptions *optio } } +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 0fee797015..319c7c7111 100644 --- a/runtime/common_runtime_test.h +++ b/runtime/common_runtime_test.h @@ -97,6 +97,9 @@ class CommonRuntimeTestImpl : public CommonArtTestImpl { 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 f52a0f9430..b46c93383e 100644 --- a/runtime/dexopt_test.cc +++ b/runtime/dexopt_test.cc @@ -46,26 +46,13 @@ void DexoptTest::PostRuntimeCreate() { ReserveImageSpace(); } -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"); + if (!CommonRuntimeTest::StartDex2OatCommandLine(&argv, error_msg)) { + return false; } - runtime->AddCurrentRuntimeFeaturesAsDex2OatArguments(&argv); + Runtime* runtime = Runtime::Current(); if (runtime->GetHiddenApiEnforcementPolicy() != hiddenapi::EnforcementPolicy::kDisabled) { argv.push_back("--runtime-arg"); argv.push_back("-Xhidden-api-checks"); @@ -75,11 +62,6 @@ bool DexoptTest::Dex2Oat(const std::vector<std::string>& args, std::string* erro 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, ' ')); diff --git a/test/118-noimage-dex2oat/run b/test/118-noimage-dex2oat/run index d68b0a0b2c..d1b9725628 100644 --- a/test/118-noimage-dex2oat/run +++ b/test/118-noimage-dex2oat/run @@ -31,39 +31,26 @@ if [[ "${flags}" == *--no-relocate* ]] ; then exit 1 fi -if [[ $@ == *--host* ]]; then - framework="${ANDROID_HOST_OUT}/framework" - bpath_suffix="-hostdex" -else - framework="/system/framework" - bpath_suffix="" -fi -bpath="${framework}/core-libart${bpath_suffix}.jar" -bpath="${bpath}:${framework}/conscrypt${bpath_suffix}.jar" -bpath="${bpath}:${framework}/okhttp${bpath_suffix}.jar" -bpath="${bpath}:${framework}/bouncycastle${bpath_suffix}.jar" -bpath_arg="--runtime-option -Xbootclasspath:${bpath}" - # Make sure we can run without an oat file. echo "Run -Xnoimage-dex2oat" -${RUN} ${flags} ${bpath_arg} --runtime-option -Xnoimage-dex2oat +${RUN} ${flags} --runtime-option -Xnoimage-dex2oat return_status1=$? # Make sure we cannot run without an oat file without fallback. echo "Run -Xnoimage-dex2oat -Xno-dex-file-fallback" -${RUN} ${flags} ${bpath_arg} --runtime-option -Xnoimage-dex2oat \ +${RUN} ${flags} --runtime-option -Xnoimage-dex2oat \ --runtime-option -Xno-dex-file-fallback return_status2=$? # Make sure we can run with the oat file. echo "Run -Ximage-dex2oat" -${RUN} ${flags} ${bpath_arg} --runtime-option -Ximage-dex2oat +${RUN} ${flags} --runtime-option -Ximage-dex2oat return_status3=$? # Make sure we can run with the default settings. echo "Run default" -${RUN} ${flags} ${bpath_arg} +${RUN} ${flags} return_status4=$? # Make sure we don't silently ignore an early failure. diff --git a/test/Android.run-test.mk b/test/Android.run-test.mk index 148aea48ae..5d07601005 100644 --- a/test/Android.run-test.mk +++ b/test/Android.run-test.mk @@ -50,9 +50,9 @@ ART_TEST_TARGET_RUN_TEST_DEPENDENCIES += libopenjdkjvmti-target libopenjdkjvmtid ART_TEST_TARGET_RUN_TEST_DEPENDENCIES += $(TARGET_OUT_JAVA_LIBRARIES)/core-libart-testdex.jar ART_TEST_TARGET_RUN_TEST_DEPENDENCIES += $(TARGET_OUT_JAVA_LIBRARIES)/core-oj-testdex.jar ART_TEST_TARGET_RUN_TEST_DEPENDENCIES += $(TARGET_OUT_JAVA_LIBRARIES)/core-simple-testdex.jar +ART_TEST_TARGET_RUN_TEST_DEPENDENCIES += $(TARGET_OUT_JAVA_LIBRARIES)/conscrypt-testdex.jar ART_TEST_TARGET_RUN_TEST_DEPENDENCIES += $(TARGET_OUT_JAVA_LIBRARIES)/okhttp-testdex.jar ART_TEST_TARGET_RUN_TEST_DEPENDENCIES += $(TARGET_OUT_JAVA_LIBRARIES)/bouncycastle-testdex.jar -ART_TEST_TARGET_RUN_TEST_DEPENDENCIES += $(TARGET_OUT_JAVA_LIBRARIES)/conscrypt-testdex.jar # All tests require the host executables. The tests also depend on the core images, but on # specific version depending on the compiler. diff --git a/test/etc/run-test-jar b/test/etc/run-test-jar index ac6002bcea..4e5152b135 100755 --- a/test/etc/run-test-jar +++ b/test/etc/run-test-jar @@ -541,23 +541,38 @@ if [ "$USE_JVM" = "y" ]; then exit fi - -if [ "$HAVE_IMAGE" = "n" ]; then - if [ "${HOST}" = "y" ]; then - framework="${ANDROID_HOST_OUT}/framework" - bpath_suffix="-hostdex" +bpath_modules="core-oj core-libart core-simple conscrypt okhttp bouncycastle" +if [ "${HOST}" = "y" ]; then + framework="${ANDROID_HOST_OUT}/framework" + if [ "${ANDROID_HOST_OUT:0:${#ANDROID_BUILD_TOP}+1}" = "${ANDROID_BUILD_TOP}/" ]; then + framework_location="${ANDROID_HOST_OUT:${#ANDROID_BUILD_TOP}+1}/framework" else - framework="${ANDROID_ROOT}/framework" - bpath_suffix="-testdex" + echo "error: ANDROID_BUILD_TOP/ is not a prefix of ANDROID_HOST_OUT" + echo "ANDROID_BUILD_TOP=${ANDROID_BUILD_TOP}" + echo "ANDROID_HOST_OUT=${ANDROID_HOST_OUT}" + exit fi - bpath="${framework}/core-libart${bpath_suffix}.jar" - bpath="${bpath}:${framework}/core-oj${bpath_suffix}.jar" - bpath="${bpath}:${framework}/core-simple${bpath_suffix}.jar" - bpath="${bpath}:${framework}/conscrypt${bpath_suffix}.jar" - bpath="${bpath}:${framework}/okhttp${bpath_suffix}.jar" - bpath="${bpath}:${framework}/bouncycastle${bpath_suffix}.jar" - # Pass down the bootclasspath - FLAGS="${FLAGS} -Xbootclasspath:${bpath}" + bpath_suffix="-hostdex" +else + framework="${ANDROID_ROOT}/framework" + framework_location="${ANDROID_ROOT}/framework" + bpath_suffix="-testdex" +fi +bpath="" +bpath_locations="" +bpath_separator="" +for bpath_module in ${bpath_modules}; do + bpath+="${bpath_separator}${framework}/${bpath_module}${bpath_suffix}.jar" + bpath_locations+="${bpath_separator}${framework_location}/${bpath_module}${bpath_suffix}.jar" + bpath_separator=":" +done +# Pass down the bootclasspath +FLAGS="${FLAGS} -Xbootclasspath:${bpath}" +FLAGS="${FLAGS} -Xbootclasspath-locations:${bpath_locations}" +COMPILE_FLAGS="${COMPILE_FLAGS} --runtime-arg -Xbootclasspath:${bpath}" +COMPILE_FLAGS="${COMPILE_FLAGS} --runtime-arg -Xbootclasspath-locations:${bpath_locations}" + +if [ "$HAVE_IMAGE" = "n" ]; then # Disable image dex2oat - this will forbid the runtime to patch or compile an image. FLAGS="${FLAGS} -Xnoimage-dex2oat" diff --git a/tools/bootjars.sh b/tools/bootjars.sh index dca209d580..ad6ee6b058 100755 --- a/tools/bootjars.sh +++ b/tools/bootjars.sh @@ -54,7 +54,7 @@ done if [[ $mode == target ]]; then if [[ $core_jars_only == y ]]; then - selected_env_var=TARGET_CORE_JARS + selected_env_var=TARGET_TEST_CORE_JARS else selected_env_var=PRODUCT_BOOT_JARS fi @@ -64,11 +64,31 @@ elif [[ $mode == host ]]; then echo "Error: --host does not have non-core boot jars, --core required" >&2 exit 1 fi - selected_env_var=HOST_CORE_JARS + selected_env_var=HOST_TEST_CORE_JARS intermediates_env_var=HOST_OUT_COMMON_INTERMEDIATES fi -boot_jars_list=$(get_build_var "$selected_env_var") +if [[ $core_jars_only == y ]]; then + # FIXME: The soong invocation we're using for getting the variables does not give us anything + # defined in Android.common_path.mk, otherwise we would just use HOST-/TARGET_TEST_CORE_JARS. + + # The core_jars_list must match the TEST_CORE_JARS variable in the Android.common_path.mk . + core_jars_list="core-oj core-libart core-simple conscrypt okhttp bouncycastle" + core_jars_suffix= + if [[ $mode == target ]]; then + core_jars_suffix=-testdex + elif [[ $mode == host ]]; then + core_jars_suffix=-hostdex + fi + boot_jars_list="" + boot_separator="" + for boot_module in ${core_jars_list}; do + boot_jars_list+="${boot_separator}${boot_module}${core_jars_suffix}" + boot_separator=" " + done +else + boot_jars_list=$(get_build_var "$selected_env_var") +fi # Print only the list of boot jars. if [[ $print_file_path == n ]]; then |
