blob: fec969c8700b9442d750c8486fda12eb3ed1fe7a [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
Colin Crosse0ef0a82017-07-27 21:29:18 +000022source build/envsetup.sh >&/dev/null # for get_build_var, setpaths
23setpaths # include platform prebuilt java, javac, etc in $PATH.
Shubham Ajmerac33c0872017-07-20 18:41:52 -070024
Andreas Gampeebd089d2016-07-18 14:56:56 -070025if [ -z "$ANDROID_HOST_OUT" ] ; then
26 ANDROID_HOST_OUT=${OUT_DIR-$ANDROID_BUILD_TOP/out}/host/linux-x86
27fi
28
Roland Levillain08f7c1d2018-05-25 15:34:41 +010029# "Root" (actually "system") directory on device (in the case of
30# target testing).
31android_root=${ART_TEST_ANDROID_ROOT:-/system}
Roland Levillain1c361882018-03-02 14:23:51 +000032
Alex Light617c9c52017-08-18 11:52:25 -070033java_lib_location="${ANDROID_HOST_OUT}/../common/obj/JAVA_LIBRARIES"
34make_target_name="apache-harmony-jdwp-tests-hostdex"
Igor Murashkin84f26322017-06-06 11:36:33 -070035
Vladimir Marko91f10322018-12-07 18:04:10 +000036function boot_classpath_arg {
37 local dir="$1"
38 local suffix="$2"
39 shift 2
40 local separator=""
41 for var
42 do
Nicolas Geoffray31e0dc22020-03-20 15:48:09 +000043 if [ "$var" = "conscrypt" ] && [ "$mode" = "target" ]; then
44 printf -- "${separator}/apex/com.android.conscrypt/javalib/conscrypt.jar";
Victor Changd20e51d2020-05-05 16:01:19 +010045 elif [ "$var" = "core-icu4j" ] && [ "$mode" = "target" ]; then
46 printf -- "${separator}/apex/com.android.i18n/javalib/core-icu4j.jar";
Nicolas Geoffray31e0dc22020-03-20 15:48:09 +000047 else
48 printf -- "${separator}${dir}/${var}${suffix}.jar";
49 fi
Vladimir Marko91f10322018-12-07 18:04:10 +000050 separator=":"
51 done
52}
53
Vladimir Marko0ace5632018-12-14 11:11:47 +000054# Note: This must start with the CORE_IMG_JARS in Android.common_path.mk
David Srbecky6355d692020-03-26 14:10:26 +000055# because that's what we use for compiling the boot.art image.
Vladimir Marko0ace5632018-12-14 11:11:47 +000056# It may contain additional modules from TEST_CORE_JARS.
Victor Changd20e51d2020-05-05 16:01:19 +010057BOOT_CLASSPATH_JARS="core-oj core-libart okhttp bouncycastle apache-xml core-icu4j conscrypt"
Vladimir Marko91f10322018-12-07 18:04:10 +000058
Alex Light617c9c52017-08-18 11:52:25 -070059vm_args=""
Roland Levillain1c361882018-03-02 14:23:51 +000060art="$android_root/bin/art"
Nicolas Geoffray31e0dc22020-03-20 15:48:09 +000061mode="target"
Roland Levillain1c361882018-03-02 14:23:51 +000062art_debugee="sh $android_root/bin/art"
Nicolas Geoffray96cd87a2015-03-26 16:48:29 +000063args=$@
Roland Levillain08f7c1d2018-05-25 15:34:41 +010064chroot_option=
Nicolas Geoffrayd553b432015-07-13 14:35:17 +010065debuggee_args="-Xcompiler-option --debuggable"
Nicolas Geoffray96cd87a2015-03-26 16:48:29 +000066device_dir="--device-dir=/data/local/tmp"
Nicolas Geoffrayd06dc9c2015-03-30 15:30:26 +010067# We use the art script on target to ensure the runner and the debuggee share the same
68# image.
69vm_command="--vm-command=$art"
Nicolas Geoffraya2c18612015-03-30 23:01:28 +010070image_compiler_option=""
Alex Light617c9c52017-08-18 11:52:25 -070071plugin=""
Nicolas Geoffray9648a632015-06-15 14:35:01 +010072debug="no"
Alex Light84b92e02017-09-29 13:46:14 -070073explicit_debug="no"
Sebastien Hertza646aaf2015-09-10 12:03:51 +020074verbose="no"
Jiakai Zhang45c6d8b2022-02-18 14:17:31 +000075image="-Ximage:/system/framework/art_boot_images/boot.art"
Nicolas Geoffray31e0dc22020-03-20 15:48:09 +000076boot_classpath="$(boot_classpath_arg /apex/com.android.art/javalib "" $BOOT_CLASSPATH_JARS)"
Vladimir Marko91f10322018-12-07 18:04:10 +000077boot_classpath_locations=""
Alex Light0ac2e5c2017-09-19 15:35:20 -070078with_jdwp_path=""
79agent_wrapper=""
Nicolas Geoffray95186552015-10-28 13:06:21 +000080vm_args=""
Sebastien Hertza646aaf2015-09-10 12:03:51 +020081# By default, we run the whole JDWP test suite.
Alex Light84b92e02017-09-29 13:46:14 -070082has_specific_test="no"
Sebastien Hertza646aaf2015-09-10 12:03:51 +020083test="org.apache.harmony.jpda.tests.share.AllTests"
Roland Levillain5db109b2016-05-19 12:24:17 +010084# Use JIT compiling by default.
85use_jit=true
Alex Lightd0d25fe2018-07-20 15:46:49 -070086instant_jit=false
Andreas Gampe85b286b2015-12-30 19:37:48 -080087variant_cmdline_parameter="--variant=X32"
Alex Light878f33f2018-02-08 11:16:39 -080088dump_command="/bin/true"
Alex Lightbd5690d2019-09-30 15:39:15 -070089called_from_libjdwp=${RUN_JDWP_TESTS_CALLED_FROM_LIBJDWP:-false}
90run_internal_jdwp_test=false
91# Let LUCI bots do what they want.
92if test -v LUCI_CONTEXT; then
93 run_internal_jdwp_test=true
94fi
Sebastien Hertzc3b208c2017-03-27 11:35:54 +020095# Timeout of JDWP test in ms.
96#
97# Note: some tests expect a timeout to check that *no* reply/event is received for a specific case.
98# A lower timeout can save up several minutes when running the whole test suite, especially for
99# continuous testing. This value can be adjusted to fit the configuration of the host machine(s).
100jdwp_test_timeout=10000
Nicolas Geoffray96cd87a2015-03-26 16:48:29 +0000101
Alex Light7fca6ef2019-10-02 09:24:20 -0700102skip_tests=
Alex Light84b92e02017-09-29 13:46:14 -0700103gdb_target=
104has_gdb="no"
105
Nicolas Geoffray96cd87a2015-03-26 16:48:29 +0000106while true; do
107 if [[ "$1" == "--mode=host" ]]; then
Alex Light617c9c52017-08-18 11:52:25 -0700108 mode="host"
Nicolas Geoffray59786902015-03-30 16:34:16 +0100109 # Specify bash explicitly since the art script cannot, since it has to run on the device
110 # with mksh.
Alex Lightb15fea22015-09-17 16:59:09 -0700111 art="bash ${OUT_DIR-out}/host/linux-x86/bin/art"
112 art_debugee="bash ${OUT_DIR-out}/host/linux-x86/bin/art"
Andreas Gampe8994a042015-12-30 19:03:17 +0000113 # We force generation of a new image to avoid build-time and run-time classpath differences.
114 image="-Ximage:/system/non/existent/vogar.art"
Vladimir Marko91f10322018-12-07 18:04:10 +0000115 # Pass the host boot classpath.
116 if [ "${ANDROID_HOST_OUT:0:${#ANDROID_BUILD_TOP}+1}" = "${ANDROID_BUILD_TOP}/" ]; then
117 framework_location="${ANDROID_HOST_OUT:${#ANDROID_BUILD_TOP}+1}/framework"
118 else
119 echo "error: ANDROID_BUILD_TOP/ is not a prefix of ANDROID_HOST_OUT"
120 echo "ANDROID_BUILD_TOP=${ANDROID_BUILD_TOP}"
121 echo "ANDROID_HOST_OUT=${ANDROID_HOST_OUT}"
122 exit
123 fi
124 boot_classpath="$(boot_classpath_arg ${ANDROID_HOST_OUT}/framework -hostdex $BOOT_CLASSPATH_JARS)"
125 boot_classpath_locations="$(boot_classpath_arg ${framework_location} -hostdex $BOOT_CLASSPATH_JARS)"
Nicolas Geoffrayd06dc9c2015-03-30 15:30:26 +0100126 # We do not need a device directory on host.
Nicolas Geoffray96cd87a2015-03-26 16:48:29 +0000127 device_dir=""
Nicolas Geoffrayd06dc9c2015-03-30 15:30:26 +0100128 # Vogar knows which VM to use on host.
129 vm_command=""
Nicolas Geoffray96cd87a2015-03-26 16:48:29 +0000130 shift
Alex Light617c9c52017-08-18 11:52:25 -0700131 elif [[ "$1" == "--mode=jvm" ]]; then
132 mode="ri"
Paul Duffin50715312019-07-11 15:44:25 +0100133 make_target_name="apache-harmony-jdwp-tests"
Alex Lightbd5690d2019-09-30 15:39:15 -0700134 run_internal_jdwp_test=true
Alex Light617c9c52017-08-18 11:52:25 -0700135 art="$(which java)"
136 art_debugee="$(which java)"
137 # No need for extra args.
138 debuggee_args=""
139 # No image. On the RI.
140 image=""
Vladimir Marko91f10322018-12-07 18:04:10 +0000141 boot_classpath=""
142 boot_classpath_locations=""
Alex Light617c9c52017-08-18 11:52:25 -0700143 # We do not need a device directory on RI.
144 device_dir=""
145 # Vogar knows which VM to use on RI.
146 vm_command=""
147 # We don't care about jit with the RI
148 use_jit=false
149 shift
Alex Light7fca6ef2019-10-02 09:24:20 -0700150 elif [[ $1 == --skip-test ]]; then
151 skip_tests="${skip_tests},${2}"
152 # remove the --skip-test
153 args=${args/$1}
154 shift
155 # remove the arg
156 args=${args/$1}
157 shift
Alex Lightbd5690d2019-09-30 15:39:15 -0700158 elif [[ $1 == --force-run-test ]]; then
159 run_internal_jdwp_test=true
160 # remove the --force-run-test
161 args=${args/$1}
162 shift
Alex Lightec4a10c2017-11-17 09:06:26 -0800163 elif [[ $1 == --test-timeout-ms ]]; then
164 # Remove the --test-timeout-ms from the arguments.
165 args=${args/$1}
166 shift
167 jdwp_test_timeout=$1
168 # Remove the argument
169 args=${args/$1}
170 shift
Alex Light0ac2e5c2017-09-19 15:35:20 -0700171 elif [[ $1 == --agent-wrapper ]]; then
172 # Remove the --agent-wrapper from the arguments.
173 args=${args/$1}
174 shift
175 agent_wrapper=${agent_wrapper}${1},
176 # Remove the argument
177 args=${args/$1}
178 shift
Nicolas Geoffray96cd87a2015-03-26 16:48:29 +0000179 elif [[ $1 == -Ximage:* ]]; then
180 image="$1"
181 shift
Alex Lightd0d25fe2018-07-20 15:46:49 -0700182 elif [[ "$1" == "--instant-jit" ]]; then
183 instant_jit=true
184 # Remove the --instant-jit from the arguments.
185 args=${args/$1}
186 shift
Roland Levillain5db109b2016-05-19 12:24:17 +0100187 elif [[ "$1" == "--no-jit" ]]; then
188 use_jit=false
189 # Remove the --no-jit from the arguments.
190 args=${args/$1}
191 shift
Alex Light84b92e02017-09-29 13:46:14 -0700192 elif [[ $1 == "--no-debug" ]]; then
193 explicit_debug="yes"
194 debug="no"
195 # Remove the --no-debug from the arguments.
196 args=${args/$1}
197 shift
Nicolas Geoffray9648a632015-06-15 14:35:01 +0100198 elif [[ $1 == "--debug" ]]; then
Alex Light84b92e02017-09-29 13:46:14 -0700199 explicit_debug="yes"
Nicolas Geoffray9648a632015-06-15 14:35:01 +0100200 debug="yes"
201 # Remove the --debug from the arguments.
202 args=${args/$1}
203 shift
Sebastien Hertza646aaf2015-09-10 12:03:51 +0200204 elif [[ $1 == "--verbose" ]]; then
205 verbose="yes"
206 # Remove the --verbose from the arguments.
207 args=${args/$1}
208 shift
Alex Light84b92e02017-09-29 13:46:14 -0700209 elif [[ $1 == "--gdbserver" ]]; then
210 # Remove the --gdbserver from the arguments.
211 args=${args/$1}
212 has_gdb="yes"
213 shift
214 gdb_target=$1
215 # Remove the target from the arguments.
216 args=${args/$1}
217 shift
Sebastien Hertza646aaf2015-09-10 12:03:51 +0200218 elif [[ $1 == "--test" ]]; then
219 # Remove the --test from the arguments.
220 args=${args/$1}
221 shift
Alex Light84b92e02017-09-29 13:46:14 -0700222 has_specific_test="yes"
Sebastien Hertza646aaf2015-09-10 12:03:51 +0200223 test=$1
224 # Remove the test from the arguments.
225 args=${args/$1}
226 shift
Alex Light617c9c52017-08-18 11:52:25 -0700227 elif [[ "$1" == "--jdwp-path" ]]; then
228 # Remove the --jdwp-path from the arguments.
229 args=${args/$1}
230 shift
Alex Light0ac2e5c2017-09-19 15:35:20 -0700231 with_jdwp_path=$1
Alex Light617c9c52017-08-18 11:52:25 -0700232 # Remove the path from the arguments.
233 args=${args/$1}
234 shift
Nicolas Geoffray96cd87a2015-03-26 16:48:29 +0000235 elif [[ "$1" == "" ]]; then
236 break
Andreas Gampe85b286b2015-12-30 19:37:48 -0800237 elif [[ $1 == --variant=* ]]; then
238 variant_cmdline_parameter=$1
239 shift
Alex Light617c9c52017-08-18 11:52:25 -0700240 elif [[ $1 == -Xplugin:* ]]; then
241 plugin="$1"
242 args=${args/$1}
243 shift
Nicolas Geoffray96cd87a2015-03-26 16:48:29 +0000244 else
245 shift
246 fi
247done
248
Roland Levillain0331a0f2020-01-22 16:08:39 +0000249if [ ! -t 1 ] ; then
250 # Suppress color codes if not attached to a terminal
251 args="$args --no-color"
252fi
253
Roland Levillain08f7c1d2018-05-25 15:34:41 +0100254if [[ $mode == "target" ]]; then
255 # Honor environment variable ART_TEST_CHROOT.
256 if [[ -n "$ART_TEST_CHROOT" ]]; then
257 # Set Vogar's `--chroot` option.
258 chroot_option="--chroot $ART_TEST_CHROOT"
259 # Adjust settings for chroot environment.
260 art="/system/bin/art"
261 art_debugee="sh /system/bin/art"
262 vm_command="--vm-command=$art"
263 device_dir="--device-dir=/tmp"
264 fi
Roland Levillaine4f1c512017-10-30 13:28:28 +0000265fi
266
Alex Lightbd5690d2019-09-30 15:39:15 -0700267if [[ $called_from_libjdwp != "true" ]]; then
268 if [[ $run_internal_jdwp_test = "false" ]]; then
269 echo "Calling run_jdwp_tests.sh directly is probably not what you want. You probably want to"
270 echo "run ./art/tools/run-libjdwp-tests.sh instead in order to test the JDWP implementation"
271 echo "used by apps. If you really wish to run these tests using the deprecated internal JDWP"
272 echo "implementation pass the '--force-run-test' flag."
273 exit 1
274 fi
275fi
276
Alex Light84b92e02017-09-29 13:46:14 -0700277if [[ $has_gdb = "yes" ]]; then
278 if [[ $explicit_debug = "no" ]]; then
279 debug="yes"
280 fi
281fi
282
Alex Light617c9c52017-08-18 11:52:25 -0700283if [[ $mode == "ri" ]]; then
Alex Light0ac2e5c2017-09-19 15:35:20 -0700284 if [[ "x$with_jdwp_path" != "x" ]]; then
285 vm_args="${vm_args} --vm-arg -Djpda.settings.debuggeeAgentArgument=-agentpath:${agent_wrapper}"
286 vm_args="${vm_args} --vm-arg -Djpda.settings.debuggeeAgentName=$with_jdwp_path"
287 fi
Alex Light617c9c52017-08-18 11:52:25 -0700288 if [[ "x$image" != "x" ]]; then
289 echo "Cannot use -Ximage: with --mode=jvm"
290 exit 1
Alex Light84b92e02017-09-29 13:46:14 -0700291 elif [[ $has_gdb = "yes" ]]; then
292 echo "Cannot use --gdbserver with --mode=jvm"
293 exit 1
Alex Light617c9c52017-08-18 11:52:25 -0700294 elif [[ $debug == "yes" ]]; then
295 echo "Cannot use --debug with --mode=jvm"
296 exit 1
297 fi
298else
Alex Light878f33f2018-02-08 11:16:39 -0800299 if [[ "$mode" == "host" ]]; then
300 dump_command="/bin/kill -3"
301 else
Roland Levillainb52dbb72018-05-01 14:03:45 +0100302 # Note that this dumping command won't work when `$android_root`
303 # is different from `/system` (e.g. on ART Buildbot devices) when
304 # the device is running Android N, as the debuggerd protocol
305 # changed in an incompatible way in Android O (see b/32466479).
306 dump_command="$android_root/xbin/su root $android_root/bin/debuggerd"
Alex Light878f33f2018-02-08 11:16:39 -0800307 fi
Alex Light84b92e02017-09-29 13:46:14 -0700308 if [[ $has_gdb = "yes" ]]; then
309 if [[ $mode == "target" ]]; then
310 echo "Cannot use --gdbserver with --mode=target"
311 exit 1
312 else
313 art_debugee="$art_debugee --gdbserver $gdb_target"
314 # The tests absolutely require some timeout. We set a ~2 week timeout since we can kill the
315 # test with gdb if it goes on too long.
316 jdwp_test_timeout="1000000000"
317 fi
318 fi
Alex Light0ac2e5c2017-09-19 15:35:20 -0700319 if [[ "x$with_jdwp_path" != "x" ]]; then
320 vm_args="${vm_args} --vm-arg -Djpda.settings.debuggeeAgentArgument=-agentpath:${agent_wrapper}"
321 vm_args="${vm_args} --vm-arg -Djpda.settings.debuggeeAgentName=${with_jdwp_path}"
322 fi
Alex Light617c9c52017-08-18 11:52:25 -0700323 vm_args="$vm_args --vm-arg -Xcompiler-option --vm-arg --debuggable"
Alex Lightbaac7e42018-06-08 15:30:11 +0000324 # we don't want to be trying to connect to adbconnection which might not have
325 # been built.
326 vm_args="${vm_args} --vm-arg -XjdwpProvider:none"
Nicolas Geoffrayf983c732018-09-12 09:27:29 +0100327 # Make sure the debuggee doesn't re-generate, nor clean up what the debugger has generated.
328 art_debugee="$art_debugee --no-compile --no-clean"
Alex Light617c9c52017-08-18 11:52:25 -0700329fi
330
331function jlib_name {
332 local path=$1
333 local str="classes"
334 local suffix="jar"
335 if [[ $mode == "ri" ]]; then
Alex Light617c9c52017-08-18 11:52:25 -0700336 str="javalib"
Alex Light617c9c52017-08-18 11:52:25 -0700337 fi
338 echo "$path/$str.$suffix"
339}
340
341# Jar containing all the tests.
342test_jar=$(jlib_name "${java_lib_location}/${make_target_name}_intermediates")
343
344if [[ ! -f $test_jar ]]; then
345 echo "Before running, you must build jdwp tests and vogar:" \
Roland Levillaine47933a2019-08-09 14:06:02 +0100346 "m ${make_target_name} vogar"
Alex Light617c9c52017-08-18 11:52:25 -0700347 exit 1
348fi
Nicolas Geoffrayc0c07852017-08-08 09:44:15 +0100349
Andreas Gampe85b286b2015-12-30 19:37:48 -0800350# For the host:
351#
352# If, on the other hand, there is a variant set, use it to modify the art_debugee parameter to
353# force the fork to have the same bitness as the controller. This should be fine and not impact
354# testing (cross-bitness), as the protocol is always 64-bit anyways (our implementation).
355#
356# Note: this isn't necessary for the device as the BOOTCLASSPATH environment variable is set there
357# and used as a fallback.
Alex Light617c9c52017-08-18 11:52:25 -0700358if [[ $mode == "host" ]]; then
Andreas Gampe85b286b2015-12-30 19:37:48 -0800359 variant=${variant_cmdline_parameter:10}
360 if [[ $variant == "x32" || $variant == "X32" ]]; then
361 art_debugee="$art_debugee --32"
362 elif [[ $variant == "x64" || $variant == "X64" ]]; then
363 art_debugee="$art_debugee --64"
364 else
365 echo "Error, do not understand variant $variant_cmdline_parameter."
366 exit 1
367 fi
368fi
369
Nicolas Geoffray95186552015-10-28 13:06:21 +0000370if [[ "$image" != "" ]]; then
Alex Light617c9c52017-08-18 11:52:25 -0700371 vm_args="$vm_args --vm-arg $image"
Vladimir Marko91f10322018-12-07 18:04:10 +0000372 debuggee_args="$debuggee_args $image"
373fi
374if [[ "$boot_classpath" != "" ]]; then
375 vm_args="$vm_args --vm-arg -Xbootclasspath:${boot_classpath}"
376 debuggee_args="$debuggee_args -Xbootclasspath:${boot_classpath}"
377fi
378if [[ "$boot_classpath_locations" != "" ]]; then
379 vm_args="$vm_args --vm-arg -Xbootclasspath-locations:${boot_classpath_locations}"
380 debuggee_args="$debuggee_args -Xbootclasspath-locations:${boot_classpath_locations}"
Nicolas Geoffray95186552015-10-28 13:06:21 +0000381fi
Alex Light617c9c52017-08-18 11:52:25 -0700382
383if [[ "$plugin" != "" ]]; then
384 vm_args="$vm_args --vm-arg $plugin"
385fi
386
Alex Light617c9c52017-08-18 11:52:25 -0700387if [[ $mode != "ri" ]]; then
Andreas Gampe817dc662018-09-25 18:08:52 -0700388 # Because we're running debuggable, we discard any AOT code.
389 # Therefore we run de2oat with 'quicken' to avoid spending time compiling.
390 vm_args="$vm_args --vm-arg -Xcompiler-option --vm-arg --compiler-filter=quicken"
391 debuggee_args="$debuggee_args -Xcompiler-option --compiler-filter=quicken"
392
393 if $instant_jit; then
394 debuggee_args="$debuggee_args -Xjitthreshold:0"
395 fi
396
Alex Light617c9c52017-08-18 11:52:25 -0700397 vm_args="$vm_args --vm-arg -Xusejit:$use_jit"
398 debuggee_args="$debuggee_args -Xusejit:$use_jit"
399fi
400
Nicolas Geoffray9648a632015-06-15 14:35:01 +0100401if [[ $debug == "yes" ]]; then
402 art="$art -d"
403 art_debugee="$art_debugee -d"
Andreas Gampe1c5b42f2017-06-15 18:20:45 -0700404 vm_args="$vm_args --vm-arg -XXlib:libartd.so --vm-arg -XX:SlowDebug=true"
Nicolas Geoffray9648a632015-06-15 14:35:01 +0100405fi
Sebastien Hertza646aaf2015-09-10 12:03:51 +0200406if [[ $verbose == "yes" ]]; then
407 # Enable JDWP logs in the debuggee.
408 art_debugee="$art_debugee -verbose:jdwp"
409fi
Nicolas Geoffray9648a632015-06-15 14:35:01 +0100410
Neil Fuller239bdf62018-01-08 18:55:36 +0000411if [[ $mode != "ri" ]]; then
Neil Fullerc546ec92018-01-05 15:00:35 +0000412 toolchain_args="--toolchain d8 --language CUR"
Alex Light264a4862018-01-31 16:47:58 +0000413 if [[ "x$with_jdwp_path" == "x" ]]; then
414 # Need to enable the internal jdwp implementation.
415 art_debugee="${art_debugee} -XjdwpProvider:internal"
Alex Lightbaac7e42018-06-08 15:30:11 +0000416 else
417 # need to disable the jdwpProvider since we give the agent explicitly on the
418 # cmdline.
419 art_debugee="${art_debugee} -XjdwpProvider:none"
Alex Light264a4862018-01-31 16:47:58 +0000420 fi
Alex Light8d8299d2017-11-10 08:41:04 -0800421else
422 toolchain_args="--toolchain javac --language CUR"
Igor Murashkin84f26322017-06-06 11:36:33 -0700423fi
424
Nicolas Geoffray96cd87a2015-03-26 16:48:29 +0000425# Run the tests using vogar.
Nicolas Geoffrayd06dc9c2015-03-30 15:30:26 +0100426vogar $vm_command \
Nicolas Geoffray9648a632015-06-15 14:35:01 +0100427 $vm_args \
Nicolas Geoffray9620b9d2015-03-30 12:28:26 +0100428 --verbose \
Nicolas Geoffray96cd87a2015-03-26 16:48:29 +0000429 $args \
Roland Levillain08f7c1d2018-05-25 15:34:41 +0100430 $chroot_option \
Nicolas Geoffray96cd87a2015-03-26 16:48:29 +0000431 $device_dir \
Nicolas Geoffraya2c18612015-03-30 23:01:28 +0100432 $image_compiler_option \
Nicolas Geoffray472b00c2015-05-06 14:57:09 +0100433 --timeout 800 \
Nicolas Geoffray96cd87a2015-03-26 16:48:29 +0000434 --vm-arg -Djpda.settings.verbose=true \
Sebastien Hertzc3b208c2017-03-27 11:35:54 +0200435 --vm-arg -Djpda.settings.timeout=$jdwp_test_timeout \
436 --vm-arg -Djpda.settings.waitingTime=$jdwp_test_timeout \
Nicolas Geoffraya2c18612015-03-30 23:01:28 +0100437 --vm-arg -Djpda.settings.transportAddress=127.0.0.1:55107 \
Alex Light878f33f2018-02-08 11:16:39 -0800438 --vm-arg -Djpda.settings.dumpProcess="$dump_command" \
Vladimir Marko91f10322018-12-07 18:04:10 +0000439 --vm-arg -Djpda.settings.debuggeeJavaPath="$art_debugee $plugin $debuggee_args" \
Alex Light7fca6ef2019-10-02 09:24:20 -0700440 --vm-arg -Djpda.settings.badTestCases="$skip_tests" \
Igor Murashkin84f26322017-06-06 11:36:33 -0700441 --classpath "$test_jar" \
442 $toolchain_args \
Sebastien Hertza646aaf2015-09-10 12:03:51 +0200443 $test
Hiroshi Yamauchia166bbb2015-11-19 16:24:31 -0800444
445vogar_exit_status=$?
446
447echo "Killing stalled dalvikvm processes..."
Alex Lightc611ffa2017-10-18 08:59:16 -0700448if [[ $mode == "host" ]]; then
Hiroshi Yamauchia166bbb2015-11-19 16:24:31 -0800449 pkill -9 -f /bin/dalvikvm
450else
Orion Hodsoncfb4ed52018-05-22 10:48:52 +0100451 # Tests may run on older Android versions where pkill requires "-l SIGNAL"
452 # rather than "-SIGNAL".
453 adb shell pkill -l 9 -f /bin/dalvikvm
Hiroshi Yamauchia166bbb2015-11-19 16:24:31 -0800454fi
455echo "Done."
456
457exit $vogar_exit_status