blob: 7135dbaf557abc253acf78ca816adcae0cc4915e [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.
23test_jar=out/host/linux-x86/framework/apache-harmony-jdwp-tests-hostdex.jar
Nicolas Geoffray96cd87a2015-03-26 16:48:29 +000024
Nicolas Geoffrayf4ff1d42015-05-14 14:03:51 +000025if [ ! -f $test_jar ]; 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
31art="/data/local/tmp/system/bin/art"
Nicolas Geoffray33e1f8f2015-04-24 14:37:29 +010032art_debugee="sh /data/local/tmp/system/bin/art"
Nicolas Geoffray96cd87a2015-03-26 16:48:29 +000033# We use Quick's image on target because optimizing's image is not compiled debuggable.
34image="-Ximage:/data/art-test/core.art"
35args=$@
36debuggee_args="-Xcompiler-option --compiler-backend=Optimizing -Xcompiler-option --debuggable"
37device_dir="--device-dir=/data/local/tmp"
Nicolas Geoffrayd06dc9c2015-03-30 15:30:26 +010038# We use the art script on target to ensure the runner and the debuggee share the same
39# image.
40vm_command="--vm-command=$art"
Nicolas Geoffraya2c18612015-03-30 23:01:28 +010041image_compiler_option=""
Nicolas Geoffray9648a632015-06-15 14:35:01 +010042debug="no"
Nicolas Geoffray96cd87a2015-03-26 16:48:29 +000043
44while true; do
45 if [[ "$1" == "--mode=host" ]]; then
Nicolas Geoffray59786902015-03-30 16:34:16 +010046 # Specify bash explicitly since the art script cannot, since it has to run on the device
47 # with mksh.
48 art="bash out/host/linux-x86/bin/art"
Nicolas Geoffray33e1f8f2015-04-24 14:37:29 +010049 art_debugee="bash out/host/linux-x86/bin/art"
Nicolas Geoffray96cd87a2015-03-26 16:48:29 +000050 # We force generation of a new image to avoid build-time and run-time classpath differences.
51 image="-Ximage:/system/non/existent"
Nicolas Geoffrayd06dc9c2015-03-30 15:30:26 +010052 # We do not need a device directory on host.
Nicolas Geoffray96cd87a2015-03-26 16:48:29 +000053 device_dir=""
Nicolas Geoffrayd06dc9c2015-03-30 15:30:26 +010054 # Vogar knows which VM to use on host.
55 vm_command=""
Nicolas Geoffraya2c18612015-03-30 23:01:28 +010056 # We only compile the image on the host. Note that not providing this option
Nicolas Geoffray9648a632015-06-15 14:35:01 +010057 # for target testing puts us below the adb command limit for vogar.
Nicolas Geoffraya2c18612015-03-30 23:01:28 +010058 image_compiler_option="--vm-arg -Ximage-compiler-option --vm-arg --debuggable"
Nicolas Geoffray96cd87a2015-03-26 16:48:29 +000059 shift
60 elif [[ $1 == -Ximage:* ]]; then
61 image="$1"
62 shift
Nicolas Geoffray9648a632015-06-15 14:35:01 +010063 elif [[ $1 == "--debug" ]]; then
64 debug="yes"
65 # Remove the --debug from the arguments.
66 args=${args/$1}
67 shift
Nicolas Geoffray96cd87a2015-03-26 16:48:29 +000068 elif [[ "$1" == "" ]]; then
69 break
70 else
71 shift
72 fi
73done
74
Nicolas Geoffray9648a632015-06-15 14:35:01 +010075vm_args="--vm-arg $image"
76if [[ $debug == "yes" ]]; then
77 art="$art -d"
78 art_debugee="$art_debugee -d"
79 vm_args="$vm_args --vm-arg -XXlib:libartd.so"
80fi
81
Nicolas Geoffray96cd87a2015-03-26 16:48:29 +000082# Run the tests using vogar.
Nicolas Geoffrayd06dc9c2015-03-30 15:30:26 +010083vogar $vm_command \
Nicolas Geoffray9648a632015-06-15 14:35:01 +010084 $vm_args \
Nicolas Geoffray9620b9d2015-03-30 12:28:26 +010085 --verbose \
Nicolas Geoffray96cd87a2015-03-26 16:48:29 +000086 $args \
87 $device_dir \
Nicolas Geoffraya2c18612015-03-30 23:01:28 +010088 $image_compiler_option \
Nicolas Geoffray472b00c2015-05-06 14:57:09 +010089 --timeout 800 \
Nicolas Geoffray96cd87a2015-03-26 16:48:29 +000090 --vm-arg -Djpda.settings.verbose=true \
91 --vm-arg -Djpda.settings.syncPort=34016 \
Nicolas Geoffraya2c18612015-03-30 23:01:28 +010092 --vm-arg -Djpda.settings.transportAddress=127.0.0.1:55107 \
Nicolas Geoffray33e1f8f2015-04-24 14:37:29 +010093 --vm-arg -Djpda.settings.debuggeeJavaPath="\"$art_debugee $image $debuggee_args\"" \
Nicolas Geoffray96cd87a2015-03-26 16:48:29 +000094 --classpath $test_jar \
Nicolas Geoffray96cd87a2015-03-26 16:48:29 +000095 --vm-arg -Xcompiler-option --vm-arg --compiler-backend=Optimizing \
96 --vm-arg -Xcompiler-option --vm-arg --debuggable \
97 org.apache.harmony.jpda.tests.share.AllTests