summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rwxr-xr-xtest/172-app-image-twice/check18
-rw-r--r--test/172-app-image-twice/debug_print_class.cc33
-rw-r--r--test/172-app-image-twice/expected.txt1
-rw-r--r--test/172-app-image-twice/info.txt1
-rw-r--r--test/172-app-image-twice/profile1
-rw-r--r--test/172-app-image-twice/run28
-rw-r--r--test/172-app-image-twice/src/Main.java48
-rw-r--r--test/172-app-image-twice/src/TestClass.java18
-rw-r--r--test/979-const-method-handle/expected.txt2
-rw-r--r--test/979-const-method-handle/src/Main.java90
-rw-r--r--test/Android.bp1
-rwxr-xr-xtest/etc/run-test-jar44
-rw-r--r--test/knownfailures.json1
-rwxr-xr-xtest/run-test48
-rw-r--r--test/testrunner/env.py2
-rwxr-xr-xtest/testrunner/testrunner.py3
16 files changed, 291 insertions, 48 deletions
diff --git a/test/172-app-image-twice/check b/test/172-app-image-twice/check
new file mode 100755
index 0000000000..26a97a48ae
--- /dev/null
+++ b/test/172-app-image-twice/check
@@ -0,0 +1,18 @@
+#!/bin/bash
+#
+# Copyright (C) 2018 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Remove all lines not containing "passed".
+grep "^passed" "$2" | diff --strip-trailing-cr -q "$1" - >/dev/null
diff --git a/test/172-app-image-twice/debug_print_class.cc b/test/172-app-image-twice/debug_print_class.cc
new file mode 100644
index 0000000000..6c3de20f2d
--- /dev/null
+++ b/test/172-app-image-twice/debug_print_class.cc
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "debug_print.h"
+#include "dex/dex_file.h"
+#include "mirror/class-inl.h"
+#include "scoped_thread_state_change-inl.h"
+#include "thread-current-inl.h"
+
+namespace art {
+
+extern "C" JNIEXPORT void JNICALL Java_Main_debugPrintClass(JNIEnv*, jclass, jclass cls) {
+ ScopedObjectAccess soa(Thread::Current());
+ ObjPtr<mirror::Class> klass = soa.Decode<mirror::Class>(cls);
+ LOG(ERROR) << "klass: " << klass.Ptr() << " dex_file: " << klass->GetDexFile().GetLocation()
+ << "/" << static_cast<const void*>(&klass->GetDexFile())
+ << " " << DescribeSpace(klass);
+}
+
+} // namespace art
diff --git a/test/172-app-image-twice/expected.txt b/test/172-app-image-twice/expected.txt
new file mode 100644
index 0000000000..b0aad4deb5
--- /dev/null
+++ b/test/172-app-image-twice/expected.txt
@@ -0,0 +1 @@
+passed
diff --git a/test/172-app-image-twice/info.txt b/test/172-app-image-twice/info.txt
new file mode 100644
index 0000000000..028046e872
--- /dev/null
+++ b/test/172-app-image-twice/info.txt
@@ -0,0 +1 @@
+Regression test for loading the same app image twice.
diff --git a/test/172-app-image-twice/profile b/test/172-app-image-twice/profile
new file mode 100644
index 0000000000..70cb2efbb5
--- /dev/null
+++ b/test/172-app-image-twice/profile
@@ -0,0 +1 @@
+LTestClass;
diff --git a/test/172-app-image-twice/run b/test/172-app-image-twice/run
new file mode 100644
index 0000000000..aa2819075f
--- /dev/null
+++ b/test/172-app-image-twice/run
@@ -0,0 +1,28 @@
+#!/bin/bash
+#
+# Copyright (C) 2018 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Build an app image with TestClass (specified by profile) and class loader
+# context that skips the duplicate class checks.
+
+# Target and host use a different shell, and we need to special case the
+# passing of the class loader context marker.
+if [[ "$@" = *" --host "* ]]; then
+ ${RUN} $@ --profile -Xcompiler-option --compiler-filter=speed-profile \
+ -Xcompiler-option --class-loader-context=\&
+else
+ ${RUN} $@ --profile -Xcompiler-option --compiler-filter=speed-profile \
+ -Xcompiler-option '--class-loader-context=\&'
+fi
diff --git a/test/172-app-image-twice/src/Main.java b/test/172-app-image-twice/src/Main.java
new file mode 100644
index 0000000000..a1c151a6bc
--- /dev/null
+++ b/test/172-app-image-twice/src/Main.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.lang.reflect.Method;
+
+public class Main {
+ private static String TEST_NAME = "172-app-image-twice";
+
+ public static void main(String args[]) throws Exception {
+ System.loadLibrary(args[0]);
+
+ Class<?> tc1 = Class.forName("TestClass");
+
+ String dexPath = System.getenv("DEX_LOCATION") + "/" + TEST_NAME + ".jar";
+ Class<?> bdcl = Class.forName("dalvik.system.BaseDexClassLoader");
+ Method addDexPathMethod = bdcl.getDeclaredMethod("addDexPath", String.class);
+ addDexPathMethod.invoke(Main.class.getClassLoader(), dexPath);
+
+ Class<?> tc2 = Class.forName("TestClass");
+
+ // Add extra logging to simulate libcore logging, this logging should not be compared
+ // against.
+ System.out.println("Extra logging");
+
+ if (tc1 != tc2) {
+ System.out.println("Class mismatch!");
+ debugPrintClass(tc1);
+ debugPrintClass(tc2);
+ } else {
+ System.out.println("passed");
+ }
+ }
+
+ public static native void debugPrintClass(Class<?> cls);
+}
diff --git a/test/172-app-image-twice/src/TestClass.java b/test/172-app-image-twice/src/TestClass.java
new file mode 100644
index 0000000000..5381718f6e
--- /dev/null
+++ b/test/172-app-image-twice/src/TestClass.java
@@ -0,0 +1,18 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class TestClass {
+}
diff --git a/test/979-const-method-handle/expected.txt b/test/979-const-method-handle/expected.txt
index bc943e368e..2d169b9508 100644
--- a/test/979-const-method-handle/expected.txt
+++ b/test/979-const-method-handle/expected.txt
@@ -1,4 +1,6 @@
(int,Integer,System)String
+repeatConstMethodType0((int,Integer,System)String)
+repeatConstMethodType1((LocalClass)void)
Hello World! And Hello Zog
Hello World! And Hello Zorba
name is HoverFly
diff --git a/test/979-const-method-handle/src/Main.java b/test/979-const-method-handle/src/Main.java
index 663814f232..79be913a67 100644
--- a/test/979-const-method-handle/src/Main.java
+++ b/test/979-const-method-handle/src/Main.java
@@ -26,59 +26,100 @@ class Main {
throw new Error("Unreachable");
}
+ private static class LocalClass {
+ public LocalClass() {}
+
+ private int field;
+ }
+
@ConstantMethodType(
- returnType = String.class,
- parameterTypes = {int.class, Integer.class, System.class}
- )
+ returnType = String.class,
+ parameterTypes = {int.class, Integer.class, System.class})
private static MethodType methodType0() {
unreachable();
return null;
}
+ @ConstantMethodType(
+ returnType = void.class,
+ parameterTypes = {LocalClass.class})
+ private static MethodType methodType1() {
+ unreachable();
+ return null;
+ }
+
+ private static void repeatConstMethodType0(MethodType expected) {
+ System.out.print("repeatConstMethodType0(");
+ System.out.print(expected);
+ System.out.println(")");
+ for (int i = 0; i < 12000; ++i) {
+ MethodType actual = methodType0();
+ if (!actual.equals(expected)) {
+ System.out.print("Expected: ");
+ System.out.println(expected);
+ System.out.print("Actual: ");
+ System.out.println(actual);
+ unreachable();
+ }
+ }
+ }
+
+ private static void repeatConstMethodType1(MethodType expected) {
+ System.out.print("repeatConstMethodType1(");
+ System.out.print(expected);
+ System.out.println(")");
+ for (int i = 0; i < 12000; ++i) {
+ MethodType actual = methodType1();
+ if (!actual.equals(expected)) {
+ System.out.print("Expected: ");
+ System.out.println(expected);
+ System.out.print("Actual: ");
+ System.out.println(actual);
+ unreachable();
+ }
+ }
+ }
+
static void helloWorld(String who) {
System.out.print("Hello World! And Hello ");
System.out.println(who);
}
@ConstantMethodHandle(
- kind = ConstantMethodHandle.INVOKE_STATIC,
- owner = "Main",
- fieldOrMethodName = "helloWorld",
- descriptor = "(Ljava/lang/String;)V"
- )
+ kind = ConstantMethodHandle.INVOKE_STATIC,
+ owner = "Main",
+ fieldOrMethodName = "helloWorld",
+ descriptor = "(Ljava/lang/String;)V")
private static MethodHandle printHelloHandle() {
unreachable();
return null;
}
@ConstantMethodHandle(
- kind = ConstantMethodHandle.STATIC_PUT,
- owner = "Main",
- fieldOrMethodName = "name",
- descriptor = "Ljava/lang/String;"
- )
+ kind = ConstantMethodHandle.STATIC_PUT,
+ owner = "Main",
+ fieldOrMethodName = "name",
+ descriptor = "Ljava/lang/String;")
private static MethodHandle setNameHandle() {
unreachable();
return null;
}
@ConstantMethodHandle(
- kind = ConstantMethodHandle.STATIC_GET,
- owner = "java/lang/Math",
- fieldOrMethodName = "E",
- descriptor = "D"
- )
+ kind = ConstantMethodHandle.STATIC_GET,
+ owner = "java/lang/Math",
+ fieldOrMethodName = "E",
+ descriptor = "D")
private static MethodHandle getMathE() {
unreachable();
return null;
}
@ConstantMethodHandle(
- kind = ConstantMethodHandle.STATIC_PUT,
- owner = "java/lang/Math",
- fieldOrMethodName = "E",
- descriptor = "D"
- )
+ kind = ConstantMethodHandle.STATIC_PUT,
+ owner = "java/lang/Math",
+ fieldOrMethodName = "E",
+ descriptor = "D")
private static MethodHandle putMathE() {
unreachable();
return null;
@@ -86,6 +127,9 @@ class Main {
public static void main(String[] args) throws Throwable {
System.out.println(methodType0());
+ repeatConstMethodType0(
+ MethodType.methodType(String.class, int.class, Integer.class, System.class));
+ repeatConstMethodType1(MethodType.methodType(void.class, LocalClass.class));
printHelloHandle().invokeExact("Zog");
printHelloHandle().invokeExact("Zorba");
setNameHandle().invokeExact("HoverFly");
diff --git a/test/Android.bp b/test/Android.bp
index 0c6b449877..76189f62a9 100644
--- a/test/Android.bp
+++ b/test/Android.bp
@@ -423,6 +423,7 @@ cc_defaults {
"154-gc-loop/heap_interface.cc",
"167-visit-locks/visit_locks.cc",
"169-threadgroup-jni/jni_daemon_thread.cc",
+ "172-app-image-twice/debug_print_class.cc",
"1945-proxy-method-arguments/get_args.cc",
"203-multi-checkpoint/multi_checkpoint.cc",
"305-other-fault-handler/fault_handler.cc",
diff --git a/test/etc/run-test-jar b/test/etc/run-test-jar
index 81e77be547..fad801192a 100755
--- a/test/etc/run-test-jar
+++ b/test/etc/run-test-jar
@@ -13,6 +13,7 @@ ARCHITECTURES_32="(arm|x86|mips|none)"
ARCHITECTURES_64="(arm64|x86_64|mips64|none)"
ARCHITECTURES_PATTERN="${ARCHITECTURES_32}"
BOOT_IMAGE=""
+CHROOT=
COMPILE_FLAGS=""
DALVIKVM="dalvikvm32"
DEBUGGER="n"
@@ -299,6 +300,10 @@ while true; do
elif [ "x$1" = "x--no-optimize" ]; then
OPTIMIZE="n"
shift
+ elif [ "x$1" = "x--chroot" ]; then
+ shift
+ CHROOT="$1"
+ shift
elif [ "x$1" = "x--android-root" ]; then
shift
ANDROID_ROOT="$1"
@@ -367,6 +372,9 @@ while true; do
fi
done
+# The DEX_LOCATION with the chroot prefix, if any.
+CHROOT_DEX_LOCATION="$CHROOT$DEX_LOCATION"
+
if [ "$USE_JVM" = "n" ]; then
FLAGS="${FLAGS} ${ANDROID_FLAGS}"
for feature in ${EXPERIMENTAL}; do
@@ -817,28 +825,28 @@ if [ "$HOST" = "n" ]; then
adb root > /dev/null
adb wait-for-device
if [ "$QUIET" = "n" ]; then
- adb shell rm -rf $DEX_LOCATION
- adb shell mkdir -p $DEX_LOCATION
- adb push $TEST_NAME.jar $DEX_LOCATION
- adb push $TEST_NAME-ex.jar $DEX_LOCATION
+ adb shell rm -rf $CHROOT_DEX_LOCATION
+ adb shell mkdir -p $CHROOT_DEX_LOCATION
+ adb push $TEST_NAME.jar $CHROOT_DEX_LOCATION
+ adb push $TEST_NAME-ex.jar $CHROOT_DEX_LOCATION
if [ "$PROFILE" = "y" ] || [ "$RANDOM_PROFILE" = "y" ]; then
- adb push profile $DEX_LOCATION
+ adb push profile $CHROOT_DEX_LOCATION
fi
# Copy resource folder
if [ -d res ]; then
- adb push res $DEX_LOCATION
+ adb push res $CHROOT_DEX_LOCATION
fi
else
- adb shell rm -r $DEX_LOCATION >/dev/null 2>&1
- adb shell mkdir -p $DEX_LOCATION >/dev/null 2>&1
- adb push $TEST_NAME.jar $DEX_LOCATION >/dev/null 2>&1
- adb push $TEST_NAME-ex.jar $DEX_LOCATION >/dev/null 2>&1
+ adb shell rm -rf $CHROOT_DEX_LOCATION >/dev/null 2>&1
+ adb shell mkdir -p $CHROOT_DEX_LOCATION >/dev/null 2>&1
+ adb push $TEST_NAME.jar $CHROOT_DEX_LOCATION >/dev/null 2>&1
+ adb push $TEST_NAME-ex.jar $CHROOT_DEX_LOCATION >/dev/null 2>&1
if [ "$PROFILE" = "y" ] || [ "$RANDOM_PROFILE" = "y" ]; then
- adb push profile $DEX_LOCATION >/dev/null 2>&1
+ adb push profile $CHROOT_DEX_LOCATION >/dev/null 2>&1
fi
# Copy resource folder
if [ -d res ]; then
- adb push res $DEX_LOCATION >/dev/null 2>&1
+ adb push res $CHROOT_DEX_LOCATION >/dev/null 2>&1
fi
fi
@@ -847,7 +855,7 @@ if [ "$HOST" = "n" ]; then
# Current default installation is dalvikvm 64bits and dex2oat 32bits,
# so we can only use LD_LIBRARY_PATH when testing on a local
# installation.
- LD_LIBRARY_PATH=$ANDROID_ROOT/$LIBRARY_DIRECTORY:$LD_LIBRARY_PATH
+ LD_LIBRARY_PATH="$ANDROID_ROOT/$LIBRARY_DIRECTORY:$LD_LIBRARY_PATH"
fi
# System libraries needed by libarttestd.so
@@ -889,14 +897,18 @@ if [ "$HOST" = "n" ]; then
fi
if [ "$QUIET" = "n" ]; then
- adb push $cmdfile $DEX_LOCATION/cmdline.sh
+ adb push $cmdfile $CHROOT_DEX_LOCATION/cmdline.sh
else
- adb push $cmdfile $DEX_LOCATION/cmdline.sh > /dev/null 2>&1
+ adb push $cmdfile $CHROOT_DEX_LOCATION/cmdline.sh >/dev/null 2>&1
fi
exit_status=0
if [ "$DRY_RUN" != "y" ]; then
- adb shell sh $DEX_LOCATION/cmdline.sh
+ if [ -n "$CHROOT" ]; then
+ adb shell chroot "$CHROOT" sh $DEX_LOCATION/cmdline.sh
+ else
+ adb shell sh $DEX_LOCATION/cmdline.sh
+ fi
exit_status=$?
fi
diff --git a/test/knownfailures.json b/test/knownfailures.json
index f3137587f6..f473a99a27 100644
--- a/test/knownfailures.json
+++ b/test/knownfailures.json
@@ -734,6 +734,7 @@
"164-resolution-trampoline-dex-cache",
"167-visit-locks",
"168-vmstack-annotated",
+ "172-app-image-twice",
"201-built-in-except-detail-messages",
"203-multi-checkpoint",
"304-method-tracing",
diff --git a/test/run-test b/test/run-test
index 5f85b0875b..be0a88d1f9 100755
--- a/test/run-test
+++ b/test/run-test
@@ -121,6 +121,8 @@ if [ -z "$HIDDENAPI" ]; then
export HIDDENAPI="${ANDROID_HOST_OUT}/bin/hiddenapi"
fi
+chroot=
+
info="info.txt"
build="build"
run="run"
@@ -380,6 +382,16 @@ while true; do
break
fi
shift
+ elif [ "x$1" = "x--chroot" ]; then
+ shift
+ if [ "x$1" = "x" ]; then
+ echo "$0 missing argument to --chroot" 1>&2
+ usage="yes"
+ break
+ fi
+ chroot="$1"
+ run_args="${run_args} --chroot $1"
+ shift
elif [ "x$1" = "x--android-root" ]; then
shift
if [ "x$1" = "x" ]; then
@@ -449,6 +461,9 @@ while true; do
fi
done
+# The DEX_LOCATION with the chroot prefix, if any.
+chroot_dex_location="$chroot$DEX_LOCATION"
+
run_args="${run_args} ${image_args}"
# Allocate file descriptor real_stderr and redirect it to the shell's error
# output (fd 2).
@@ -476,7 +491,7 @@ function err_echo() {
# tmp_dir may be relative, resolve.
#
# Cannot use realpath, as it does not exist on Mac.
-# Cannot us a simple "cd", as the path might not be created yet.
+# Cannot use a simple "cd", as the path might not be created yet.
# Cannot use readlink -m, as it does not exist on Mac.
# Fallback to nuclear option:
noncanonical_tmp_dir=$tmp_dir
@@ -550,7 +565,13 @@ if [ "$target_mode" = "no" ]; then
if [ "$runtime" = "jvm" ]; then
if [ "$prebuild_mode" = "yes" ]; then
err_echo "--prebuild with --jvm is unsupported"
- exit 1;
+ exit 1
+ fi
+ else
+ # ART/Dalvik host mode.
+ if [ -n "$chroot" ]; then
+ err_echo "--chroot with --host is unsupported"
+ exit 1
fi
fi
fi
@@ -628,6 +649,12 @@ if [ "$bisection_search" = "yes" -a "$have_patchoat" = "no" ]; then
usage="yes"
fi
+# TODO: Chroot-based bisection search is not supported yet (see below); implement it.
+if [ "$bisection_search" = "yes" -a -n "$chroot" ]; then
+ err_echo "--chroot with --bisection-search is unsupported"
+ exit 1
+fi
+
if [ "$usage" = "no" ]; then
if [ "x$1" = "x" -o "x$1" = "x-" ]; then
test_dir=`basename "$oldwd"`
@@ -732,6 +759,7 @@ if [ "$usage" = "yes" ]; then
echo " Run with jvmti method redefinition stress testing"
echo " --always-clean Delete the test files even if the test fails."
echo " --never-clean Keep the test files even if the test succeeds."
+ echo " --chroot [newroot] Run with root directory set to newroot."
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]"
@@ -866,7 +894,7 @@ if [ "$dev_mode" = "yes" ]; then
if [ "$run_exit" = "0" ]; then
if [ "$run_checker" = "yes" ]; then
if [ "$target_mode" = "yes" ]; then
- adb pull $cfg_output_dir/$cfg_output &> /dev/null
+ adb pull "$chroot/$cfg_output_dir/$cfg_output" &> /dev/null
fi
"$checker" $checker_args "$cfg_output" "$tmp_dir" 2>&1
checker_exit="$?"
@@ -888,7 +916,7 @@ elif [ "$update_mode" = "yes" ]; then
"./${run}" $run_args "$@" >"$output" 2>&1
if [ "$run_checker" = "yes" ]; then
if [ "$target_mode" = "yes" ]; then
- adb pull $cfg_output_dir/$cfg_output &> /dev/null
+ adb pull "$chroot/$cfg_output_dir/$cfg_output" &> /dev/null
fi
"$checker" -q $checker_args "$cfg_output" "$tmp_dir" >> "$output" 2>&1
fi
@@ -926,7 +954,7 @@ else
good_run="no"
elif [ "$run_checker" = "yes" ]; then
if [ "$target_mode" = "yes" ]; then
- adb pull $cfg_output_dir/$cfg_output &> /dev/null
+ adb pull "$chroot/$cfg_output_dir/$cfg_output" &> /dev/null
fi
"$checker" -q $checker_args "$cfg_output" "$tmp_dir" >> "$output" 2>&1
checker_exit="$?"
@@ -986,6 +1014,7 @@ fi
) 2>&${real_stderr} 1>&2
# Attempt bisection only if the test failed.
+# TODO: Implement support for chroot-based bisection search.
if [ "$bisection_search" = "yes" -a "$good" != "yes" ]; then
# Bisecting works by skipping different optimization passes which breaks checker assertions.
if [ "$run_checker" == "yes" ]; then
@@ -997,17 +1026,18 @@ if [ "$bisection_search" = "yes" -a "$good" != "yes" ]; then
maybe_device_mode=""
raw_cmd=""
if [ "$target_mode" = "yes" ]; then
- # Produce cmdline.sh in $DEX_LOCATION. "$@" is passed as a runtime option
+ # Produce cmdline.sh in $chroot_dex_location. "$@" is passed as a runtime option
# so that cmdline.sh forwards its arguments to dalvikvm. invoke-with is set
# to exec in order to preserve pid when calling dalvikvm. This is required
# for bisection search to correctly retrieve logs from device.
"./${run}" $run_args --runtime-option '"$@"' --invoke-with exec --dry-run "$@" &> /dev/null
- adb shell chmod u+x "$DEX_LOCATION/cmdline.sh"
+ adb shell chmod u+x "$chroot_dex_location/cmdline.sh"
maybe_device_mode="--device"
raw_cmd="$DEX_LOCATION/cmdline.sh"
else
raw_cmd="$cwd/${run} --external-log-tags $run_args $@"
fi
+ # TODO: Pass a `--chroot` option to the bisection_search.py script and use it there.
$ANDROID_BUILD_TOP/art/tools/bisection_search/bisection_search.py \
$maybe_device_mode \
--raw-cmd="$raw_cmd" \
@@ -1023,7 +1053,7 @@ if [ "$always_clean" = "yes" -o "$good" = "yes" ] && [ "$never_clean" = "no" ];
cd "$oldwd"
rm -rf "$tmp_dir"
if [ "$target_mode" = "yes" -a "$build_exit" = "0" ]; then
- adb shell rm -rf $DEX_LOCATION
+ adb shell rm -rf $chroot_dex_location
fi
if [ "$good" = "yes" ]; then
exit 0
@@ -1040,7 +1070,7 @@ fi
else
echo "${TEST_NAME} files left in ${tmp_dir} on host"
if [ "$target_mode" == "yes" ]; then
- echo "and in ${DEX_LOCATION} on target"
+ echo "and in ${chroot_dex_location} on target"
fi
fi
diff --git a/test/testrunner/env.py b/test/testrunner/env.py
index 7564f5a6b4..0c1c308218 100644
--- a/test/testrunner/env.py
+++ b/test/testrunner/env.py
@@ -91,6 +91,8 @@ HOST_2ND_ARCH_PREFIX = _get_build_var('HOST_2ND_ARCH_PREFIX')
HOST_2ND_ARCH_PREFIX_DEX2OAT_HOST_INSTRUCTION_SET_FEATURES = _env.get(
HOST_2ND_ARCH_PREFIX + 'DEX2OAT_HOST_INSTRUCTION_SET_FEATURES')
+ART_TEST_CHROOT = _env.get('ART_TEST_CHROOT')
+
ART_TEST_ANDROID_ROOT = _env.get('ART_TEST_ANDROID_ROOT')
ART_TEST_WITH_STRACE = _getEnvBoolean('ART_TEST_DEBUG_GC', False)
diff --git a/test/testrunner/testrunner.py b/test/testrunner/testrunner.py
index 88b509d3b7..254ffc9db1 100755
--- a/test/testrunner/testrunner.py
+++ b/test/testrunner/testrunner.py
@@ -320,6 +320,9 @@ def run_tests(tests):
if env.ART_TEST_BISECTION:
options_all += ' --bisection-search'
+ if env.ART_TEST_CHROOT:
+ options_all += ' --chroot ' + env.ART_TEST_CHROOT
+
if env.ART_TEST_ANDROID_ROOT:
options_all += ' --android-root ' + env.ART_TEST_ANDROID_ROOT