diff options
author | Nicolas Geoffray <ngeoffray@google.com> | 2014-10-28 17:59:47 +0000 |
---|---|---|
committer | Nicolas Geoffray <ngeoffray@google.com> | 2014-10-29 13:08:57 +0000 |
commit | c8f23fc19726245da6a11fa2d92e319b9d26c019 (patch) | |
tree | 0d61966d878c39aa30b0a3cd629554e7089619c2 | |
parent | 7c049c1f34220b0dc1a7f68f3b30f388bae7bdb9 (diff) | |
download | art-c8f23fc19726245da6a11fa2d92e319b9d26c019.zip art-c8f23fc19726245da6a11fa2d92e319b9d26c019.tar.gz art-c8f23fc19726245da6a11fa2d92e319b9d26c019.tar.bz2 |
Provide an option to run run-tests with a local dalvikvm.
Instead of overwriting /system, use a temporary directory
to push the binaries and libraries, and use them for
running the tests.
Change-Id: I45fa2ac51f836686d8e8676907eb26629f7ab2ab
-rw-r--r-- | Android.mk | 7 | ||||
-rw-r--r-- | test/Android.run-test.mk | 3 | ||||
-rwxr-xr-x | test/etc/run-test-jar | 25 | ||||
-rwxr-xr-x | test/run-test | 82 |
4 files changed, 76 insertions, 41 deletions
@@ -137,10 +137,17 @@ include $(art_path)/test/Android.run-test.mk # Sync test files to the target, depends upon all things that must be pushed to the target. .PHONY: test-art-target-sync +ifeq ($(ART_TEST_ANDROID_ROOT),) test-art-target-sync: $(TEST_ART_TARGET_SYNC_DEPS) adb root adb wait-for-device remount adb sync +else +test-art-target-sync: $(TEST_ART_TARGET_SYNC_DEPS) + adb root + adb wait-for-device push $(ANDROID_PRODUCT_OUT)/system $(ART_TEST_ANDROID_ROOT) + adb push $(ANDROID_PRODUCT_OUT)/data /data +endif # Undefine variable now its served its purpose. TEST_ART_TARGET_SYNC_DEPS := diff --git a/test/Android.run-test.mk b/test/Android.run-test.mk index 2bff720..854de57 100644 --- a/test/Android.run-test.mk +++ b/test/Android.run-test.mk @@ -588,6 +588,9 @@ define define-test-art-run-test run_test_rule_name := test-art-$(1)-run-test-$(2)-$(3)-$(4)-$(5)-$(6)-$(7)-$(8)-$(9)-$(10)-$(11)$(12) run_test_options := --output-path $(ART_HOST_TEST_DIR)/run-test-output/$$(run_test_rule_name) \ $$(run_test_options) + ifneq ($(ART_TEST_ANDROID_ROOT),) + run_test_options := --android-root $(ART_TEST_ANDROID_ROOT) $$(run_test_options) + endif $$(run_test_rule_name): PRIVATE_RUN_TEST_OPTIONS := $$(run_test_options) .PHONY: $$(run_test_rule_name) $$(run_test_rule_name): $(DX) $(HOST_OUT_EXECUTABLES)/jasmin $(HOST_OUT_EXECUTABLES)/smali $(HOST_OUT_EXECUTABLES)/dexmerger $$(prereq_rule) diff --git a/test/etc/run-test-jar b/test/etc/run-test-jar index eec8930..bf79006 100755 --- a/test/etc/run-test-jar +++ b/test/etc/run-test-jar @@ -8,9 +8,11 @@ msg() { fi } +ANDROID_ROOT="/system" ARCHITECTURES_32="(arm|x86|mips|none)" ARCHITECTURES_64="(arm64|x86_64|none)" ARCHITECTURES_PATTERN="${ARCHITECTURES_32}" +BOOT_IMAGE="" COMPILE_FLAGS="" DALVIKVM="dalvikvm32" DEBUGGER="n" @@ -26,6 +28,8 @@ HOST="n" INTERPRETER="n" INVOKE_WITH="" ISA=x86 +LIBRARY_DIRECTORY="lib" +MAIN="" OPTIMIZE="y" PATCHOAT="" PREBUILD="y" @@ -35,7 +39,6 @@ USE_GDB="n" USE_JVM="n" VERIFY="y" ZYGOTE="" -MAIN="" while true; do if [ "x$1" = "x--quiet" ]; then @@ -62,8 +65,7 @@ while true; do shift elif [ "x$1" = "x--boot" ]; then shift - DALVIKVM_BOOT_OPT="$1" - DEX2OAT_BOOT_OPT="--boot-image=${1#-Ximage:}" + BOOT_IMAGE="$1" shift elif [ "x$1" = "x--no-dex2oat" ]; then DEX2OAT="-Xcompiler:${FALSE_BIN}" @@ -127,6 +129,10 @@ while true; do elif [ "x$1" = "x--no-optimize" ]; then OPTIMIZE="n" shift + elif [ "x$1" = "x--android-root" ]; then + shift + ANDROID_ROOT="$1" + shift elif [ "x$1" = "x--" ]; then shift break @@ -134,6 +140,7 @@ while true; do ISA="x86_64" GDB_SERVER="gdbserver64" DALVIKVM="dalvikvm64" + LIBRARY_DIRECTORY="lib64" ARCHITECTURES_PATTERN="${ARCHITECTURES_64}" shift elif [ "x$1" = "x--pic-test" ]; then @@ -201,7 +208,11 @@ fi if [ "$HAVE_IMAGE" = "n" ]; then - BOOT_OPT="-Ximage:/system/non-existant/core.art" + DALVIKVM_BOOT_OPT="-Ximage:/system/non-existant/core.art" + DEX2OAT_BOOT_OPT="--boot-image=/system/non-existant/core.art" +else + DALVIKVM_BOOT_OPT="-Ximage:${BOOT_IMAGE}" + DEX2OAT_BOOT_OPT="--boot-image=${BOOT_IMAGE}" fi @@ -258,7 +269,7 @@ dex2oat_cmdline="true" mkdir_cmdline="mkdir -p ${DEX_LOCATION}/dalvik-cache/$ISA" if [ "$PREBUILD" = "y" ]; then - dex2oat_cmdline="$INVOKE_WITH dex2oatd \ + dex2oat_cmdline="$INVOKE_WITH $ANDROID_ROOT/bin/dex2oatd \ $COMPILE_FLAGS \ $DEX2OAT_BOOT_OPT \ --dex-file=$DEX_LOCATION/$TEST_NAME.jar \ @@ -266,7 +277,7 @@ if [ "$PREBUILD" = "y" ]; then --instruction-set=$ISA" fi -dalvikvm_cmdline="$INVOKE_WITH $GDB $DALVIKVM \ +dalvikvm_cmdline="$INVOKE_WITH $GDB $ANDROID_ROOT/bin/$DALVIKVM \ $GDB_ARGS \ $FLAGS \ -XXlib:$LIB \ @@ -301,6 +312,8 @@ if [ "$HOST" = "n" ]; then cmdline="cd $DEX_LOCATION && \ export ANDROID_DATA=$DEX_LOCATION && \ export DEX_LOCATION=$DEX_LOCATION && \ + export ANDROID_ROOT=$ANDROID_ROOT && \ + export LD_LIBRARY_PATH=$ANDROID_ROOT/$LIBRARY_DIRECTORY && \ $mkdir_cmdline && \ $dex2oat_cmdline && \ $dalvikvm_cmdline" diff --git a/test/run-test b/test/run-test index b0a4bb1..b43668d 100755 --- a/test/run-test +++ b/test/run-test @@ -97,6 +97,7 @@ have_patchoat="yes" have_image="yes" image_suffix="" pic_image_suffix="" +android_root="/system" while true; do if [ "x$1" = "x--host" ]; then @@ -223,6 +224,16 @@ while true; do break fi shift + elif [ "x$1" = "x--android-root" ]; then + shift + if [ "x$1" = "x" ]; then + echo "$0 missing argument to --android-root" 1>&2 + usage="yes" + break + fi + android_root="$1" + run_args="${run_args} --android-root $1" + shift elif [ "x$1" = "x--update" ]; then update_mode="yes" shift @@ -321,12 +332,12 @@ elif [ "$runtime" = "art" ]; then 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${image_suffix}${pic_image_suffix}.art" + run_args="${run_args} --boot ${ANDROID_HOST_OUT}/framework/core${image_suffix}${pic_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${image_suffix}${pic_image_suffix}.art" + run_args="${run_args} --boot /data/art-test/core${image_suffix}${pic_image_suffix}.art" fi if [ "$relocate" = "yes" ]; then run_args="${run_args} --relocate" @@ -344,7 +355,7 @@ if [ "$have_image" = "no" ]; then framework="${ANDROID_HOST_OUT}/framework" bpath_suffix="-hostdex" else - framework="/system/framework" + framework="${android_root}/framework" bpath_suffix="" fi # TODO If the target was compiled WITH_DEXPREOPT=true then these tests will @@ -397,40 +408,41 @@ if [ "$usage" = "yes" ]; then echo ' Omitting the test name or specifying "-" will use the' \ "current directory." echo " Runtime Options:" - echo " -O Run non-debug rather than debug build (off by default)." - echo " -Xcompiler-option Pass an option to the compiler." - echo " --runtime-option Pass an option to the runtime." - echo " --debug Wait for a debugger to attach." - 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)." - echo " --zygote Spawn the process from the Zygote." \ + echo " -O Run non-debug rather than debug build (off by default)." + echo " -Xcompiler-option Pass an option to the compiler." + echo " --runtime-option Pass an option to the runtime." + echo " --debug Wait for a debugger to attach." + 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)." + echo " --zygote Spawn the process from the Zygote." \ "If used, then the" - echo " other runtime options are ignored." - echo " --no-dex2oat Run as though dex2oat was failing." - echo " --no-patchoat Run as though patchoat was failing." - echo " --prebuild Run dex2oat on the files before starting test. (default)" - echo " --no-prebuild Do not run dex2oat on the files before starting" - echo " the test." - echo " --relocate Force the use of relocating in the test, making" - echo " the image and oat files be relocated to a random" - echo " address before running. (default)" - echo " --no-relocate Force the use of no relocating in the test" - echo " --host Use the host-mode virtual machine." - echo " --invoke-with Pass --invoke-with option to runtime." - echo " --dalvik Use Dalvik (off by default)." - echo " --jvm Use a host-local RI virtual machine." - echo " --output-path [path] Location where to store the build" \ + echo " other runtime options are ignored." + echo " --no-dex2oat Run as though dex2oat was failing." + echo " --no-patchoat Run as though patchoat was failing." + echo " --prebuild Run dex2oat on the files before starting test. (default)" + echo " --no-prebuild Do not run dex2oat on the files before starting" + echo " the test." + echo " --relocate Force the use of relocating in the test, making" + echo " the image and oat files be relocated to a random" + echo " address before running. (default)" + echo " --no-relocate Force the use of no relocating in the test" + echo " --host Use the host-mode virtual machine." + echo " --invoke-with Pass --invoke-with option to runtime." + echo " --dalvik Use Dalvik (off by default)." + echo " --jvm Use a host-local RI virtual machine." + echo " --output-path [path] Location where to store the build" \ "files." - echo " --64 Run the test in 64-bit mode" - echo " --trace Run with method tracing" - echo " --gcstress Run with gc stress testing" - echo " --gcverify Run with gc verification" - echo " --always-clean Delete the test files even if the test fails." + echo " --64 Run the test in 64-bit mode" + echo " --trace Run with method tracing" + echo " --gcstress Run with gc stress testing" + echo " --gcverify Run with gc verification" + echo " --always-clean Delete the test files even if the test fails." + echo " --android-root [path] The path on target for the android root. (/system by default)." ) 1>&2 exit 1 fi |