• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2#
3# Copyright 2016 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
17plugin=libartagentd.so
18if  [[ "$@" == *"-O"* ]]; then
19  plugin=libartagent.so
20fi
21
22# Adjust the agent path when running on device.
23if  [[ "$@" != *"--host"* ]]; then
24  if [[ -z "$ANDROID_BUILD_TOP" ]]; then
25    echo 'ANDROID_BUILD_TOP environment variable is empty; did you forget to run `lunch`?'
26    exit 1
27  fi
28
29  bitness_flag=--32
30  if  [[ "$@" == *"--64"* ]]; then
31    bitness_flag=--64
32  fi
33
34  # Path to native libraries installed on the device for testing purposes.
35  test_native_lib_path=$("$ANDROID_BUILD_TOP/art/test/utils/get-device-test-native-lib-path" \
36    "$bitness_flag")
37
38  # The linker configuration used for dalvikvm(64) in the ART APEX requires us
39  # to pass the full path to the agent to the runtime when running on device.
40  plugin=${test_native_lib_path}/${plugin}
41fi
42
43./default-run "$@" --runtime-option -agentpath:${plugin}=test_900 \
44                   --runtime-option -agentpath:${plugin}=test_900_round_2 \
45                   --android-runtime-option -Xplugin:${plugin}
46