blob: e7f028ae638ac2720fe4a868e0c9547603533806 [file] [log] [blame]
Alex Lightdc700a72017-09-29 13:56:46 -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
22source build/envsetup.sh >&/dev/null # for get_build_var, setpaths
23setpaths # include platform prebuilt java, javac, etc in $PATH.
24
25if [[ `uname` != 'Linux' ]]; then
26 echo "Script cannot be run on $(uname). It is Linux only."
27 exit 2
28fi
29
30jdwp_path=${ANDROID_JAVA_HOME}/jre/lib/amd64/libjdwp.so
31if [[ ! -f $jdwp_path ]]; then
32 echo "Unable to find prebuilts libjdwp.so! Did the version change from jdk8?"
33 exit 3
34fi
35
36args=("$@")
37debug="no"
38has_variant="no"
39has_mode="no"
40
41while true; do
42 if [[ $1 == "--debug" ]]; then
43 debug="yes"
44 shift
45 elif [[ "$1" == --mode=* ]]; then
46 has_mode="yes"
47 if [[ $1 != "--mode=host" ]]; then
48 # Just print out an actually helpful error message.
49 echo "Only host tests can be run against prebuilt libjdwp"
50 exit 4
51 fi
52 shift
53 elif [[ $1 == --variant=* ]]; then
54 has_variant="yes"
55 if [[ $1 != "--variant=x64" ]] && [[ $1 != "--variant=X64" ]]; then
56 # Just print out an actually helpful error message.
57 echo "Only 64bit runs can be tested against the prebuilt libjdwp!"
58 exit 5
59 fi
60 shift
61 elif [[ "$1" == "" ]]; then
62 break
63 else
64 shift
65 fi
66done
67
68if [[ "$has_mode" = "no" ]]; then
69 args+=(--mode=host)
70fi
71
72if [[ "$has_variant" = "no" ]]; then
73 args+=(--variant=X64)
74fi
75
76wrapper_name=""
77plugin=""
78if [[ "$debug" = "yes" ]]; then
79 wrapper_name=libwrapagentpropertiesd
80 plugin="$ANDROID_HOST_OUT/lib64/libopenjdkjvmtid.so"
81else
82 wrapper_name=libwrapagentproperties
83 plugin="$ANDROID_HOST_OUT/lib64/libopenjdkjvmti.so"
84fi
85wrapper=$ANDROID_HOST_OUT/lib64/${wrapper_name}.so
86
87if [[ ! -f $wrapper ]]; then
88 echo "need to build $wrapper to run prebuild-libjdwp-tests!"
89 echo "m -j40 ${wrapper/.so/}"
90 exit 6
91fi
92
93if [[ ! -f $plugin ]]; then
94 echo "jvmti plugin not built!"
95 exit 7
96fi
97
98props_path=$PWD/art/tools/libjdwp-compat.props
Alex Lighte4f220d2017-12-13 10:13:50 -080099expect_path=$PWD/art/tools/prebuilt_libjdwp_art_failures.txt
Alex Lightdc700a72017-09-29 13:56:46 -0700100
101function verbose_run() {
102 echo "$@"
103 env "$@"
104}
105
106verbose_run LD_LIBRARY_PATH="$(dirname $jdwp_path):$LD_LIBRARY_PATH" \
107 ./art/tools/run-jdwp-tests.sh \
108 "${args[@]}" \
109 "-Xplugin:$plugin" \
110 --agent-wrapper "${wrapper}"="${props_path}" \
111 --jdwp-path "$jdwp_path" \
112 --expectations "$expect_path"