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