ART: Create and use multiple core images
Update test infrastructure to understand several core variants.
Now compiles three core.art/oat variants:
* core.art/oat, default-compiled
* core-interpreter.art/oat, interpret-only
* core-optimizing.art/oat, optimizing compiler
The run-test variant implies which core variant is used.
Change-Id: Ieeaf2df90faee2b04c209b950897e77806205fe4
diff --git a/test/Android.run-test.mk b/test/Android.run-test.mk
index 7eba4af..32dbc86 100644
--- a/test/Android.run-test.mk
+++ b/test/Android.run-test.mk
@@ -371,8 +371,9 @@
$(foreach run_type, $(RUN_TYPES), \
$(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(run_type))_RULES :=)))
-# We need dex2oat and dalvikvm on the target as well as the core image.
-TEST_ART_TARGET_SYNC_DEPS += $(ART_TARGET_EXECUTABLES) $(TARGET_CORE_IMG_OUT) $(2ND_TARGET_CORE_IMG_OUT)
+# We need dex2oat and dalvikvm on the target as well as the core images (all images as we sync
+# only once).
+TEST_ART_TARGET_SYNC_DEPS += $(ART_TARGET_EXECUTABLES) $(TARGET_CORE_IMG_OUTS)
# Also need libarttest.
TEST_ART_TARGET_SYNC_DEPS += $(ART_TARGET_TEST_OUT)/$(TARGET_ARCH)/libarttest.so
@@ -386,20 +387,19 @@
TEST_ART_TARGET_SYNC_DEPS += $(ART_TARGET_TEST_OUT)/$(TARGET_2ND_ARCH)/libnativebridgetest.so
endif
-# All tests require the host executables and the core images.
+# All tests require the host executables. The tests also depend on the core images, but on
+# specific version depending on the compiler.
ART_TEST_HOST_RUN_TEST_DEPENDENCIES := \
$(ART_HOST_EXECUTABLES) \
$(ART_HOST_OUT_SHARED_LIBRARIES)/libarttest$(ART_HOST_SHLIB_EXTENSION) \
$(ART_HOST_OUT_SHARED_LIBRARIES)/libnativebridgetest$(ART_HOST_SHLIB_EXTENSION) \
- $(ART_HOST_OUT_SHARED_LIBRARIES)/libjavacore$(ART_HOST_SHLIB_EXTENSION) \
- $(HOST_CORE_IMG_OUT)
+ $(ART_HOST_OUT_SHARED_LIBRARIES)/libjavacore$(ART_HOST_SHLIB_EXTENSION)
ifneq ($(HOST_PREFER_32_BIT),true)
ART_TEST_HOST_RUN_TEST_DEPENDENCIES += \
$(2ND_ART_HOST_OUT_SHARED_LIBRARIES)/libarttest$(ART_HOST_SHLIB_EXTENSION) \
$(2ND_ART_HOST_OUT_SHARED_LIBRARIES)/libnativebridgetest$(ART_HOST_SHLIB_EXTENSION) \
- $(2ND_ART_HOST_OUT_SHARED_LIBRARIES)/libjavacore$(ART_HOST_SHLIB_EXTENSION) \
- $(2ND_HOST_CORE_IMG_OUT)
+ $(2ND_ART_HOST_OUT_SHARED_LIBRARIES)/libjavacore$(ART_HOST_SHLIB_EXTENSION)
endif
# Create a rule to build and run a tests following the form:
@@ -457,7 +457,7 @@
endif
ifeq ($(4),optimizing)
test_groups += ART_RUN_TEST_$$(uc_host_or_target)_OPTIMIZING_RULES
- run_test_options += -Xcompiler-option --compiler-backend=Optimizing
+ run_test_options += --optimizing
else
ifeq ($(4),interpreter)
test_groups += ART_RUN_TEST_$$(uc_host_or_target)_INTERPRETER_RULES
@@ -470,6 +470,13 @@
endif
endif
endif
+ # Add the core dependency.
+ ifeq ($(1),host)
+ prereq_rule += $(HOST_CORE_IMAGE_$(4)_$(11))
+ else
+ prereq_rule += $(TARGET_CORE_IMAGE_$(4)_$(11))
+ endif
+
ifeq ($(5),relocate)
test_groups += ART_RUN_TEST_$$(uc_host_or_target)_RELOCATE_RULES
run_test_options += --relocate
diff --git a/test/run-test b/test/run-test
index 9c97de0..b7c0ecf 100755
--- a/test/run-test
+++ b/test/run-test
@@ -95,6 +95,7 @@
have_dex2oat="yes"
have_patchoat="yes"
have_image="yes"
+image_suffix=""
while true; do
if [ "x$1" = "x--host" ]; then
@@ -174,6 +175,11 @@
shift
elif [ "x$1" = "x--interpreter" ]; then
run_args="${run_args} --interpreter"
+ image_suffix="-interpreter"
+ shift
+ elif [ "x$1" = "x--optimizing" ]; then
+ run_args="${run_args} -Xcompiler-option --compiler-backend=Optimizing"
+ image_suffix="-optimizing"
shift
elif [ "x$1" = "x--no-verify" ]; then
run_args="${run_args} --no-verify"
@@ -308,12 +314,12 @@
if [ -z "$ANDROID_HOST_OUT" ]; then
export ANDROID_HOST_OUT=$ANDROID_BUILD_TOP/out/host/linux-x86
fi
- run_args="${run_args} --boot -Ximage:${ANDROID_HOST_OUT}/framework/core.art"
+ run_args="${run_args} --boot -Ximage:${ANDROID_HOST_OUT}/framework/core${image_suffix}.art"
run_args="${run_args} --runtime-option -Djava.library.path=${ANDROID_HOST_OUT}/lib${suffix64}"
else
guess_arch_name
run_args="${run_args} --runtime-option -Djava.library.path=/data/art-test/${target_arch_name}"
- run_args="${run_args} --boot -Ximage:/data/art-test/core.art"
+ run_args="${run_args} --boot -Ximage:/data/art-test/core${image_suffix}.art"
fi
if [ "$relocate" = "yes" ]; then
run_args="${run_args} --relocate"
@@ -391,6 +397,7 @@
echo " --gdb Run under gdb; incompatible with some tests."
echo " --build-only Build test files only (off by default)."
echo " --interpreter Enable interpreter only mode (off by default)."
+ echo " --optimizing Enable optimizing compiler (off by default)."
echo " --no-verify Turn off verification (on by default)."
echo " --no-optimize Turn off optimization (on by default)."
echo " --no-precise Turn off precise GC (on by default)."