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. |
Alex Light | b15fea2 | 2015-09-17 16:59:09 -0700 | [diff] [blame] | 23 | test_jar=${OUT_DIR-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 | |
Roland Levillain | f2a5c9c | 2015-11-23 19:24:25 +0000 | [diff] [blame] | 31 | if [ "x$ART_USE_READ_BARRIER" = xtrue ]; then |
| 32 | # For the moment, skip JDWP tests when read barriers are enabled, as |
| 33 | # they sometimes exhibit a deadlock issue with the concurrent |
| 34 | # copying collector in the read barrier configuration, between the |
| 35 | # HeapTaskDeamon and the JDWP thread (b/25800335). |
| 36 | # |
| 37 | # TODO: Re-enable the JDWP tests when this deadlock issue is fixed. |
| 38 | echo "JDWP tests are temporarily disabled in the read barrier configuration because of" |
| 39 | echo "a deadlock issue (b/25800335)." |
| 40 | exit 0 |
| 41 | fi |
| 42 | |
Nicolas Geoffray | 96cd87a | 2015-03-26 16:48:29 +0000 | [diff] [blame] | 43 | art="/data/local/tmp/system/bin/art" |
Nicolas Geoffray | 33e1f8f | 2015-04-24 14:37:29 +0100 | [diff] [blame] | 44 | art_debugee="sh /data/local/tmp/system/bin/art" |
Nicolas Geoffray | 96cd87a | 2015-03-26 16:48:29 +0000 | [diff] [blame] | 45 | args=$@ |
Nicolas Geoffray | d553b43 | 2015-07-13 14:35:17 +0100 | [diff] [blame] | 46 | debuggee_args="-Xcompiler-option --debuggable" |
Nicolas Geoffray | 96cd87a | 2015-03-26 16:48:29 +0000 | [diff] [blame] | 47 | device_dir="--device-dir=/data/local/tmp" |
Nicolas Geoffray | d06dc9c | 2015-03-30 15:30:26 +0100 | [diff] [blame] | 48 | # We use the art script on target to ensure the runner and the debuggee share the same |
| 49 | # image. |
| 50 | vm_command="--vm-command=$art" |
Nicolas Geoffray | a2c1861 | 2015-03-30 23:01:28 +0100 | [diff] [blame] | 51 | image_compiler_option="" |
Nicolas Geoffray | 9648a63 | 2015-06-15 14:35:01 +0100 | [diff] [blame] | 52 | debug="no" |
Sebastien Hertz | a646aaf | 2015-09-10 12:03:51 +0200 | [diff] [blame] | 53 | verbose="no" |
Nicolas Geoffray | 8d10e45 | 2015-10-28 17:01:04 +0000 | [diff] [blame] | 54 | image="-Ximage:/data/art-test/core-jit.art" |
Nicolas Geoffray | 9518655 | 2015-10-28 13:06:21 +0000 | [diff] [blame] | 55 | vm_args="" |
Sebastien Hertz | a646aaf | 2015-09-10 12:03:51 +0200 | [diff] [blame] | 56 | # By default, we run the whole JDWP test suite. |
| 57 | test="org.apache.harmony.jpda.tests.share.AllTests" |
Hiroshi Yamauchi | a166bbb | 2015-11-19 16:24:31 -0800 | [diff] [blame] | 58 | host="no" |
Nicolas Geoffray | 96cd87a | 2015-03-26 16:48:29 +0000 | [diff] [blame] | 59 | |
| 60 | while true; do |
| 61 | if [[ "$1" == "--mode=host" ]]; then |
Hiroshi Yamauchi | a166bbb | 2015-11-19 16:24:31 -0800 | [diff] [blame] | 62 | host="yes" |
Nicolas Geoffray | 5978690 | 2015-03-30 16:34:16 +0100 | [diff] [blame] | 63 | # Specify bash explicitly since the art script cannot, since it has to run on the device |
| 64 | # with mksh. |
Alex Light | b15fea2 | 2015-09-17 16:59:09 -0700 | [diff] [blame] | 65 | art="bash ${OUT_DIR-out}/host/linux-x86/bin/art" |
| 66 | art_debugee="bash ${OUT_DIR-out}/host/linux-x86/bin/art" |
Nicolas Geoffray | 96cd87a | 2015-03-26 16:48:29 +0000 | [diff] [blame] | 67 | # We force generation of a new image to avoid build-time and run-time classpath differences. |
| 68 | image="-Ximage:/system/non/existent" |
Nicolas Geoffray | d06dc9c | 2015-03-30 15:30:26 +0100 | [diff] [blame] | 69 | # We do not need a device directory on host. |
Nicolas Geoffray | 96cd87a | 2015-03-26 16:48:29 +0000 | [diff] [blame] | 70 | device_dir="" |
Nicolas Geoffray | d06dc9c | 2015-03-30 15:30:26 +0100 | [diff] [blame] | 71 | # Vogar knows which VM to use on host. |
| 72 | vm_command="" |
Nicolas Geoffray | a2c1861 | 2015-03-30 23:01:28 +0100 | [diff] [blame] | 73 | # 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] | 74 | # for target testing puts us below the adb command limit for vogar. |
Nicolas Geoffray | a2c1861 | 2015-03-30 23:01:28 +0100 | [diff] [blame] | 75 | image_compiler_option="--vm-arg -Ximage-compiler-option --vm-arg --debuggable" |
Nicolas Geoffray | 96cd87a | 2015-03-26 16:48:29 +0000 | [diff] [blame] | 76 | shift |
| 77 | elif [[ $1 == -Ximage:* ]]; then |
| 78 | image="$1" |
| 79 | shift |
Nicolas Geoffray | 9648a63 | 2015-06-15 14:35:01 +0100 | [diff] [blame] | 80 | elif [[ $1 == "--debug" ]]; then |
| 81 | debug="yes" |
| 82 | # Remove the --debug from the arguments. |
| 83 | args=${args/$1} |
| 84 | shift |
Sebastien Hertz | a646aaf | 2015-09-10 12:03:51 +0200 | [diff] [blame] | 85 | elif [[ $1 == "--verbose" ]]; then |
| 86 | verbose="yes" |
| 87 | # Remove the --verbose from the arguments. |
| 88 | args=${args/$1} |
| 89 | shift |
| 90 | elif [[ $1 == "--test" ]]; then |
| 91 | # Remove the --test from the arguments. |
| 92 | args=${args/$1} |
| 93 | shift |
| 94 | test=$1 |
| 95 | # Remove the test from the arguments. |
| 96 | args=${args/$1} |
| 97 | shift |
Nicolas Geoffray | 96cd87a | 2015-03-26 16:48:29 +0000 | [diff] [blame] | 98 | elif [[ "$1" == "" ]]; then |
| 99 | break |
| 100 | else |
| 101 | shift |
| 102 | fi |
| 103 | done |
| 104 | |
Nicolas Geoffray | 9518655 | 2015-10-28 13:06:21 +0000 | [diff] [blame] | 105 | if [[ "$image" != "" ]]; then |
| 106 | vm_args="--vm-arg $image" |
| 107 | fi |
| 108 | vm_args="$vm_args --vm-arg -Xusejit:true" |
Nicolas Geoffray | e2725c5 | 2015-10-26 18:40:41 +0000 | [diff] [blame] | 109 | debuggee_args="$debuggee_args -Xusejit:true" |
Nicolas Geoffray | 9648a63 | 2015-06-15 14:35:01 +0100 | [diff] [blame] | 110 | if [[ $debug == "yes" ]]; then |
| 111 | art="$art -d" |
| 112 | art_debugee="$art_debugee -d" |
| 113 | vm_args="$vm_args --vm-arg -XXlib:libartd.so" |
| 114 | fi |
Sebastien Hertz | a646aaf | 2015-09-10 12:03:51 +0200 | [diff] [blame] | 115 | if [[ $verbose == "yes" ]]; then |
| 116 | # Enable JDWP logs in the debuggee. |
| 117 | art_debugee="$art_debugee -verbose:jdwp" |
| 118 | fi |
Nicolas Geoffray | 9648a63 | 2015-06-15 14:35:01 +0100 | [diff] [blame] | 119 | |
Nicolas Geoffray | 96cd87a | 2015-03-26 16:48:29 +0000 | [diff] [blame] | 120 | # Run the tests using vogar. |
Nicolas Geoffray | d06dc9c | 2015-03-30 15:30:26 +0100 | [diff] [blame] | 121 | vogar $vm_command \ |
Nicolas Geoffray | 9648a63 | 2015-06-15 14:35:01 +0100 | [diff] [blame] | 122 | $vm_args \ |
Nicolas Geoffray | 9620b9d | 2015-03-30 12:28:26 +0100 | [diff] [blame] | 123 | --verbose \ |
Nicolas Geoffray | 96cd87a | 2015-03-26 16:48:29 +0000 | [diff] [blame] | 124 | $args \ |
| 125 | $device_dir \ |
Nicolas Geoffray | a2c1861 | 2015-03-30 23:01:28 +0100 | [diff] [blame] | 126 | $image_compiler_option \ |
Nicolas Geoffray | 472b00c | 2015-05-06 14:57:09 +0100 | [diff] [blame] | 127 | --timeout 800 \ |
Nicolas Geoffray | 96cd87a | 2015-03-26 16:48:29 +0000 | [diff] [blame] | 128 | --vm-arg -Djpda.settings.verbose=true \ |
| 129 | --vm-arg -Djpda.settings.syncPort=34016 \ |
Nicolas Geoffray | a2c1861 | 2015-03-30 23:01:28 +0100 | [diff] [blame] | 130 | --vm-arg -Djpda.settings.transportAddress=127.0.0.1:55107 \ |
Paul Duffin | 1acc729 | 2015-12-01 13:56:52 +0000 | [diff] [blame] | 131 | --vm-arg -Djpda.settings.debuggeeJavaPath="$art_debugee $image $debuggee_args" \ |
Nicolas Geoffray | 96cd87a | 2015-03-26 16:48:29 +0000 | [diff] [blame] | 132 | --classpath $test_jar \ |
Nicolas Geoffray | 96cd87a | 2015-03-26 16:48:29 +0000 | [diff] [blame] | 133 | --vm-arg -Xcompiler-option --vm-arg --debuggable \ |
Sebastien Hertz | a646aaf | 2015-09-10 12:03:51 +0200 | [diff] [blame] | 134 | $test |
Hiroshi Yamauchi | a166bbb | 2015-11-19 16:24:31 -0800 | [diff] [blame] | 135 | |
| 136 | vogar_exit_status=$? |
| 137 | |
| 138 | echo "Killing stalled dalvikvm processes..." |
| 139 | if [[ $host == "yes" ]]; then |
| 140 | pkill -9 -f /bin/dalvikvm |
| 141 | else |
| 142 | adb shell pkill -9 -f /bin/dalvikvm |
| 143 | fi |
| 144 | echo "Done." |
| 145 | |
| 146 | exit $vogar_exit_status |