diff options
author | qiankun.miao <qiankun.miao@intel.com> | 2014-06-29 22:38:54 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-06-29 22:38:54 -0700 |
commit | b2e1fa5b76bc6d38b3cb7074470512f0004d58ce (patch) | |
tree | b9d04a0ff76ffd1d026fbe80cc04605332ddff31 | |
parent | e462f2bed33283862bb983c67776a47c5a6acb01 (diff) |
Push resources to Android device
The resources directory is required by some benchmarks. Push it to
device's /data/local/tmp. Add "-i /data/local/tmp/resources" to command
line when using these resources.
BUG=skia:
R=djsollen@google.com, mtklein@google.com, borenet@google.com
Author: qiankun.miao@intel.com
Review URL: https://codereview.chromium.org/352303003
-rwxr-xr-x | platform_tools/android/bin/android_run_skia | 3 | ||||
-rwxr-xr-x | platform_tools/android/bin/android_setup.sh | 27 |
2 files changed, 24 insertions, 6 deletions
diff --git a/platform_tools/android/bin/android_run_skia b/platform_tools/android/bin/android_run_skia index 7176fd2c36..7f0105c59b 100755 --- a/platform_tools/android/bin/android_run_skia +++ b/platform_tools/android/bin/android_run_skia @@ -19,6 +19,9 @@ if [ -f "${SKIA_OUT}/$BUILDTYPE/lib/libskia_android.so" ]; then adb_push_if_needed "${SKIA_OUT}/$BUILDTYPE/lib/libskia_android.so" /data/local/tmp fi adb_push_if_needed "${SKIA_OUT}/$BUILDTYPE/lib/lib${APP_ARGS[0]}.so" /data/local/tmp +if [[ -n $RESOURCE_PATH ]]; then + adb_push_if_needed "${SKIA_SRC_DIR}/resources" $RESOURCE_PATH +fi STATUS_FILENAME="/data/local/tmp/.skia_tmp_$(date +%s%N)" $ADB ${DEVICE_SERIAL} shell \ diff --git a/platform_tools/android/bin/android_setup.sh b/platform_tools/android/bin/android_setup.sh index 9ca8454ab5..4a7326bf86 100755 --- a/platform_tools/android/bin/android_setup.sh +++ b/platform_tools/android/bin/android_setup.sh @@ -11,6 +11,10 @@ while (( "$#" )); do if [[ "$1" == "-d" ]]; then DEVICE_ID=$2 shift + elif [[ "$1" == "-i" || "$1" == "--resourcePath" ]]; then + RESOURCE_PATH=$2 + APP_ARGS=("${APP_ARGS[@]}" "${1}" "${2}") + shift elif [[ "$1" == "-s" ]]; then DEVICE_SERIAL="-s $2" shift @@ -205,11 +209,12 @@ adb_push_if_needed() { source $SCRIPT_DIR/utils/setup_adb.sh # read input params - HOST_SRC="$1" - ANDROID_DST="$2" + local HOST_SRC="$1" + local ANDROID_DST="$2" ANDROID_LS=`$ADB $DEVICE_SERIAL shell ls -ld $ANDROID_DST` - if [ "${ANDROID_LS:0:1}" == "d" ]; + HOST_LS=`ls -ld $HOST_SRC` + if [ "${ANDROID_LS:0:1}" == "d" -a "${HOST_LS:0:1}" == "-" ]; then ANDROID_DST="${ANDROID_DST}/$(basename ${HOST_SRC})" fi @@ -229,10 +234,20 @@ adb_push_if_needed() { echo -n "$ANDROID_DST " $ADB $DEVICE_SERIAL push $HOST_SRC $ANDROID_DST fi + elif [ "${ANDROID_LS:0:1}" == "d" ]; then + for FILE_ITEM in `ls $HOST_SRC`; do + adb_push_if_needed "${HOST_SRC}/${FILE_ITEM}" "${ANDROID_DST}/${FILE_ITEM}" + done else - echo -n "$ANDROID_DST " - $ADB $DEVICE_SERIAL shell mkdir -p "$(dirname "$ANDROID_DST")" - $ADB $DEVICE_SERIAL push $HOST_SRC $ANDROID_DST + HOST_LS=`ls -ld $HOST_SRC` + if [ "${HOST_LS:0:1}" == "d" ]; then + $ADB $DEVICE_SERIAL shell mkdir -p $ANDROID_DST + adb_push_if_needed $HOST_SRC $ANDROID_DST + else + echo -n "$ANDROID_DST " + $ADB $DEVICE_SERIAL shell mkdir -p "$(dirname "$ANDROID_DST")" + $ADB $DEVICE_SERIAL push $HOST_SRC $ANDROID_DST + fi fi } |