diff options
author | Nicolas Geoffray <ngeoffray@google.com> | 2014-12-04 17:05:22 +0000 |
---|---|---|
committer | Nicolas Geoffray <ngeoffray@google.com> | 2014-12-05 12:08:27 +0000 |
commit | 70a998c77587712e4bd5348e304bd8a11aa9d8f9 (patch) | |
tree | 387b652f37072bf35c50b431ea1a631d9c008fc6 /tools/art | |
parent | b510c82ebaf11cf6f4f215f6237ee6a44861ef10 (diff) | |
download | art-70a998c77587712e4bd5348e304bd8a11aa9d8f9.tar.gz art-70a998c77587712e4bd5348e304bd8a11aa9d8f9.tar.bz2 art-70a998c77587712e4bd5348e304bd8a11aa9d8f9.zip |
Make script suitable for vogar use on device.
Also update device expectations that need investigation.
Change-Id: I86a613f3f62c2f999296f8b7505646a96ab4adf8
Diffstat (limited to 'tools/art')
-rw-r--r-- | tools/art | 25 |
1 files changed, 18 insertions, 7 deletions
@@ -1,5 +1,3 @@ -#!/bin/bash -# # Copyright (C) 2011 The Android Open Source Project # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,6 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. +# This script is used on host and device. It uses a common subset +# shell dialect that should work on the host (e.g. bash), and +# Android (e.g. mksh). + function follow_links() { if [ z"$BASH_SOURCE" != z ]; then file="$BASH_SOURCE" @@ -28,7 +30,8 @@ function follow_links() { } function find_libdir() { - if [ "$(readlink "$ANDROID_ROOT/bin/$DALVIKVM")" = "dalvikvm64" ]; then + # Use realpath instead of readlink because Android does not have a readlink. + if [ "$(realpath "$ANDROID_ROOT/bin/$DALVIKVM")" = "$(realpath "$ANDROID_ROOT/bin/dalvikvm64")" ]; then echo "lib64" else echo "lib" @@ -70,16 +73,22 @@ done PROG_NAME="$(follow_links)" PROG_DIR="$(cd "${PROG_NAME%/*}" ; pwd -P)" ANDROID_ROOT=$PROG_DIR/.. -ANDROID_DATA=$PWD/android-data$$ LIBDIR=$(find_libdir) LD_LIBRARY_PATH=$ANDROID_ROOT/$LIBDIR - if [ z"$PERF" != z ]; then invoke_with="perf record -o $ANDROID_DATA/perf.data -e cycles:u $invoke_with" fi -mkdir -p $ANDROID_DATA/dalvik-cache/{arm,arm64,x86,x86_64} +DELETE_ANDROID_DATA=false +# If ANDROID_DATA is the system ANDROID_DATA or is not set, use our own, +# and ensure we delete it at the end. +if [ "$ANDROID_DATA" = "/data" ] || [ "$ANDROID_DATA" = "" ]; then + ANDROID_DATA=$PWD/android-data$$ + mkdir -p $ANDROID_DATA/dalvik-cache/{arm,arm64,x86,x86_64} + DELETE_ANDROID_DATA=true +fi + ANDROID_DATA=$ANDROID_DATA \ ANDROID_ROOT=$ANDROID_ROOT \ LD_LIBRARY_PATH=$LD_LIBRARY_PATH \ @@ -97,7 +106,9 @@ if [ z"$PERF" != z ]; then fi echo "Perf data saved in: $ANDROID_DATA/perf.data" else - rm -rf $ANDROID_DATA + if [ "$DELETE_ANDROID_DATA" = "true" ]; then + rm -rf $ANDROID_DATA + fi fi exit $EXIT_STATUS |