blob: 0bea6a5fe3080b451bff534a81cd0350a6804959 [file] [log] [blame]
Alex Light646ec0c2017-10-30 16:54:02 -07001#!/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
Alex Lightd0d25fe2018-07-20 15:46:49 -070027declare -a args=("$@")
Alex Light646ec0c2017-10-30 16:54:02 -070028debug="no"
29has_variant="no"
30has_mode="no"
31mode="target"
Alex Lightec4a10c2017-11-17 09:06:26 -080032has_timeout="no"
Alex Lightd0d25fe2018-07-20 15:46:49 -070033has_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
Alex Light646ec0c2017-10-30 16:54:02 -070037
Alex Lightd0d25fe2018-07-20 15:46:49 -070038arg_idx=0
Alex Light646ec0c2017-10-30 16:54:02 -070039while true; do
40 if [[ $1 == "--debug" ]]; then
41 debug="yes"
42 shift
Alex Lightec4a10c2017-11-17 09:06:26 -080043 elif [[ $1 == --test-timeout-ms ]]; then
44 has_timeout="yes"
45 shift
Alex Lightd0d25fe2018-07-20 15:46:49 -070046 arg_idx=$((arg_idx + 1))
Alex Lightec4a10c2017-11-17 09:06:26 -080047 shift
Alex Light646ec0c2017-10-30 16:54:02 -070048 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 Lightd0d25fe2018-07-20 15:46:49 -070056 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 Light646ec0c2017-10-30 16:54:02 -070072 elif [[ $1 == --variant=* ]]; then
73 has_variant="yes"
74 shift
75 elif [[ "$1" == "" ]]; then
76 break
77 else
78 shift
79 fi
Alex Lightd0d25fe2018-07-20 15:46:49 -070080 arg_idx=$((arg_idx + 1))
Alex Light646ec0c2017-10-30 16:54:02 -070081done
82
83if [[ "$has_mode" = "no" ]]; then
84 args+=(--mode=device)
85fi
86
87if [[ "$has_variant" = "no" ]]; then
88 args+=(--variant=X32)
89fi
90
Alex Lightec4a10c2017-11-17 09:06:26 -080091if [[ "$has_timeout" = "no" ]]; then
92 # Double the timeout to 20 seconds
93 args+=(--test-timeout-ms)
Alex Lightd0d25fe2018-07-20 15:46:49 -070094 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)
Alex Lightec4a10c2017-11-17 09:06:26 -0800105fi
106
Alex Light646ec0c2017-10-30 16:54:02 -0700107# 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
Alex Lighte4f220d2017-12-13 10:13:50 -0800115expect_path=$PWD/art/tools/external_oj_libjdwp_art_failures.txt
Alex Light646ec0c2017-10-30 16:54:02 -0700116function verbose_run() {
117 echo "$@"
118 env "$@"
119}
120
121verbose_run ./art/tools/run-jdwp-tests.sh \
122 "${args[@]}" \
123 --jdwp-path "libjdwp.so" \
Alex Lightdf1a7d42019-04-02 14:47:24 -0700124 --vm-arg -Djpda.settings.debuggeeAgentExtraOptions=coredump=y \
Alex Light646ec0c2017-10-30 16:54:02 -0700125 --expectations "$expect_path"