Add run-test support for running without a working patchoat/dex2oat
Also add it to the test-art target.
Bug: 17262039
Change-Id: Id31130194c46df66fc48852d6f8884f14cb08db4
diff --git a/test/etc/host-run-test-jar b/test/etc/host-run-test-jar
index ce85eb0..bce34f6 100755
--- a/test/etc/host-run-test-jar
+++ b/test/etc/host-run-test-jar
@@ -23,6 +23,10 @@
FLAGS=""
COMPILER_FLAGS=""
BUILD_BOOT_OPT=""
+PATCHOAT=""
+DEX2OAT=""
+FALSE_BIN="/bin/false"
+HAVE_IMAGE="y"
exe="${ANDROID_HOST_OUT}/bin/dalvikvm32"
main="Main"
@@ -33,6 +37,12 @@
elif [ "x$1" = "x--prebuild" ]; then
PREBUILD="y"
shift
+ elif [ "x$1" = "x--no-dex2oat" ]; then
+ DEX2OAT="-Xcompiler:${FALSE_BIN}"
+ shift
+ elif [ "x$1" = "x--no-patchoat" ]; then
+ PATCHOAT="-Xpatchoat:${FALSE_BIN}"
+ shift
elif [ "x$1" = "x--lib" ]; then
shift
if [ "x$1" = "x" ]; then
@@ -44,6 +54,9 @@
LIB=${LIB/%so/dylib}
fi
shift
+ elif [ "x$1" = "x--no-image" ]; then
+ HAVE_IMAGE="n"
+ shift
elif [ "x$1" = "x--boot" ]; then
shift
option="$1"
@@ -157,6 +170,13 @@
COMPILER_FLAGS="${COMPILER_FLAGS} --compiler-filter=interpret-only"
fi
+if [ "$HAVE_IMAGE" = "n" ]; then
+ # Set image to a place were there isn't one and then set the bootclasspath
+ # so we can create it.
+ BOOT_OPT="-Ximage:/system/framework/boot.art"
+ BOOT_OPT="${BOOT_OPT} -Xbootclasspath:$ANDROID_HOST_OUT/../common/obj/JAVA_LIBRARIES/core-libart-hostdex_intermediates/javalib.jar"
+fi
+
if [ "$RELOCATE" = "y" ]; then
FLAGS="${FLAGS} -Xrelocate"
COMPILER_FLAGS="${COMPILER_FLAGS} --runtime-arg -Xnorelocate --include-patch-information"
@@ -178,7 +198,7 @@
fi
JNI_OPTS="-Xjnigreflimit:512 -Xcheck:jni"
-cmdline="$INVOKE_WITH $gdb $exe $gdbargs -XXlib:$LIB $JNI_OPTS $FLAGS $INT_OPTS $DEBUGGER_OPTS $BOOT_OPT -cp $DEX_LOCATION/$TEST_NAME.jar $main"
+cmdline="$INVOKE_WITH $gdb $exe $gdbargs -XXlib:$LIB $PATCHOAT $DEX2OAT $JNI_OPTS $FLAGS $INT_OPTS $DEBUGGER_OPTS $BOOT_OPT -cp $DEX_LOCATION/$TEST_NAME.jar $main"
if [ "$DEV_MODE" = "y" ]; then
if [ "$PREBUILD" = "y" ]; then
echo "$mkdir_cmd && $prebuild_cmd && $cmdline"
@@ -190,4 +210,7 @@
fi
cd $ANDROID_BUILD_TOP
-$mkdir_cmd && $prebuild_cmd && LD_PRELOAD=libsigchain.so $cmdline "$@"
+# If we are execing /bin/false we might not be on the same ISA as libsigchain.so
+# ld.so will helpfully warn us of this. Unfortunately this messes up our error
+# checking so we will just filter out the error with a grep.
+$mkdir_cmd && $prebuild_cmd && LD_PRELOAD=libsigchain.so $cmdline "$@" 2>&1 | grep -v -E "^ERROR: ld\.so: object '.+\.so' from LD_PRELOAD cannot be preloaded: ignored\.$"