ART: Extend ISA features option for (host) run tests
To allow to test advanced intrinsics only available on (fairly)
modern processors, and because our build requirements are still
too low to enable them in the build system, pipe through the
existing make variables to the run-tests to allow to override
the dex2oat autodetection scheme.
Usage (standalone run-test): use the new --instruction-set-features
command line parameter to set the value for dex2oat (in the prebuild
configuration) or as an -Xcompiler-option (for no-prebuild). Note:
this is general and also works for target tests.
Usage (through make): set DEX2OAT_HOST_INSTRUCTION_SET_FEATURES and
2ND_DEX2OAT_HOST_INSTRUCTION_SET_FEATURES to set instruction set
features, as was possible before for the compilation of core files.
This option is now forwarded to host run-tests.
Change-Id: I9d89c82b6a5c8853748e5d1c153dde5d4050757a
diff --git a/test/Android.run-test.mk b/test/Android.run-test.mk
index 3698bc8..4e6df6c 100644
--- a/test/Android.run-test.mk
+++ b/test/Android.run-test.mk
@@ -853,6 +853,19 @@
$$(error found $(13) expected $(ALL_ADDRESS_SIZES))
endif
endif
+ # Override of host instruction-set-features. Required to test advanced x86 intrinsics. The
+ # conditionals aren't really correct, they will fail to do the right thing on a 32-bit only
+ # host. However, this isn't common enough to worry here and make the conditions complicated.
+ ifneq ($(DEX2OAT_HOST_INSTRUCTION_SET_FEATURES),)
+ ifeq ($(13),64)
+ run_test_options += --instruction-set-features $(DEX2OAT_HOST_INSTRUCTION_SET_FEATURES)
+ endif
+ endif
+ ifneq ($($(HOST_2ND_ARCH_VAR_PREFIX)DEX2OAT_HOST_INSTRUCTION_SET_FEATURES),)
+ ifeq ($(13),32)
+ run_test_options += --instruction-set-features $($(HOST_2ND_ARCH_VAR_PREFIX)DEX2OAT_HOST_INSTRUCTION_SET_FEATURES)
+ endif
+ endif
run_test_rule_name := test-art-$(1)-run-test-$(2)-$(3)-$(4)-$(5)-$(6)-$(7)-$(8)-$(9)-$(10)-$(11)-$(12)$(13)
run_test_options := --output-path $(ART_HOST_TEST_DIR)/run-test-output/$$(run_test_rule_name) \
$$(run_test_options)
diff --git a/test/etc/run-test-jar b/test/etc/run-test-jar
index db64b77..750a29f 100755
--- a/test/etc/run-test-jar
+++ b/test/etc/run-test-jar
@@ -46,6 +46,7 @@
ZYGOTE=""
DEX_VERIFY=""
USE_DEX2OAT_AND_PATCHOAT="y"
+INSTRUCTION_SET_FEATURES=""
while true; do
if [ "x$1" = "x--quiet" ]; then
@@ -159,6 +160,10 @@
shift
ANDROID_ROOT="$1"
shift
+ elif [ "x$1" = "x--instruction-set-features" ]; then
+ shift
+ INSTRUCTION_SET_FEATURES="$1"
+ shift
elif [ "x$1" = "x--" ]; then
shift
break
@@ -330,6 +335,14 @@
--dex-file=$DEX_LOCATION/$TEST_NAME.jar \
--oat-file=$DEX_LOCATION/dalvik-cache/$ISA/$(echo $DEX_LOCATION/$TEST_NAME.jar/classes.dex | cut -d/ -f 2- | sed "s:/:@:g") \
--instruction-set=$ISA"
+ if [ "x$INSTRUCTION_SET_FEATURES" != "x" ] ; then
+ dex2oat_cmdline="${dex2oat_cmdline} --instruction-set-features=${INSTRUCTION_SET_FEATURES}"
+ fi
+fi
+
+DALVIKVM_ISA_FEATURES_ARGS=""
+if [ "x$INSTRUCTION_SET_FEATURES" != "x" ] ; then
+ DALVIKVM_ISA_FEATURES_ARGS="-Xcompiler-option --instruction-set-features=${INSTRUCTION_SET_FEATURES}"
fi
dalvikvm_cmdline="$INVOKE_WITH $GDB $ANDROID_ROOT/bin/$DALVIKVM \
@@ -339,6 +352,7 @@
-XXlib:$LIB \
$PATCHOAT \
$DEX2OAT \
+ $DALVIKVM_ISA_FEATURES_ARGS \
$ZYGOTE \
$JNI_OPTS \
$INT_OPTS \
diff --git a/test/run-test b/test/run-test
index 934329f..3d6f073 100755
--- a/test/run-test
+++ b/test/run-test
@@ -339,6 +339,10 @@
elif [ "x$1" = "x--dex2oat-swap" ]; then
run_args="${run_args} --dex2oat-swap"
shift
+ elif [ "x$1" = "x--instruction-set-features" ]; then
+ shift
+ run_args="${run_args} --instruction-set-features $1"
+ shift
elif expr "x$1" : "x--" >/dev/null 2>&1; then
echo "unknown $0 option: $1" 1>&2
usage="yes"
@@ -556,6 +560,8 @@
echo " --never-clean Keep the test files even if the test succeeds."
echo " --android-root [path] The path on target for the android root. (/system by default)."
echo " --dex2oat-swap Use a dex2oat swap file."
+ echo " --instruction-set-features [string]"
+ echo " Set instruction-set-features for compilation."
) 1>&2
exit 1
fi