Nicolas Geoffray | 96cd87a | 2015-03-26 16:48:29 +0000 | [diff] [blame] | 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 | |
| 17 | if [ ! -d libcore ]; then |
| 18 | echo "Script needs to be run at the root of the android tree" |
| 19 | exit 1 |
| 20 | fi |
| 21 | |
| 22 | # Jar containing all the tests. |
| 23 | test_jar=out/host/linux-x86/framework/apache-harmony-jdwp-tests-hostdex.jar |
Nicolas Geoffray | 96cd87a | 2015-03-26 16:48:29 +0000 | [diff] [blame] | 24 | |
Nicolas Geoffray | f4ff1d4 | 2015-05-14 14:03:51 +0000 | [diff] [blame] | 25 | if [ ! -f $test_jar ]; then |
Nicolas Geoffray | 96cd87a | 2015-03-26 16:48:29 +0000 | [diff] [blame] | 26 | echo "Before running, you must build jdwp tests and vogar:" \ |
Nicolas Geoffray | f4ff1d4 | 2015-05-14 14:03:51 +0000 | [diff] [blame] | 27 | "make apache-harmony-jdwp-tests-hostdex vogar vogar.jar" |
Nicolas Geoffray | 96cd87a | 2015-03-26 16:48:29 +0000 | [diff] [blame] | 28 | exit 1 |
| 29 | fi |
| 30 | |
| 31 | art="/data/local/tmp/system/bin/art" |
Nicolas Geoffray | 33e1f8f | 2015-04-24 14:37:29 +0100 | [diff] [blame] | 32 | art_debugee="sh /data/local/tmp/system/bin/art" |
Nicolas Geoffray | 96cd87a | 2015-03-26 16:48:29 +0000 | [diff] [blame] | 33 | # We use Quick's image on target because optimizing's image is not compiled debuggable. |
| 34 | image="-Ximage:/data/art-test/core.art" |
| 35 | args=$@ |
Nicolas Geoffray | d553b43 | 2015-07-13 14:35:17 +0100 | [diff] [blame] | 36 | debuggee_args="-Xcompiler-option --debuggable" |
Nicolas Geoffray | 96cd87a | 2015-03-26 16:48:29 +0000 | [diff] [blame] | 37 | device_dir="--device-dir=/data/local/tmp" |
Nicolas Geoffray | d06dc9c | 2015-03-30 15:30:26 +0100 | [diff] [blame] | 38 | # We use the art script on target to ensure the runner and the debuggee share the same |
| 39 | # image. |
| 40 | vm_command="--vm-command=$art" |
Nicolas Geoffray | a2c1861 | 2015-03-30 23:01:28 +0100 | [diff] [blame] | 41 | image_compiler_option="" |
Nicolas Geoffray | 9648a63 | 2015-06-15 14:35:01 +0100 | [diff] [blame] | 42 | debug="no" |
Sebastien Hertz | a646aaf | 2015-09-10 12:03:51 +0200 | [diff] [blame^] | 43 | verbose="no" |
| 44 | # By default, we run the whole JDWP test suite. |
| 45 | test="org.apache.harmony.jpda.tests.share.AllTests" |
Nicolas Geoffray | 96cd87a | 2015-03-26 16:48:29 +0000 | [diff] [blame] | 46 | |
| 47 | while true; do |
| 48 | if [[ "$1" == "--mode=host" ]]; then |
Nicolas Geoffray | 5978690 | 2015-03-30 16:34:16 +0100 | [diff] [blame] | 49 | # Specify bash explicitly since the art script cannot, since it has to run on the device |
| 50 | # with mksh. |
| 51 | art="bash out/host/linux-x86/bin/art" |
Nicolas Geoffray | 33e1f8f | 2015-04-24 14:37:29 +0100 | [diff] [blame] | 52 | art_debugee="bash out/host/linux-x86/bin/art" |
Nicolas Geoffray | 96cd87a | 2015-03-26 16:48:29 +0000 | [diff] [blame] | 53 | # We force generation of a new image to avoid build-time and run-time classpath differences. |
| 54 | image="-Ximage:/system/non/existent" |
Nicolas Geoffray | d06dc9c | 2015-03-30 15:30:26 +0100 | [diff] [blame] | 55 | # We do not need a device directory on host. |
Nicolas Geoffray | 96cd87a | 2015-03-26 16:48:29 +0000 | [diff] [blame] | 56 | device_dir="" |
Nicolas Geoffray | d06dc9c | 2015-03-30 15:30:26 +0100 | [diff] [blame] | 57 | # Vogar knows which VM to use on host. |
| 58 | vm_command="" |
Nicolas Geoffray | a2c1861 | 2015-03-30 23:01:28 +0100 | [diff] [blame] | 59 | # We only compile the image on the host. Note that not providing this option |
Nicolas Geoffray | 9648a63 | 2015-06-15 14:35:01 +0100 | [diff] [blame] | 60 | # for target testing puts us below the adb command limit for vogar. |
Nicolas Geoffray | a2c1861 | 2015-03-30 23:01:28 +0100 | [diff] [blame] | 61 | image_compiler_option="--vm-arg -Ximage-compiler-option --vm-arg --debuggable" |
Nicolas Geoffray | 96cd87a | 2015-03-26 16:48:29 +0000 | [diff] [blame] | 62 | shift |
| 63 | elif [[ $1 == -Ximage:* ]]; then |
| 64 | image="$1" |
| 65 | shift |
Nicolas Geoffray | 9648a63 | 2015-06-15 14:35:01 +0100 | [diff] [blame] | 66 | elif [[ $1 == "--debug" ]]; then |
| 67 | debug="yes" |
| 68 | # Remove the --debug from the arguments. |
| 69 | args=${args/$1} |
| 70 | shift |
Sebastien Hertz | a646aaf | 2015-09-10 12:03:51 +0200 | [diff] [blame^] | 71 | elif [[ $1 == "--verbose" ]]; then |
| 72 | verbose="yes" |
| 73 | # Remove the --verbose from the arguments. |
| 74 | args=${args/$1} |
| 75 | shift |
| 76 | elif [[ $1 == "--test" ]]; then |
| 77 | # Remove the --test from the arguments. |
| 78 | args=${args/$1} |
| 79 | shift |
| 80 | test=$1 |
| 81 | # Remove the test from the arguments. |
| 82 | args=${args/$1} |
| 83 | shift |
Nicolas Geoffray | 96cd87a | 2015-03-26 16:48:29 +0000 | [diff] [blame] | 84 | elif [[ "$1" == "" ]]; then |
| 85 | break |
| 86 | else |
| 87 | shift |
| 88 | fi |
| 89 | done |
| 90 | |
Nicolas Geoffray | 9648a63 | 2015-06-15 14:35:01 +0100 | [diff] [blame] | 91 | vm_args="--vm-arg $image" |
| 92 | if [[ $debug == "yes" ]]; then |
| 93 | art="$art -d" |
| 94 | art_debugee="$art_debugee -d" |
| 95 | vm_args="$vm_args --vm-arg -XXlib:libartd.so" |
| 96 | fi |
Sebastien Hertz | a646aaf | 2015-09-10 12:03:51 +0200 | [diff] [blame^] | 97 | if [[ $verbose == "yes" ]]; then |
| 98 | # Enable JDWP logs in the debuggee. |
| 99 | art_debugee="$art_debugee -verbose:jdwp" |
| 100 | fi |
Nicolas Geoffray | 9648a63 | 2015-06-15 14:35:01 +0100 | [diff] [blame] | 101 | |
Nicolas Geoffray | 96cd87a | 2015-03-26 16:48:29 +0000 | [diff] [blame] | 102 | # Run the tests using vogar. |
Nicolas Geoffray | d06dc9c | 2015-03-30 15:30:26 +0100 | [diff] [blame] | 103 | vogar $vm_command \ |
Nicolas Geoffray | 9648a63 | 2015-06-15 14:35:01 +0100 | [diff] [blame] | 104 | $vm_args \ |
Nicolas Geoffray | 9620b9d | 2015-03-30 12:28:26 +0100 | [diff] [blame] | 105 | --verbose \ |
Nicolas Geoffray | 96cd87a | 2015-03-26 16:48:29 +0000 | [diff] [blame] | 106 | $args \ |
| 107 | $device_dir \ |
Nicolas Geoffray | a2c1861 | 2015-03-30 23:01:28 +0100 | [diff] [blame] | 108 | $image_compiler_option \ |
Nicolas Geoffray | 472b00c | 2015-05-06 14:57:09 +0100 | [diff] [blame] | 109 | --timeout 800 \ |
Nicolas Geoffray | 96cd87a | 2015-03-26 16:48:29 +0000 | [diff] [blame] | 110 | --vm-arg -Djpda.settings.verbose=true \ |
| 111 | --vm-arg -Djpda.settings.syncPort=34016 \ |
Nicolas Geoffray | a2c1861 | 2015-03-30 23:01:28 +0100 | [diff] [blame] | 112 | --vm-arg -Djpda.settings.transportAddress=127.0.0.1:55107 \ |
Nicolas Geoffray | 33e1f8f | 2015-04-24 14:37:29 +0100 | [diff] [blame] | 113 | --vm-arg -Djpda.settings.debuggeeJavaPath="\"$art_debugee $image $debuggee_args\"" \ |
Nicolas Geoffray | 96cd87a | 2015-03-26 16:48:29 +0000 | [diff] [blame] | 114 | --classpath $test_jar \ |
Nicolas Geoffray | 96cd87a | 2015-03-26 16:48:29 +0000 | [diff] [blame] | 115 | --vm-arg -Xcompiler-option --vm-arg --debuggable \ |
Sebastien Hertz | a646aaf | 2015-09-10 12:03:51 +0200 | [diff] [blame^] | 116 | $test |