blob: e52fc3f12c29a5c1d1039c6ac7ebebff91878cd3 [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
Nicolas Geoffrayd06dc9c2015-03-30 15:30:26 +010022if [[ $ANDROID_SERIAL == 03a79ae90ae5889b ]] || [[ $ANDROID_SERIAL == HT4CTJT03670 ]] || [[ $ANDROID_SERIAL == HT49CJT00070 ]]; then
Nicolas Geoffray9620b9d2015-03-30 12:28:26 +010023 echo "Not run because of localhost failures. Investigating."
24 exit 0
25fi
26
Nicolas Geoffray96cd87a2015-03-26 16:48:29 +000027# Jar containing all the tests.
28test_jar=out/host/linux-x86/framework/apache-harmony-jdwp-tests-hostdex.jar
29junit_jar=out/host/linux-x86/framework/junit.jar
30
31if [ ! -f $test_jar -o ! -f $junit_jar ]; then
32 echo "Before running, you must build jdwp tests and vogar:" \
33 "make junit apache-harmony-jdwp-tests-hostdex vogar vogar.jar"
34 exit 1
35fi
36
37art="/data/local/tmp/system/bin/art"
38# We use Quick's image on target because optimizing's image is not compiled debuggable.
39image="-Ximage:/data/art-test/core.art"
40args=$@
41debuggee_args="-Xcompiler-option --compiler-backend=Optimizing -Xcompiler-option --debuggable"
42device_dir="--device-dir=/data/local/tmp"
Nicolas Geoffrayd06dc9c2015-03-30 15:30:26 +010043# We use the art script on target to ensure the runner and the debuggee share the same
44# image.
45vm_command="--vm-command=$art"
Nicolas Geoffray96cd87a2015-03-26 16:48:29 +000046
47while true; do
48 if [[ "$1" == "--mode=host" ]]; then
Nicolas Geoffrayc986d6a2015-03-30 19:14:09 +010049 echo "Host testing currently disabled because of buildbot. Investigating..."
50 exit 0
Nicolas Geoffray59786902015-03-30 16:34:16 +010051 # Specify bash explicitly since the art script cannot, since it has to run on the device
52 # with mksh.
53 art="bash out/host/linux-x86/bin/art"
Nicolas Geoffray96cd87a2015-03-26 16:48:29 +000054 # We force generation of a new image to avoid build-time and run-time classpath differences.
55 image="-Ximage:/system/non/existent"
Nicolas Geoffrayd06dc9c2015-03-30 15:30:26 +010056 # We do not need a device directory on host.
Nicolas Geoffray96cd87a2015-03-26 16:48:29 +000057 device_dir=""
Nicolas Geoffrayd06dc9c2015-03-30 15:30:26 +010058 # Vogar knows which VM to use on host.
59 vm_command=""
Nicolas Geoffray96cd87a2015-03-26 16:48:29 +000060 shift
61 elif [[ $1 == -Ximage:* ]]; then
62 image="$1"
63 shift
64 elif [[ "$1" == "" ]]; then
65 break
66 else
67 shift
68 fi
69done
70
71# Run the tests using vogar.
Nicolas Geoffrayd06dc9c2015-03-30 15:30:26 +010072vogar $vm_command \
Nicolas Geoffray96cd87a2015-03-26 16:48:29 +000073 --vm-arg $image \
Nicolas Geoffray9620b9d2015-03-30 12:28:26 +010074 --verbose \
Nicolas Geoffray96cd87a2015-03-26 16:48:29 +000075 $args \
76 $device_dir \
77 --vm-arg -Ximage-compiler-option \
78 --vm-arg --debuggable \
79 --timeout 600 \
80 --vm-arg -Djpda.settings.verbose=true \
81 --vm-arg -Djpda.settings.syncPort=34016 \
82 --vm-arg -Djpda.settings.debuggeeJavaPath="$art $image $debuggee_args" \
83 --classpath $test_jar \
84 --classpath $junit_jar \
85 --vm-arg -Xcompiler-option --vm-arg --compiler-backend=Optimizing \
86 --vm-arg -Xcompiler-option --vm-arg --debuggable \
87 org.apache.harmony.jpda.tests.share.AllTests