Commit 62701f41 authored by ilevy@chromium.org's avatar ilevy@chromium.org

Added reboot phone step to android testers

- Does not break bot, but attempts to wait until phone boots
- Minor fixes to adb_device_functions

BUG=141899

Review URL: https://chromiumcodereview.appspot.com/10837180

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@152052 0039d316-1c4b-4281-b951-d872f2087c98
parent 299b10ab
......@@ -20,7 +20,7 @@ adb_all() {
echo "Example: adb_all install Chrome.apk"
return 1
fi
local DEVICES=$(adb_blocking_get_devices)
local DEVICES=$(adb_get_devices -b)
local NUM_DEVICES=$(echo $DEVICES | wc -w)
if (( $NUM_DEVICES > 1 )); then
echo "Looping over $NUM_DEVICES devices"
......@@ -42,7 +42,7 @@ adb_device_loop() {
'adb shell cat /data/local.prop)"'
return 1
fi
local DEVICES=$(adb_blocking_get_devices)
local DEVICES=$(adb_get_devices -b)
# Do not change DEVICE variable name - part of api
for DEVICE in $DEVICES; do
DEV_TYPE=$(adb -s $DEVICE shell getprop ro.product.device | sed 's/\r//')
......@@ -67,19 +67,21 @@ wipe_all_devices() {
echo "If fastboot fails, run: 'sudo adduser $(whoami) plugdev'"
fi
local DEVICES=$(adb_blocking_get_devices)
local DEVICES=$(adb_get_devices -b)
if [[ $1 != '-f' ]]; then
echo "This will ERASE ALL DATA from $(echo $DEVICES | wc -w) device."
read -p "Hit enter to continue"
fi
_adb_multi "$DEVICES" "root"
_adb_multi "$DEVICES" "wait-for-device"
_adb_multi "$DEVICES" "reboot bootloader"
# Subshell to isolate job list
(
for DEVICE in $DEVICES; do
fastboot_erase $DEVICE
fastboot_erase $DEVICE &
done
wait
)
# Reboot devices together
for DEVICE in $DEVICES; do
......@@ -106,10 +108,11 @@ fastboot_erase() {
fastboot $SERIAL erase userdata
}
# Block until adb detects a device, then return list of serials
adb_blocking_get_devices() {
# Get list of devices connected via adb
# Args: -b block until adb detects a device
adb_get_devices() {
local DEVICES="$(adb devices | grep 'device$')"
if [[ -z $DEVICES ]]; then
if [[ -z $DEVICES && $1 == '-b' ]]; then
echo '- waiting for device -' >&2
local DEVICES="$(adb wait-for-device devices | grep 'device$')"
fi
......
......@@ -290,3 +290,18 @@ function bb_extract_build {
return $extract_exitcode
)
}
# Reboot all phones and wait for them to start back up
# Does not break build if a phone fails to restart
function bb_reboot_phones {
echo "@@@BUILD_STEP Rebooting phones@@@"
(
set +e
cd $CHROME_SRC/build/android/pylib;
for DEVICE in $(adb_get_devices); do
python -c "import android_commands;\
android_commands.AndroidCommands(device='$DEVICE').Reboot(True)" &
done
wait
)
}
......@@ -14,5 +14,6 @@ BB_SRC_ROOT="$(cd "$(dirname $0)/../.."; pwd)"
bb_baseline_setup "$BB_SRC_ROOT" "$@"
bb_extract_build
bb_reboot_phones
bb_run_tests
bb_run_content_shell_instrumentation_test
......@@ -14,5 +14,6 @@ ROOT=$(cd "$(dirname $0)"; pwd)
bb_baseline_setup "${ROOT}"/../..
bb_compile
bb_reboot_phones
bb_run_tests
bb_run_content_shell_instrumentation_test
......@@ -14,5 +14,6 @@ BB_SRC_ROOT="$(cd "$(dirname $0)/../.."; pwd)"
bb_baseline_setup "$BB_SRC_ROOT" "$@"
bb_extract_build
bb_reboot_phones
bb_run_tests
bb_run_content_shell_instrumentation_test
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment