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

Unified Diff: build/android/pylib/android_commands.py

Issue 22857005: Android: uses taskset when starting adb. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: bb_utils.TESTING Created 7 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build/android/buildbot/bb_device_steps.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/pylib/android_commands.py
diff --git a/build/android/pylib/android_commands.py b/build/android/pylib/android_commands.py
index f8c074758d08c35ce7b637959447b1a68faaf598..9dc50c36688b6b2dc3830b710f02b02cea66db09 100644
--- a/build/android/pylib/android_commands.py
+++ b/build/android/pylib/android_commands.py
@@ -459,18 +459,41 @@ class AndroidCommands(object):
def RestartAdbServer(self):
"""Restart the adb server."""
- self.KillAdbServer()
- self.StartAdbServer()
+ ret = self.KillAdbServer()
+ if ret != 0:
+ raise errors.MsgException('KillAdbServer: %d' % ret)
+
+ ret = self.StartAdbServer()
+ if ret != 0:
+ raise errors.MsgException('StartAdbServer: %d' % ret)
def KillAdbServer(self):
"""Kill adb server."""
adb_cmd = [constants.ADB_PATH, 'kill-server']
- return cmd_helper.RunCmd(adb_cmd)
+ ret = cmd_helper.RunCmd(adb_cmd)
+ retry = 0
+ while retry < 3:
+ ret = cmd_helper.RunCmd(['pgrep', 'adb'])
+ if ret != 0:
+ # pgrep didn't find adb, kill-server succeeded.
+ return 0
+ retry += 1
+ time.sleep(retry)
+ return ret
def StartAdbServer(self):
"""Start adb server."""
- adb_cmd = [constants.ADB_PATH, 'start-server']
- return cmd_helper.RunCmd(adb_cmd)
+ adb_cmd = ['taskset', '-c', '0', constants.ADB_PATH, 'start-server']
+ ret = cmd_helper.RunCmd(adb_cmd)
+ retry = 0
+ while retry < 3:
+ ret = cmd_helper.RunCmd(['pgrep', 'adb'])
+ if ret == 0:
+ # pgrep fonud adb, start-server succeeded.
+ return 0
+ retry += 1
+ time.sleep(retry)
+ return ret
def WaitForSystemBootCompleted(self, wait_time):
"""Waits for targeted system's boot_completed flag to be set.
« no previous file with comments | « build/android/buildbot/bb_device_steps.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698