blob: e4af9fa0d740101b060270041021666e805ca782 [file] [log] [blame]
Nicolas Geoffray96cd87a2015-03-26 16:48:29 +00001#!/bin/bash
2#
3# Copyright (C) 2015 The Android Open Source Project
4#
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
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
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.
16
17if [ ! -d libcore ]; then
18 echo "Script needs to be run at the root of the android tree"
19 exit 1
20fi
21
22# Jar containing all the tests.
Sebastien Hertz6705dab2016-02-17 17:05:52 +010023test_jack=${OUT_DIR-out}/host/common/obj/JAVA_LIBRARIES/apache-harmony-jdwp-tests-hostdex_intermediates/classes.jack
Nicolas Geoffray96cd87a2015-03-26 16:48:29 +000024
Sebastien Hertz6705dab2016-02-17 17:05:52 +010025if [ ! -f $test_jack ]; then
Nicolas Geoffray96cd87a2015-03-26 16:48:29 +000026 echo "Before running, you must build jdwp tests and vogar:" \
Nicolas Geoffrayf4ff1d42015-05-14 14:03:51 +000027 "make apache-harmony-jdwp-tests-hostdex vogar vogar.jar"
Nicolas Geoffray96cd87a2015-03-26 16:48:29 +000028 exit 1
29fi
30
Roland Levillainf2a5c9c2015-11-23 19:24:25 +000031if [ "x$ART_USE_READ_BARRIER" = xtrue ]; then
32 # For the moment, skip JDWP tests when read barriers are enabled, as
33 # they sometimes exhibit a deadlock issue with the concurrent
34 # copying collector in the read barrier configuration, between the
35 # HeapTaskDeamon and the JDWP thread (b/25800335).
36 #
37 # TODO: Re-enable the JDWP tests when this deadlock issue is fixed.
38 echo "JDWP tests are temporarily disabled in the read barrier configuration because of"
39 echo "a deadlock issue (b/25800335)."
40 exit 0
41fi
42
Nicolas Geoffray96cd87a2015-03-26 16:48:29 +000043art="/data/local/tmp/system/bin/art"
Nicolas Geoffray33e1f8f2015-04-24 14:37:29 +010044art_debugee="sh /data/local/tmp/system/bin/art"
Nicolas Geoffray96cd87a2015-03-26 16:48:29 +000045args=$@
Nicolas Geoffrayd553b432015-07-13 14:35:17 +010046debuggee_args="-Xcompiler-option --debuggable"
Nicolas Geoffray96cd87a2015-03-26 16:48:29 +000047device_dir="--device-dir=/data/local/tmp"
Nicolas Geoffrayd06dc9c2015-03-30 15:30:26 +010048# We use the art script on target to ensure the runner and the debuggee share the same
49# image.
50vm_command="--vm-command=$art"
Nicolas Geoffraya2c18612015-03-30 23:01:28 +010051image_compiler_option=""
Nicolas Geoffray9648a632015-06-15 14:35:01 +010052debug="no"
Sebastien Hertza646aaf2015-09-10 12:03:51 +020053verbose="no"
Nicolas Geoffray8d10e452015-10-28 17:01:04 +000054image="-Ximage:/data/art-test/core-jit.art"
Nicolas Geoffray95186552015-10-28 13:06:21 +000055vm_args=""
Sebastien Hertza646aaf2015-09-10 12:03:51 +020056# By default, we run the whole JDWP test suite.
57test="org.apache.harmony.jpda.tests.share.AllTests"
Hiroshi Yamauchia166bbb2015-11-19 16:24:31 -080058host="no"
Nicolas Geoffray96cd87a2015-03-26 16:48:29 +000059
60while true; do
61 if [[ "$1" == "--mode=host" ]]; then
Hiroshi Yamauchia166bbb2015-11-19 16:24:31 -080062 host="yes"
Nicolas Geoffray59786902015-03-30 16:34:16 +010063 # Specify bash explicitly since the art script cannot, since it has to run on the device
64 # with mksh.
Alex Lightb15fea22015-09-17 16:59:09 -070065 art="bash ${OUT_DIR-out}/host/linux-x86/bin/art"
66 art_debugee="bash ${OUT_DIR-out}/host/linux-x86/bin/art"
Andreas Gampe8994a042015-12-30 19:03:17 +000067 # We force generation of a new image to avoid build-time and run-time classpath differences.
68 image="-Ximage:/system/non/existent/vogar.art"
Nicolas Geoffrayd06dc9c2015-03-30 15:30:26 +010069 # We do not need a device directory on host.
Nicolas Geoffray96cd87a2015-03-26 16:48:29 +000070 device_dir=""
Nicolas Geoffrayd06dc9c2015-03-30 15:30:26 +010071 # Vogar knows which VM to use on host.
72 vm_command=""
Nicolas Geoffraya2c18612015-03-30 23:01:28 +010073 # We only compile the image on the host. Note that not providing this option
Nicolas Geoffray9648a632015-06-15 14:35:01 +010074 # for target testing puts us below the adb command limit for vogar.
Nicolas Geoffraya2c18612015-03-30 23:01:28 +010075 image_compiler_option="--vm-arg -Ximage-compiler-option --vm-arg --debuggable"
Nicolas Geoffray96cd87a2015-03-26 16:48:29 +000076 shift
77 elif [[ $1 == -Ximage:* ]]; then
78 image="$1"
79 shift
Nicolas Geoffray9648a632015-06-15 14:35:01 +010080 elif [[ $1 == "--debug" ]]; then
81 debug="yes"
82 # Remove the --debug from the arguments.
83 args=${args/$1}
84 shift
Sebastien Hertza646aaf2015-09-10 12:03:51 +020085 elif [[ $1 == "--verbose" ]]; then
86 verbose="yes"
87 # Remove the --verbose from the arguments.
88 args=${args/$1}
89 shift
90 elif [[ $1 == "--test" ]]; then
91 # Remove the --test from the arguments.
92 args=${args/$1}
93 shift
94 test=$1
95 # Remove the test from the arguments.
96 args=${args/$1}
97 shift
Nicolas Geoffray96cd87a2015-03-26 16:48:29 +000098 elif [[ "$1" == "" ]]; then
99 break
100 else
101 shift
102 fi
103done
104
Nicolas Geoffray95186552015-10-28 13:06:21 +0000105if [[ "$image" != "" ]]; then
106 vm_args="--vm-arg $image"
107fi
108vm_args="$vm_args --vm-arg -Xusejit:true"
Nicolas Geoffraye2725c52015-10-26 18:40:41 +0000109debuggee_args="$debuggee_args -Xusejit:true"
Nicolas Geoffray9648a632015-06-15 14:35:01 +0100110if [[ $debug == "yes" ]]; then
111 art="$art -d"
112 art_debugee="$art_debugee -d"
113 vm_args="$vm_args --vm-arg -XXlib:libartd.so"
114fi
Sebastien Hertza646aaf2015-09-10 12:03:51 +0200115if [[ $verbose == "yes" ]]; then
116 # Enable JDWP logs in the debuggee.
117 art_debugee="$art_debugee -verbose:jdwp"
118fi
Nicolas Geoffray9648a632015-06-15 14:35:01 +0100119
Sebastien Hertz6705dab2016-02-17 17:05:52 +0100120# Use Jack with "1.8" configuration.
121export JACK_VERSION=`basename prebuilts/sdk/tools/jacks/*ALPHA* | sed 's/^jack-//' | sed 's/.jar$//'`
122
Nicolas Geoffray96cd87a2015-03-26 16:48:29 +0000123# Run the tests using vogar.
Nicolas Geoffrayd06dc9c2015-03-30 15:30:26 +0100124vogar $vm_command \
Nicolas Geoffray9648a632015-06-15 14:35:01 +0100125 $vm_args \
Nicolas Geoffray9620b9d2015-03-30 12:28:26 +0100126 --verbose \
Nicolas Geoffray96cd87a2015-03-26 16:48:29 +0000127 $args \
128 $device_dir \
Nicolas Geoffraya2c18612015-03-30 23:01:28 +0100129 $image_compiler_option \
Nicolas Geoffray472b00c2015-05-06 14:57:09 +0100130 --timeout 800 \
Nicolas Geoffray96cd87a2015-03-26 16:48:29 +0000131 --vm-arg -Djpda.settings.verbose=true \
132 --vm-arg -Djpda.settings.syncPort=34016 \
Nicolas Geoffraya2c18612015-03-30 23:01:28 +0100133 --vm-arg -Djpda.settings.transportAddress=127.0.0.1:55107 \
Paul Duffin1acc7292015-12-01 13:56:52 +0000134 --vm-arg -Djpda.settings.debuggeeJavaPath="$art_debugee $image $debuggee_args" \
Sebastien Hertz6705dab2016-02-17 17:05:52 +0100135 --classpath $test_jack \
136 --toolchain jack --language JN \
Nicolas Geoffray96cd87a2015-03-26 16:48:29 +0000137 --vm-arg -Xcompiler-option --vm-arg --debuggable \
Sebastien Hertza646aaf2015-09-10 12:03:51 +0200138 $test
Hiroshi Yamauchia166bbb2015-11-19 16:24:31 -0800139
140vogar_exit_status=$?
141
142echo "Killing stalled dalvikvm processes..."
143if [[ $host == "yes" ]]; then
144 pkill -9 -f /bin/dalvikvm
145else
146 adb shell pkill -9 -f /bin/dalvikvm
147fi
148echo "Done."
149
150exit $vogar_exit_status