• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/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
24junit_jar=out/host/linux-x86/framework/junit.jar
25
26if [ ! -f $test_jar -o ! -f $junit_jar ]; then
27  echo "Before running, you must build jdwp tests and vogar:" \
28       "make junit apache-harmony-jdwp-tests-hostdex vogar vogar.jar"
29  exit 1
30fi
31
32art="/data/local/tmp/system/bin/art"
33art_debugee="sh /data/local/tmp/system/bin/art"
34# We use Quick's image on target because optimizing's image is not compiled debuggable.
35image="-Ximage:/data/art-test/core.art"
36args=$@
37debuggee_args="-Xcompiler-option --compiler-backend=Optimizing -Xcompiler-option --debuggable"
38device_dir="--device-dir=/data/local/tmp"
39# We use the art script on target to ensure the runner and the debuggee share the same
40# image.
41vm_command="--vm-command=$art"
42image_compiler_option=""
43
44while true; do
45  if [[ "$1" == "--mode=host" ]]; then
46    # 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"
49    art_debugee="bash out/host/linux-x86/bin/art"
50    # We force generation of a new image to avoid build-time and run-time classpath differences.
51    image="-Ximage:/system/non/existent"
52    # We do not need a device directory on host.
53    device_dir=""
54    # Vogar knows which VM to use on host.
55    vm_command=""
56    # We only compile the image on the host. Note that not providing this option
57    # puts us below the adb command limit for vogar.
58    image_compiler_option="--vm-arg -Ximage-compiler-option --vm-arg --debuggable"
59    shift
60  elif [[ $1 == -Ximage:* ]]; then
61    image="$1"
62    shift
63  elif [[ "$1" == "" ]]; then
64    break
65  else
66    shift
67  fi
68done
69
70# Run the tests using vogar.
71vogar $vm_command \
72      --vm-arg $image \
73      --verbose \
74      $args \
75      $device_dir \
76      $image_compiler_option \
77      --timeout 800 \
78      --vm-arg -Djpda.settings.verbose=true \
79      --vm-arg -Djpda.settings.syncPort=34016 \
80      --vm-arg -Djpda.settings.transportAddress=127.0.0.1:55107 \
81      --vm-arg -Djpda.settings.debuggeeJavaPath="\"$art_debugee $image $debuggee_args\"" \
82      --classpath $test_jar \
83      --classpath $junit_jar \
84      --vm-arg -Xcompiler-option --vm-arg --compiler-backend=Optimizing \
85      --vm-arg -Xcompiler-option --vm-arg --debuggable \
86      org.apache.harmony.jpda.tests.share.AllTests
87