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 17if [[ ! -d libcore ]]; then 18 echo "Script needs to be run at the root of the android tree" 19 exit 1 20fi 21 22if [[ `uname` != 'Linux' ]]; then 23 echo "Script cannot be run on $(uname). It is Linux only." 24 exit 2 25fi 26 27declare -a args=("$@") 28debug="no" 29has_variant="no" 30has_mode="no" 31mode="target" 32has_timeout="no" 33has_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' 36verbose_level=0xC0 37 38arg_idx=0 39while true; do 40 if [[ $1 == "--debug" ]]; then 41 debug="yes" 42 shift 43 elif [[ $1 == --test-timeout-ms ]]; then 44 has_timeout="yes" 45 shift 46 arg_idx=$((arg_idx + 1)) 47 shift 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 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 72 elif [[ $1 == --variant=* ]]; then 73 has_variant="yes" 74 shift 75 elif [[ "$1" == "" ]]; then 76 break 77 else 78 shift 79 fi 80 arg_idx=$((arg_idx + 1)) 81done 82 83if [[ "$has_mode" = "no" ]]; then 84 args+=(--mode=device) 85fi 86 87if [[ "$has_variant" = "no" ]]; then 88 args+=(--variant=X32) 89fi 90 91if [[ "$has_timeout" = "no" ]]; then 92 # Double the timeout to 20 seconds 93 args+=(--test-timeout-ms) 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 100fi 101 102if [[ "$has_verbose" = "yes" ]]; then 103 args+=(--vm-arg) 104 args+=(-Djpda.settings.debuggeeAgentExtraOptions=directlog=y,logfile=/proc/self/fd/2,logflags=$verbose_level) 105fi 106 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. 109if [[ "$debug" = "yes" ]]; then 110 args+=(-Xplugin:libopenjdkjvmtid.so) 111else 112 args+=(-Xplugin:libopenjdkjvmti.so) 113fi 114 115expect_path=$PWD/art/tools/external_oj_libjdwp_art_failures.txt 116function verbose_run() { 117 echo "$@" 118 env "$@" 119} 120 121verbose_run ./art/tools/run-jdwp-tests.sh \ 122 "${args[@]}" \ 123 --jdwp-path "libjdwp.so" \ 124 --vm-arg -Djpda.settings.debuggeeAgentExtraOptions=coredump=y \ 125 --expectations "$expect_path" 126