Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(627)

Side by Side Diff: build/android/adb_device_functions.sh

Issue 10963054: Make adb_device_loop return if no devices (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/bin/bash 1 #!/bin/bash
2 # 2 #
3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 # 6 #
7 # A collection of functions useful for maintaining android devices 7 # A collection of functions useful for maintaining android devices
8 8
9 9
10 # Run an adb command on all connected device in parallel. 10 # Run an adb command on all connected device in parallel.
(...skipping 24 matching lines...) Expand all
35 # adb_all 35 # adb_all
36 # Usage: adb_device_loop 'command line to eval' 36 # Usage: adb_device_loop 'command line to eval'
37 adb_device_loop() { 37 adb_device_loop() {
38 if [[ $# == 0 ]]; then 38 if [[ $# == 0 ]]; then
39 echo "Intended for more complex one-liners that cannot be done with" \ 39 echo "Intended for more complex one-liners that cannot be done with" \
40 "adb_all." 40 "adb_all."
41 echo 'Usage: adb_device_loop "echo $DEVICE: $(adb root &&' \ 41 echo 'Usage: adb_device_loop "echo $DEVICE: $(adb root &&' \
42 'adb shell cat /data/local.prop)"' 42 'adb shell cat /data/local.prop)"'
43 return 1 43 return 1
44 fi 44 fi
45 local DEVICES=$(adb_get_devices -b) 45 local DEVICES=$(adb_get_devices)
46 if [[ -z $DEVICES ]]; then
47 return
48 fi
46 # Do not change DEVICE variable name - part of api 49 # Do not change DEVICE variable name - part of api
47 for DEVICE in $DEVICES; do 50 for DEVICE in $DEVICES; do
48 DEV_TYPE=$(adb -s $DEVICE shell getprop ro.product.device | sed 's/\r//') 51 DEV_TYPE=$(adb -s $DEVICE shell getprop ro.product.device | sed 's/\r//')
49 echo "Running on $DEVICE ($DEV_TYPE)" 52 echo "Running on $DEVICE ($DEV_TYPE)"
50 ANDROID_SERIAL=$DEVICE eval "$*" 53 ANDROID_SERIAL=$DEVICE eval "$*"
51 done 54 done
52 } 55 }
53 56
54 # Erases data from any devices visible on adb. To preserve a device, 57 # Erases data from any devices visible on adb. To preserve a device,
55 # disconnect it or: 58 # disconnect it or:
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 _adb_multi() { 130 _adb_multi() {
128 local DEVICES=$1 131 local DEVICES=$1
129 local ADB_ARGS=$2 132 local ADB_ARGS=$2
130 ( 133 (
131 for DEVICE in $DEVICES; do 134 for DEVICE in $DEVICES; do
132 adb -s $DEVICE $ADB_ARGS & 135 adb -s $DEVICE $ADB_ARGS &
133 done 136 done
134 wait 137 wait
135 ) 138 )
136 } 139 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698