Alex Light | 646ec0c | 2017-10-30 16:54:02 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # |
| 3 | # Copyright (C) 2017 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 | if [[ `uname` != 'Linux' ]]; then |
| 23 | echo "Script cannot be run on $(uname). It is Linux only." |
| 24 | exit 2 |
| 25 | fi |
| 26 | |
Alex Light | d0d25fe | 2018-07-20 15:46:49 -0700 | [diff] [blame] | 27 | declare -a args=("$@") |
Alex Light | 646ec0c | 2017-10-30 16:54:02 -0700 | [diff] [blame] | 28 | debug="no" |
| 29 | has_variant="no" |
| 30 | has_mode="no" |
| 31 | mode="target" |
Alex Light | ec4a10c | 2017-11-17 09:06:26 -0800 | [diff] [blame] | 32 | has_timeout="no" |
Alex Light | d0d25fe | 2018-07-20 15:46:49 -0700 | [diff] [blame] | 33 | has_verbose="no" |
| 34 | # The bitmap of log messages in libjdwp. See list in the help message for more |
| 35 | # info on what these are. The default is 'errors | callbacks' |
| 36 | verbose_level=0xC0 |
Alex Light | 646ec0c | 2017-10-30 16:54:02 -0700 | [diff] [blame] | 37 | |
Alex Light | d0d25fe | 2018-07-20 15:46:49 -0700 | [diff] [blame] | 38 | arg_idx=0 |
Alex Light | 646ec0c | 2017-10-30 16:54:02 -0700 | [diff] [blame] | 39 | while true; do |
| 40 | if [[ $1 == "--debug" ]]; then |
| 41 | debug="yes" |
| 42 | shift |
Alex Light | ec4a10c | 2017-11-17 09:06:26 -0800 | [diff] [blame] | 43 | elif [[ $1 == --test-timeout-ms ]]; then |
| 44 | has_timeout="yes" |
| 45 | shift |
Alex Light | d0d25fe | 2018-07-20 15:46:49 -0700 | [diff] [blame] | 46 | arg_idx=$((arg_idx + 1)) |
Alex Light | ec4a10c | 2017-11-17 09:06:26 -0800 | [diff] [blame] | 47 | shift |
Alex Light | 646ec0c | 2017-10-30 16:54:02 -0700 | [diff] [blame] | 48 | elif [[ "$1" == "--mode=jvm" ]]; then |
| 49 | has_mode="yes" |
| 50 | mode="ri" |
| 51 | shift |
| 52 | elif [[ "$1" == --mode=host ]]; then |
| 53 | has_mode="yes" |
| 54 | mode="host" |
| 55 | shift |
Alex Light | d0d25fe | 2018-07-20 15:46:49 -0700 | [diff] [blame] | 56 | elif [[ $1 == --verbose-all ]]; then |
| 57 | has_verbose="yes" |
| 58 | verbose_level=0xFFF |
| 59 | unset args[arg_idx] |
| 60 | shift |
| 61 | elif [[ $1 == --verbose ]]; then |
| 62 | has_verbose="yes" |
| 63 | shift |
| 64 | elif [[ $1 == --verbose-level ]]; then |
| 65 | shift |
| 66 | verbose_level=$1 |
| 67 | # remove both the --verbose-level and the argument. |
| 68 | unset args[arg_idx] |
| 69 | arg_idx=$((arg_idx + 1)) |
| 70 | unset args[arg_idx] |
| 71 | shift |
Alex Light | 646ec0c | 2017-10-30 16:54:02 -0700 | [diff] [blame] | 72 | elif [[ $1 == --variant=* ]]; then |
| 73 | has_variant="yes" |
| 74 | shift |
| 75 | elif [[ "$1" == "" ]]; then |
| 76 | break |
| 77 | else |
| 78 | shift |
| 79 | fi |
Alex Light | d0d25fe | 2018-07-20 15:46:49 -0700 | [diff] [blame] | 80 | arg_idx=$((arg_idx + 1)) |
Alex Light | 646ec0c | 2017-10-30 16:54:02 -0700 | [diff] [blame] | 81 | done |
| 82 | |
| 83 | if [[ "$has_mode" = "no" ]]; then |
| 84 | args+=(--mode=device) |
| 85 | fi |
| 86 | |
| 87 | if [[ "$has_variant" = "no" ]]; then |
| 88 | args+=(--variant=X32) |
| 89 | fi |
| 90 | |
Alex Light | ec4a10c | 2017-11-17 09:06:26 -0800 | [diff] [blame] | 91 | if [[ "$has_timeout" = "no" ]]; then |
| 92 | # Double the timeout to 20 seconds |
| 93 | args+=(--test-timeout-ms) |
Alex Light | d0d25fe | 2018-07-20 15:46:49 -0700 | [diff] [blame] | 94 | if [[ "$has_verbose" = "no" ]]; then |
| 95 | args+=(20000) |
| 96 | else |
| 97 | # Even more time if verbose is set since those can be quite heavy. |
| 98 | args+=(200000) |
| 99 | fi |
| 100 | fi |
| 101 | |
| 102 | if [[ "$has_verbose" = "yes" ]]; then |
| 103 | args+=(--vm-arg) |
| 104 | args+=(-Djpda.settings.debuggeeAgentExtraOptions=directlog=y,logfile=/proc/self/fd/2,logflags=$verbose_level) |
Alex Light | ec4a10c | 2017-11-17 09:06:26 -0800 | [diff] [blame] | 105 | fi |
| 106 | |
Alex Light | 646ec0c | 2017-10-30 16:54:02 -0700 | [diff] [blame] | 107 | # We don't use full paths since it is difficult to determine them for device |
| 108 | # tests and not needed due to resolution rules of dlopen. |
| 109 | if [[ "$debug" = "yes" ]]; then |
| 110 | args+=(-Xplugin:libopenjdkjvmtid.so) |
| 111 | else |
| 112 | args+=(-Xplugin:libopenjdkjvmti.so) |
| 113 | fi |
| 114 | |
Alex Light | e4f220d | 2017-12-13 10:13:50 -0800 | [diff] [blame] | 115 | expect_path=$PWD/art/tools/external_oj_libjdwp_art_failures.txt |
Alex Light | 646ec0c | 2017-10-30 16:54:02 -0700 | [diff] [blame] | 116 | function verbose_run() { |
| 117 | echo "$@" |
| 118 | env "$@" |
| 119 | } |
| 120 | |
Alex Light | bd5690d | 2019-09-30 15:39:15 -0700 | [diff] [blame^] | 121 | # Tell run-jdwp-tests.sh it was called from run-libjdwp-tests.sh |
| 122 | export RUN_JDWP_TESTS_CALLED_FROM_LIBJDWP=true |
| 123 | |
Alex Light | 646ec0c | 2017-10-30 16:54:02 -0700 | [diff] [blame] | 124 | verbose_run ./art/tools/run-jdwp-tests.sh \ |
| 125 | "${args[@]}" \ |
| 126 | --jdwp-path "libjdwp.so" \ |
Alex Light | df1a7d4 | 2019-04-02 14:47:24 -0700 | [diff] [blame] | 127 | --vm-arg -Djpda.settings.debuggeeAgentExtraOptions=coredump=y \ |
Alex Light | 646ec0c | 2017-10-30 16:54:02 -0700 | [diff] [blame] | 128 | --expectations "$expect_path" |