blob: 415a7deee8dae8fefef18365fdf85ba32fbdd7d0 [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 Light7fca6ef2019-10-02 09:24:20 -070027# 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.
30declare -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 Lightd0d25fe2018-07-20 15:46:49 -070038declare -a args=("$@")
Alex Light646ec0c2017-10-30 16:54:02 -070039debug="no"
40has_variant="no"
41has_mode="no"
42mode="target"
Orion Hodson4fa4eb02021-04-14 14:35:58 +010043has_gcstress="no"
Alex Lightec4a10c2017-11-17 09:06:26 -080044has_timeout="no"
Alex Lightd0d25fe2018-07-20 15:46:49 -070045has_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'
48verbose_level=0xC0
Alex Light646ec0c2017-10-30 16:54:02 -070049
Alex Lightd0d25fe2018-07-20 15:46:49 -070050arg_idx=0
Alex Light646ec0c2017-10-30 16:54:02 -070051while true; do
52 if [[ $1 == "--debug" ]]; then
53 debug="yes"
54 shift
Alex Lightec4a10c2017-11-17 09:06:26 -080055 elif [[ $1 == --test-timeout-ms ]]; then
56 has_timeout="yes"
57 shift
Alex Lightd0d25fe2018-07-20 15:46:49 -070058 arg_idx=$((arg_idx + 1))
Alex Lightec4a10c2017-11-17 09:06:26 -080059 shift
Alex Light646ec0c2017-10-30 16:54:02 -070060 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 Lightd0d25fe2018-07-20 15:46:49 -070068 elif [[ $1 == --verbose-all ]]; then
69 has_verbose="yes"
70 verbose_level=0xFFF
71 unset args[arg_idx]
72 shift
Alex Light7fca6ef2019-10-02 09:24:20 -070073 elif [[ $1 == --no-skips ]]; then
74 declare -a known_bad_tests=()
75 unset args[arg_idx]
76 shift
Alex Lightd0d25fe2018-07-20 15:46:49 -070077 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 Light646ec0c2017-10-30 16:54:02 -070088 elif [[ $1 == --variant=* ]]; then
89 has_variant="yes"
90 shift
Orion Hodson4fa4eb02021-04-14 14:35:58 +010091 elif [[ $1 == *gcstress ]]; then
92 has_gcstress="yes"
93 shift
Alex Light646ec0c2017-10-30 16:54:02 -070094 elif [[ "$1" == "" ]]; then
95 break
96 else
97 shift
98 fi
Alex Lightd0d25fe2018-07-20 15:46:49 -070099 arg_idx=$((arg_idx + 1))
Alex Light646ec0c2017-10-30 16:54:02 -0700100done
101
102if [[ "$has_mode" = "no" ]]; then
103 args+=(--mode=device)
104fi
105
106if [[ "$has_variant" = "no" ]]; then
107 args+=(--variant=X32)
108fi
109
Alex Lightec4a10c2017-11-17 09:06:26 -0800110if [[ "$has_timeout" = "no" ]]; then
111 # Double the timeout to 20 seconds
112 args+=(--test-timeout-ms)
Orion Hodson4fa4eb02021-04-14 14:35:58 +0100113 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 Lightd0d25fe2018-07-20 15:46:49 -0700116 args+=(200000)
Orion Hodson4fa4eb02021-04-14 14:35:58 +0100117 else
118 args+=(20000)
Alex Lightd0d25fe2018-07-20 15:46:49 -0700119 fi
120fi
121
122if [[ "$has_verbose" = "yes" ]]; then
123 args+=(--vm-arg)
124 args+=(-Djpda.settings.debuggeeAgentExtraOptions=directlog=y,logfile=/proc/self/fd/2,logflags=$verbose_level)
Alex Lightec4a10c2017-11-17 09:06:26 -0800125fi
126
Alex Light646ec0c2017-10-30 16:54:02 -0700127# 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.
129if [[ "$debug" = "yes" ]]; then
130 args+=(-Xplugin:libopenjdkjvmtid.so)
131else
132 args+=(-Xplugin:libopenjdkjvmti.so)
133fi
134
Alex Lighte4f220d2017-12-13 10:13:50 -0800135expect_path=$PWD/art/tools/external_oj_libjdwp_art_failures.txt
Alex Light646ec0c2017-10-30 16:54:02 -0700136function verbose_run() {
137 echo "$@"
138 env "$@"
139}
140
Alex Light7fca6ef2019-10-02 09:24:20 -0700141for skip in "${known_bad_tests[@]}"; do
142 args+=("--skip-test" "$skip")
143done
144
Alex Lightbd5690d2019-09-30 15:39:15 -0700145# Tell run-jdwp-tests.sh it was called from run-libjdwp-tests.sh
146export RUN_JDWP_TESTS_CALLED_FROM_LIBJDWP=true
147
Alex Light646ec0c2017-10-30 16:54:02 -0700148verbose_run ./art/tools/run-jdwp-tests.sh \
149 "${args[@]}" \
150 --jdwp-path "libjdwp.so" \
Alex Lightdf1a7d42019-04-02 14:47:24 -0700151 --vm-arg -Djpda.settings.debuggeeAgentExtraOptions=coredump=y \
Alex Light43fd2932019-10-01 13:34:51 -0700152 --vm-arg -Djpda.settings.testSuiteType=libjdwp \
Alex Light646ec0c2017-10-30 16:54:02 -0700153 --expectations "$expect_path"