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. |
Sebastien Hertz | 6705dab | 2016-02-17 17:05:52 +0100 | [diff] [blame] | 23 | test_jack=${OUT_DIR-out}/host/common/obj/JAVA_LIBRARIES/apache-harmony-jdwp-tests-hostdex_intermediates/classes.jack |
Nicolas Geoffray | 96cd87a | 2015-03-26 16:48:29 +0000 | [diff] [blame] | 24 | |
Sebastien Hertz | 6705dab | 2016-02-17 17:05:52 +0100 | [diff] [blame] | 25 | if [ ! -f $test_jack ]; then |
Nicolas Geoffray | 96cd87a | 2015-03-26 16:48:29 +0000 | [diff] [blame] | 26 | echo "Before running, you must build jdwp tests and vogar:" \ |
Roland Levillain | 7235dd1 | 2016-05-20 18:16:54 +0100 | [diff] [blame] | 27 | "make apache-harmony-jdwp-tests-hostdex vogar" |
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 | args=$@ |
Nicolas Geoffray | d553b43 | 2015-07-13 14:35:17 +0100 | [diff] [blame] | 34 | debuggee_args="-Xcompiler-option --debuggable" |
Nicolas Geoffray | 96cd87a | 2015-03-26 16:48:29 +0000 | [diff] [blame] | 35 | device_dir="--device-dir=/data/local/tmp" |
Nicolas Geoffray | d06dc9c | 2015-03-30 15:30:26 +0100 | [diff] [blame] | 36 | # We use the art script on target to ensure the runner and the debuggee share the same |
| 37 | # image. |
| 38 | vm_command="--vm-command=$art" |
Nicolas Geoffray | a2c1861 | 2015-03-30 23:01:28 +0100 | [diff] [blame] | 39 | image_compiler_option="" |
Nicolas Geoffray | 9648a63 | 2015-06-15 14:35:01 +0100 | [diff] [blame] | 40 | debug="no" |
Sebastien Hertz | a646aaf | 2015-09-10 12:03:51 +0200 | [diff] [blame] | 41 | verbose="no" |
Mingyao Yang | 145c31a | 2016-03-01 14:51:52 -0800 | [diff] [blame] | 42 | image="-Ximage:/data/art-test/core-optimizing-pic.art" |
Nicolas Geoffray | 9518655 | 2015-10-28 13:06:21 +0000 | [diff] [blame] | 43 | vm_args="" |
Sebastien Hertz | a646aaf | 2015-09-10 12:03:51 +0200 | [diff] [blame] | 44 | # By default, we run the whole JDWP test suite. |
| 45 | test="org.apache.harmony.jpda.tests.share.AllTests" |
Hiroshi Yamauchi | a166bbb | 2015-11-19 16:24:31 -0800 | [diff] [blame] | 46 | host="no" |
Roland Levillain | 5db109b | 2016-05-19 12:24:17 +0100 | [diff] [blame] | 47 | # Use JIT compiling by default. |
| 48 | use_jit=true |
Nicolas Geoffray | 96cd87a | 2015-03-26 16:48:29 +0000 | [diff] [blame] | 49 | |
| 50 | while true; do |
| 51 | if [[ "$1" == "--mode=host" ]]; then |
Hiroshi Yamauchi | a166bbb | 2015-11-19 16:24:31 -0800 | [diff] [blame] | 52 | host="yes" |
Nicolas Geoffray | 5978690 | 2015-03-30 16:34:16 +0100 | [diff] [blame] | 53 | # Specify bash explicitly since the art script cannot, since it has to run on the device |
| 54 | # with mksh. |
Alex Light | b15fea2 | 2015-09-17 16:59:09 -0700 | [diff] [blame] | 55 | art="bash ${OUT_DIR-out}/host/linux-x86/bin/art" |
| 56 | art_debugee="bash ${OUT_DIR-out}/host/linux-x86/bin/art" |
Andreas Gampe | 8994a04 | 2015-12-30 19:03:17 +0000 | [diff] [blame] | 57 | # We force generation of a new image to avoid build-time and run-time classpath differences. |
| 58 | image="-Ximage:/system/non/existent/vogar.art" |
Nicolas Geoffray | d06dc9c | 2015-03-30 15:30:26 +0100 | [diff] [blame] | 59 | # We do not need a device directory on host. |
Nicolas Geoffray | 96cd87a | 2015-03-26 16:48:29 +0000 | [diff] [blame] | 60 | device_dir="" |
Nicolas Geoffray | d06dc9c | 2015-03-30 15:30:26 +0100 | [diff] [blame] | 61 | # Vogar knows which VM to use on host. |
| 62 | vm_command="" |
Nicolas Geoffray | 96cd87a | 2015-03-26 16:48:29 +0000 | [diff] [blame] | 63 | shift |
| 64 | elif [[ $1 == -Ximage:* ]]; then |
| 65 | image="$1" |
| 66 | shift |
Roland Levillain | 5db109b | 2016-05-19 12:24:17 +0100 | [diff] [blame] | 67 | elif [[ "$1" == "--no-jit" ]]; then |
| 68 | use_jit=false |
| 69 | # Remove the --no-jit from the arguments. |
| 70 | args=${args/$1} |
| 71 | shift |
Nicolas Geoffray | 9648a63 | 2015-06-15 14:35:01 +0100 | [diff] [blame] | 72 | elif [[ $1 == "--debug" ]]; then |
| 73 | debug="yes" |
| 74 | # Remove the --debug from the arguments. |
| 75 | args=${args/$1} |
| 76 | shift |
Sebastien Hertz | a646aaf | 2015-09-10 12:03:51 +0200 | [diff] [blame] | 77 | elif [[ $1 == "--verbose" ]]; then |
| 78 | verbose="yes" |
| 79 | # Remove the --verbose from the arguments. |
| 80 | args=${args/$1} |
| 81 | shift |
| 82 | elif [[ $1 == "--test" ]]; then |
| 83 | # Remove the --test from the arguments. |
| 84 | args=${args/$1} |
| 85 | shift |
| 86 | test=$1 |
| 87 | # Remove the test from the arguments. |
| 88 | args=${args/$1} |
| 89 | shift |
Nicolas Geoffray | 96cd87a | 2015-03-26 16:48:29 +0000 | [diff] [blame] | 90 | elif [[ "$1" == "" ]]; then |
| 91 | break |
| 92 | else |
| 93 | shift |
| 94 | fi |
| 95 | done |
| 96 | |
Nicolas Geoffray | 9518655 | 2015-10-28 13:06:21 +0000 | [diff] [blame] | 97 | if [[ "$image" != "" ]]; then |
| 98 | vm_args="--vm-arg $image" |
| 99 | fi |
Roland Levillain | 5db109b | 2016-05-19 12:24:17 +0100 | [diff] [blame] | 100 | if $use_jit; then |
| 101 | vm_args="$vm_args --vm-arg -Xcompiler-option --vm-arg --compiler-filter=interpret-only" |
| 102 | debuggee_args="$debuggee_args -Xcompiler-option --compiler-filter=interpret-only" |
| 103 | fi |
| 104 | vm_args="$vm_args --vm-arg -Xusejit:$use_jit" |
| 105 | debuggee_args="$debuggee_args -Xusejit:$use_jit" |
Nicolas Geoffray | 9648a63 | 2015-06-15 14:35:01 +0100 | [diff] [blame] | 106 | if [[ $debug == "yes" ]]; then |
| 107 | art="$art -d" |
| 108 | art_debugee="$art_debugee -d" |
| 109 | vm_args="$vm_args --vm-arg -XXlib:libartd.so" |
| 110 | fi |
Sebastien Hertz | a646aaf | 2015-09-10 12:03:51 +0200 | [diff] [blame] | 111 | if [[ $verbose == "yes" ]]; then |
| 112 | # Enable JDWP logs in the debuggee. |
| 113 | art_debugee="$art_debugee -verbose:jdwp" |
| 114 | fi |
Nicolas Geoffray | 9648a63 | 2015-06-15 14:35:01 +0100 | [diff] [blame] | 115 | |
Nicolas Geoffray | 96cd87a | 2015-03-26 16:48:29 +0000 | [diff] [blame] | 116 | # Run the tests using vogar. |
Nicolas Geoffray | d06dc9c | 2015-03-30 15:30:26 +0100 | [diff] [blame] | 117 | vogar $vm_command \ |
Nicolas Geoffray | 9648a63 | 2015-06-15 14:35:01 +0100 | [diff] [blame] | 118 | $vm_args \ |
Nicolas Geoffray | 9620b9d | 2015-03-30 12:28:26 +0100 | [diff] [blame] | 119 | --verbose \ |
Nicolas Geoffray | 96cd87a | 2015-03-26 16:48:29 +0000 | [diff] [blame] | 120 | $args \ |
| 121 | $device_dir \ |
Nicolas Geoffray | a2c1861 | 2015-03-30 23:01:28 +0100 | [diff] [blame] | 122 | $image_compiler_option \ |
Nicolas Geoffray | 472b00c | 2015-05-06 14:57:09 +0100 | [diff] [blame] | 123 | --timeout 800 \ |
Nicolas Geoffray | 96cd87a | 2015-03-26 16:48:29 +0000 | [diff] [blame] | 124 | --vm-arg -Djpda.settings.verbose=true \ |
Nicolas Geoffray | a2c1861 | 2015-03-30 23:01:28 +0100 | [diff] [blame] | 125 | --vm-arg -Djpda.settings.transportAddress=127.0.0.1:55107 \ |
Paul Duffin | 1acc729 | 2015-12-01 13:56:52 +0000 | [diff] [blame] | 126 | --vm-arg -Djpda.settings.debuggeeJavaPath="$art_debugee $image $debuggee_args" \ |
Sebastien Hertz | 6705dab | 2016-02-17 17:05:52 +0100 | [diff] [blame] | 127 | --classpath $test_jack \ |
Sebastien Hertz | d8aa503 | 2016-02-22 10:55:24 +0000 | [diff] [blame] | 128 | --toolchain jack --language JN \ |
Nicolas Geoffray | 96cd87a | 2015-03-26 16:48:29 +0000 | [diff] [blame] | 129 | --vm-arg -Xcompiler-option --vm-arg --debuggable \ |
Sebastien Hertz | a646aaf | 2015-09-10 12:03:51 +0200 | [diff] [blame] | 130 | $test |
Hiroshi Yamauchi | a166bbb | 2015-11-19 16:24:31 -0800 | [diff] [blame] | 131 | |
| 132 | vogar_exit_status=$? |
| 133 | |
| 134 | echo "Killing stalled dalvikvm processes..." |
| 135 | if [[ $host == "yes" ]]; then |
| 136 | pkill -9 -f /bin/dalvikvm |
| 137 | else |
| 138 | adb shell pkill -9 -f /bin/dalvikvm |
| 139 | fi |
| 140 | echo "Done." |
| 141 | |
| 142 | exit $vogar_exit_status |