blob: b816aabd293d1f937c4865cabc24c467cd00256a [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"
Alex Lightec4a10c2017-11-17 09:06:26 -080043has_timeout="no"
Alex Lightd0d25fe2018-07-20 15:46:49 -070044has_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'
47verbose_level=0xC0
Alex Light646ec0c2017-10-30 16:54:02 -070048
Alex Lightd0d25fe2018-07-20 15:46:49 -070049arg_idx=0
Alex Light646ec0c2017-10-30 16:54:02 -070050while true; do
51 if [[ $1 == "--debug" ]]; then
52 debug="yes"
53 shift
Alex Lightec4a10c2017-11-17 09:06:26 -080054 elif [[ $1 == --test-timeout-ms ]]; then
55 has_timeout="yes"
56 shift
Alex Lightd0d25fe2018-07-20 15:46:49 -070057 arg_idx=$((arg_idx + 1))
Alex Lightec4a10c2017-11-17 09:06:26 -080058 shift
Alex Light646ec0c2017-10-30 16:54:02 -070059 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 Lightd0d25fe2018-07-20 15:46:49 -070067 elif [[ $1 == --verbose-all ]]; then
68 has_verbose="yes"
69 verbose_level=0xFFF
70 unset args[arg_idx]
71 shift
Alex Light7fca6ef2019-10-02 09:24:20 -070072 elif [[ $1 == --no-skips ]]; then
73 declare -a known_bad_tests=()
74 unset args[arg_idx]
75 shift
Alex Lightd0d25fe2018-07-20 15:46:49 -070076 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 Light646ec0c2017-10-30 16:54:02 -070087 elif [[ $1 == --variant=* ]]; then
88 has_variant="yes"
89 shift
90 elif [[ "$1" == "" ]]; then
91 break
92 else
93 shift
94 fi
Alex Lightd0d25fe2018-07-20 15:46:49 -070095 arg_idx=$((arg_idx + 1))
Alex Light646ec0c2017-10-30 16:54:02 -070096done
97
98if [[ "$has_mode" = "no" ]]; then
99 args+=(--mode=device)
100fi
101
102if [[ "$has_variant" = "no" ]]; then
103 args+=(--variant=X32)
104fi
105
Alex Lightec4a10c2017-11-17 09:06:26 -0800106if [[ "$has_timeout" = "no" ]]; then
107 # Double the timeout to 20 seconds
108 args+=(--test-timeout-ms)
Alex Lightd0d25fe2018-07-20 15:46:49 -0700109 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
115fi
116
117if [[ "$has_verbose" = "yes" ]]; then
118 args+=(--vm-arg)
119 args+=(-Djpda.settings.debuggeeAgentExtraOptions=directlog=y,logfile=/proc/self/fd/2,logflags=$verbose_level)
Alex Lightec4a10c2017-11-17 09:06:26 -0800120fi
121
Alex Light646ec0c2017-10-30 16:54:02 -0700122# 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.
124if [[ "$debug" = "yes" ]]; then
125 args+=(-Xplugin:libopenjdkjvmtid.so)
126else
127 args+=(-Xplugin:libopenjdkjvmti.so)
128fi
129
Alex Lighte4f220d2017-12-13 10:13:50 -0800130expect_path=$PWD/art/tools/external_oj_libjdwp_art_failures.txt
Alex Light646ec0c2017-10-30 16:54:02 -0700131function verbose_run() {
132 echo "$@"
133 env "$@"
134}
135
Alex Light7fca6ef2019-10-02 09:24:20 -0700136for skip in "${known_bad_tests[@]}"; do
137 args+=("--skip-test" "$skip")
138done
139
Alex Lightbd5690d2019-09-30 15:39:15 -0700140# Tell run-jdwp-tests.sh it was called from run-libjdwp-tests.sh
141export RUN_JDWP_TESTS_CALLED_FROM_LIBJDWP=true
142
Alex Light646ec0c2017-10-30 16:54:02 -0700143verbose_run ./art/tools/run-jdwp-tests.sh \
144 "${args[@]}" \
145 --jdwp-path "libjdwp.so" \
Alex Lightdf1a7d42019-04-02 14:47:24 -0700146 --vm-arg -Djpda.settings.debuggeeAgentExtraOptions=coredump=y \
Alex Light43fd2932019-10-01 13:34:51 -0700147 --vm-arg -Djpda.settings.testSuiteType=libjdwp \
Alex Light646ec0c2017-10-30 16:54:02 -0700148 --expectations "$expect_path"