Alex Light | dc700a7 | 2017-09-29 13:56:46 -0700 | [diff] [blame] | 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 | |
| 17 | if [[ ! -d libcore ]]; then |
| 18 | echo "Script needs to be run at the root of the android tree" |
| 19 | exit 1 |
| 20 | fi |
| 21 | |
| 22 | source build/envsetup.sh >&/dev/null # for get_build_var, setpaths |
| 23 | setpaths # include platform prebuilt java, javac, etc in $PATH. |
| 24 | |
| 25 | if [[ `uname` != 'Linux' ]]; then |
| 26 | echo "Script cannot be run on $(uname). It is Linux only." |
| 27 | exit 2 |
| 28 | fi |
| 29 | |
| 30 | jdwp_path=${ANDROID_JAVA_HOME}/jre/lib/amd64/libjdwp.so |
| 31 | if [[ ! -f $jdwp_path ]]; then |
| 32 | echo "Unable to find prebuilts libjdwp.so! Did the version change from jdk8?" |
| 33 | exit 3 |
| 34 | fi |
| 35 | |
| 36 | args=("$@") |
| 37 | debug="no" |
| 38 | has_variant="no" |
| 39 | has_mode="no" |
| 40 | |
| 41 | while 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 |
| 66 | done |
| 67 | |
| 68 | if [[ "$has_mode" = "no" ]]; then |
| 69 | args+=(--mode=host) |
| 70 | fi |
| 71 | |
| 72 | if [[ "$has_variant" = "no" ]]; then |
| 73 | args+=(--variant=X64) |
| 74 | fi |
| 75 | |
| 76 | wrapper_name="" |
| 77 | plugin="" |
| 78 | if [[ "$debug" = "yes" ]]; then |
| 79 | wrapper_name=libwrapagentpropertiesd |
| 80 | plugin="$ANDROID_HOST_OUT/lib64/libopenjdkjvmtid.so" |
| 81 | else |
| 82 | wrapper_name=libwrapagentproperties |
| 83 | plugin="$ANDROID_HOST_OUT/lib64/libopenjdkjvmti.so" |
| 84 | fi |
| 85 | wrapper=$ANDROID_HOST_OUT/lib64/${wrapper_name}.so |
| 86 | |
| 87 | if [[ ! -f $wrapper ]]; then |
| 88 | echo "need to build $wrapper to run prebuild-libjdwp-tests!" |
| 89 | echo "m -j40 ${wrapper/.so/}" |
| 90 | exit 6 |
| 91 | fi |
| 92 | |
| 93 | if [[ ! -f $plugin ]]; then |
| 94 | echo "jvmti plugin not built!" |
| 95 | exit 7 |
| 96 | fi |
| 97 | |
| 98 | props_path=$PWD/art/tools/libjdwp-compat.props |
Alex Light | e4f220d | 2017-12-13 10:13:50 -0800 | [diff] [blame] | 99 | expect_path=$PWD/art/tools/prebuilt_libjdwp_art_failures.txt |
Alex Light | dc700a7 | 2017-09-29 13:56:46 -0700 | [diff] [blame] | 100 | |
| 101 | function verbose_run() { |
| 102 | echo "$@" |
| 103 | env "$@" |
| 104 | } |
| 105 | |
| 106 | verbose_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" |