summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Nicolas Geoffray <ngeoffray@google.com> 2016-03-07 13:33:37 +0000
committer Nicolas Geoffray <ngeoffray@google.com> 2016-03-07 13:33:37 +0000
commitfe6f0b6dbfa2f5d234cd965bdefc551432c08d98 (patch)
tree86b4200b067ab0bc3cb4c8340fa20fc01063c584
parent8a8c84114b16b8971bc2d3c5c7e0e31470d1a68b (diff)
Workaround for broken 'ps' command on M.
Change-Id: Ifabc6bb2b0e3780306e8a3ad45531c50c7627ed1
-rwxr-xr-xtools/setup-buildbot-device.sh12
1 files changed, 10 insertions, 2 deletions
diff --git a/tools/setup-buildbot-device.sh b/tools/setup-buildbot-device.sh
index 9e085b58b4..1e9c763534 100755
--- a/tools/setup-buildbot-device.sh
+++ b/tools/setup-buildbot-device.sh
@@ -46,5 +46,13 @@ adb logcat -P ""
adb logcat -p
echo -e "${green}Kill stalled dalvikvm processes${nc}"
-processes=$(adb shell "ps" | grep dalvikvm | awk '{print $2}')
-for i in $processes; do adb shell kill -9 $i; done
+# 'ps' on M can sometimes hang.
+timeout 2s adb shell "ps"
+if [ $? = 124 ]; then
+ echo -e "${green}Rebooting device to fix 'ps'${nc}"
+ adb reboot
+ adb wait-for-device root
+else
+ processes=$(adb shell "ps" | grep dalvikvm | awk '{print $2}')
+ for i in $processes; do adb shell kill -9 $i; done
+fi