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 | 7fca6ef | 2019-10-02 09:24:20 -0700 | [diff] [blame] | 27 | # See b/141907697. These tests all crash on both the RI and ART when using the libjdwp agent JDWP |
| 28 | # implementation. To avoid them cluttering the log on the buildbot we explicitly skip them. This |
| 29 | # list should not be added to. |
| 30 | declare -a known_bad_tests=( |
| 31 | 'org.apache.harmony.jpda.tests.jdwp.ClassType_NewInstanceTest#testNewInstance002' |
| 32 | 'org.apache.harmony.jpda.tests.jdwp.ObjectReference_GetValues002Test#testGetValues002' |
| 33 | 'org.apache.harmony.jpda.tests.jdwp.ObjectReference_SetValuesTest#testSetValues001' |
| 34 | 'org.apache.harmony.jpda.tests.jdwp.ThreadGroupReference_NameTest#testName001_NullObject' |
| 35 | 'org.apache.harmony.jpda.tests.jdwp.ThreadGroupReference_ParentTest#testParent_NullObject' |
| 36 | ) |
| 37 | |
Alex Light | d0d25fe | 2018-07-20 15:46:49 -0700 | [diff] [blame] | 38 | declare -a args=("$@") |
Alex Light | 646ec0c | 2017-10-30 16:54:02 -0700 | [diff] [blame] | 39 | debug="no" |
| 40 | has_variant="no" |
| 41 | has_mode="no" |
| 42 | mode="target" |
Alex Light | ec4a10c | 2017-11-17 09:06:26 -0800 | [diff] [blame] | 43 | has_timeout="no" |
Alex Light | d0d25fe | 2018-07-20 15:46:49 -0700 | [diff] [blame] | 44 | has_verbose="no" |
| 45 | # The bitmap of log messages in libjdwp. See list in the help message for more |
| 46 | # info on what these are. The default is 'errors | callbacks' |
| 47 | verbose_level=0xC0 |
Alex Light | 646ec0c | 2017-10-30 16:54:02 -0700 | [diff] [blame] | 48 | |
Alex Light | d0d25fe | 2018-07-20 15:46:49 -0700 | [diff] [blame] | 49 | arg_idx=0 |
Alex Light | 646ec0c | 2017-10-30 16:54:02 -0700 | [diff] [blame] | 50 | while true; do |
| 51 | if [[ $1 == "--debug" ]]; then |
| 52 | debug="yes" |
| 53 | shift |
Alex Light | ec4a10c | 2017-11-17 09:06:26 -0800 | [diff] [blame] | 54 | elif [[ $1 == --test-timeout-ms ]]; then |
| 55 | has_timeout="yes" |
| 56 | shift |
Alex Light | d0d25fe | 2018-07-20 15:46:49 -0700 | [diff] [blame] | 57 | arg_idx=$((arg_idx + 1)) |
Alex Light | ec4a10c | 2017-11-17 09:06:26 -0800 | [diff] [blame] | 58 | shift |
Alex Light | 646ec0c | 2017-10-30 16:54:02 -0700 | [diff] [blame] | 59 | elif [[ "$1" == "--mode=jvm" ]]; then |
| 60 | has_mode="yes" |
| 61 | mode="ri" |
| 62 | shift |
| 63 | elif [[ "$1" == --mode=host ]]; then |
| 64 | has_mode="yes" |
| 65 | mode="host" |
| 66 | shift |
Alex Light | d0d25fe | 2018-07-20 15:46:49 -0700 | [diff] [blame] | 67 | elif [[ $1 == --verbose-all ]]; then |
| 68 | has_verbose="yes" |
| 69 | verbose_level=0xFFF |
| 70 | unset args[arg_idx] |
| 71 | shift |
Alex Light | 7fca6ef | 2019-10-02 09:24:20 -0700 | [diff] [blame] | 72 | elif [[ $1 == --no-skips ]]; then |
| 73 | declare -a known_bad_tests=() |
| 74 | unset args[arg_idx] |
| 75 | shift |
Alex Light | d0d25fe | 2018-07-20 15:46:49 -0700 | [diff] [blame] | 76 | elif [[ $1 == --verbose ]]; then |
| 77 | has_verbose="yes" |
| 78 | shift |
| 79 | elif [[ $1 == --verbose-level ]]; then |
| 80 | shift |
| 81 | verbose_level=$1 |
| 82 | # remove both the --verbose-level and the argument. |
| 83 | unset args[arg_idx] |
| 84 | arg_idx=$((arg_idx + 1)) |
| 85 | unset args[arg_idx] |
| 86 | shift |
Alex Light | 646ec0c | 2017-10-30 16:54:02 -0700 | [diff] [blame] | 87 | elif [[ $1 == --variant=* ]]; then |
| 88 | has_variant="yes" |
| 89 | shift |
| 90 | elif [[ "$1" == "" ]]; then |
| 91 | break |
| 92 | else |
| 93 | shift |
| 94 | fi |
Alex Light | d0d25fe | 2018-07-20 15:46:49 -0700 | [diff] [blame] | 95 | arg_idx=$((arg_idx + 1)) |
Alex Light | 646ec0c | 2017-10-30 16:54:02 -0700 | [diff] [blame] | 96 | done |
| 97 | |
| 98 | if [[ "$has_mode" = "no" ]]; then |
| 99 | args+=(--mode=device) |
| 100 | fi |
| 101 | |
| 102 | if [[ "$has_variant" = "no" ]]; then |
| 103 | args+=(--variant=X32) |
| 104 | fi |
| 105 | |
Alex Light | ec4a10c | 2017-11-17 09:06:26 -0800 | [diff] [blame] | 106 | if [[ "$has_timeout" = "no" ]]; then |
| 107 | # Double the timeout to 20 seconds |
| 108 | args+=(--test-timeout-ms) |
Alex Light | d0d25fe | 2018-07-20 15:46:49 -0700 | [diff] [blame] | 109 | if [[ "$has_verbose" = "no" ]]; then |
| 110 | args+=(20000) |
| 111 | else |
| 112 | # Even more time if verbose is set since those can be quite heavy. |
| 113 | args+=(200000) |
| 114 | fi |
| 115 | fi |
| 116 | |
| 117 | if [[ "$has_verbose" = "yes" ]]; then |
| 118 | args+=(--vm-arg) |
| 119 | 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] | 120 | fi |
| 121 | |
Alex Light | 646ec0c | 2017-10-30 16:54:02 -0700 | [diff] [blame] | 122 | # We don't use full paths since it is difficult to determine them for device |
| 123 | # tests and not needed due to resolution rules of dlopen. |
| 124 | if [[ "$debug" = "yes" ]]; then |
| 125 | args+=(-Xplugin:libopenjdkjvmtid.so) |
| 126 | else |
| 127 | args+=(-Xplugin:libopenjdkjvmti.so) |
| 128 | fi |
| 129 | |
Alex Light | e4f220d | 2017-12-13 10:13:50 -0800 | [diff] [blame] | 130 | expect_path=$PWD/art/tools/external_oj_libjdwp_art_failures.txt |
Alex Light | 646ec0c | 2017-10-30 16:54:02 -0700 | [diff] [blame] | 131 | function verbose_run() { |
| 132 | echo "$@" |
| 133 | env "$@" |
| 134 | } |
| 135 | |
Alex Light | 7fca6ef | 2019-10-02 09:24:20 -0700 | [diff] [blame] | 136 | for skip in "${known_bad_tests[@]}"; do |
| 137 | args+=("--skip-test" "$skip") |
| 138 | done |
| 139 | |
Alex Light | bd5690d | 2019-09-30 15:39:15 -0700 | [diff] [blame] | 140 | # Tell run-jdwp-tests.sh it was called from run-libjdwp-tests.sh |
| 141 | export RUN_JDWP_TESTS_CALLED_FROM_LIBJDWP=true |
| 142 | |
Alex Light | 646ec0c | 2017-10-30 16:54:02 -0700 | [diff] [blame] | 143 | verbose_run ./art/tools/run-jdwp-tests.sh \ |
| 144 | "${args[@]}" \ |
| 145 | --jdwp-path "libjdwp.so" \ |
Alex Light | df1a7d4 | 2019-04-02 14:47:24 -0700 | [diff] [blame] | 146 | --vm-arg -Djpda.settings.debuggeeAgentExtraOptions=coredump=y \ |
Alex Light | 43fd293 | 2019-10-01 13:34:51 -0700 | [diff] [blame] | 147 | --vm-arg -Djpda.settings.testSuiteType=libjdwp \ |
Alex Light | 646ec0c | 2017-10-30 16:54:02 -0700 | [diff] [blame] | 148 | --expectations "$expect_path" |