3 # Copyright (C) 2015 The Android Open Source Project
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 if [ ! -d libcore ]; then
18 echo "Script needs to be run at the root of the android tree"
22 # Jar containing all the tests.
23 test_jack=${OUT_DIR-out}/host/common/obj/JAVA_LIBRARIES/apache-harmony-jdwp-tests-hostdex_intermediates/classes.jack
25 if [ ! -f $test_jack ]; then
26 echo "Before running, you must build jdwp tests and vogar:" \
27 "make apache-harmony-jdwp-tests-hostdex vogar vogar.jar"
31 art="/data/local/tmp/system/bin/art"
32 art_debugee="sh /data/local/tmp/system/bin/art"
34 debuggee_args="-Xcompiler-option --debuggable"
35 device_dir="--device-dir=/data/local/tmp"
36 # We use the art script on target to ensure the runner and the debuggee share the same
38 vm_command="--vm-command=$art"
39 image_compiler_option=""
42 image="-Ximage:/data/art-test/core-optimizing-pic.art"
44 # By default, we run the whole JDWP test suite.
45 test="org.apache.harmony.jpda.tests.share.AllTests"
49 if [[ "$1" == "--mode=host" ]]; then
51 # Specify bash explicitly since the art script cannot, since it has to run on the device
53 art="bash ${OUT_DIR-out}/host/linux-x86/bin/art"
54 art_debugee="bash ${OUT_DIR-out}/host/linux-x86/bin/art"
55 # We force generation of a new image to avoid build-time and run-time classpath differences.
56 image="-Ximage:/system/non/existent/vogar.art"
57 # We do not need a device directory on host.
59 # Vogar knows which VM to use on host.
62 elif [[ $1 == -Ximage:* ]]; then
65 elif [[ $1 == "--debug" ]]; then
67 # Remove the --debug from the arguments.
70 elif [[ $1 == "--verbose" ]]; then
72 # Remove the --verbose from the arguments.
75 elif [[ $1 == "--test" ]]; then
76 # Remove the --test from the arguments.
80 # Remove the test from the arguments.
83 elif [[ "$1" == "" ]]; then
90 if [[ "$image" != "" ]]; then
91 vm_args="--vm-arg $image"
93 vm_args="$vm_args --vm-arg -Xusejit:true"
94 debuggee_args="$debuggee_args -Xusejit:true"
95 if [[ $debug == "yes" ]]; then
97 art_debugee="$art_debugee -d"
98 vm_args="$vm_args --vm-arg -XXlib:libartd.so"
100 if [[ $verbose == "yes" ]]; then
101 # Enable JDWP logs in the debuggee.
102 art_debugee="$art_debugee -verbose:jdwp"
105 # Run the tests using vogar.
111 $image_compiler_option \
113 --vm-arg -Djpda.settings.verbose=true \
114 --vm-arg -Djpda.settings.syncPort=34016 \
115 --vm-arg -Djpda.settings.transportAddress=127.0.0.1:55107 \
116 --vm-arg -Djpda.settings.debuggeeJavaPath="$art_debugee $image $debuggee_args" \
117 --classpath $test_jack \
118 --toolchain jack --language JN \
119 --vm-arg -Xcompiler-option --vm-arg --debuggable \
124 echo "Killing stalled dalvikvm processes..."
125 if [[ $host == "yes" ]]; then
126 pkill -9 -f /bin/dalvikvm
128 adb shell pkill -9 -f /bin/dalvikvm
132 exit $vogar_exit_status