diff options
author | bulach@chromium.org <bulach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-16 07:22:16 +0000 |
---|---|---|
committer | bulach@chromium.org <bulach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-16 07:22:16 +0000 |
commit | abfec37125a185bf1d166d7ecc654cdcd1e84307 (patch) | |
tree | 7cf7ebdd2503583ba0bb3c0b372cef6659a51f9d /build | |
parent | 6f59107ee9d1ca2927ed1caf53f2e9d25a254959 (diff) | |
download | chromium_src-abfec37125a185bf1d166d7ecc654cdcd1e84307.zip chromium_src-abfec37125a185bf1d166d7ecc654cdcd1e84307.tar.gz chromium_src-abfec37125a185bf1d166d7ecc654cdcd1e84307.tar.bz2 |
Android: uses taskset when starting adb.
Workaround for some adb issues.
While at it, print the step name before doing any action.
BUG=268450
Review URL: https://chromiumcodereview.appspot.com/22857005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@217959 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'build')
-rwxr-xr-x | build/android/buildbot/bb_device_steps.py | 12 | ||||
-rw-r--r-- | build/android/pylib/android_commands.py | 33 |
2 files changed, 35 insertions, 10 deletions
diff --git a/build/android/buildbot/bb_device_steps.py b/build/android/buildbot/bb_device_steps.py index 1d83a96..f020281 100755 --- a/build/android/buildbot/bb_device_steps.py +++ b/build/android/buildbot/bb_device_steps.py @@ -237,12 +237,14 @@ def SpawnLogcatMonitor(): RunCmd(['sleep', '5']) def ProvisionDevices(options): - # Restart adb to work around bugs, sleep to wait for usb discovery. - RunCmd(['adb', 'kill-server']) - RunCmd(['adb', 'start-server']) - RunCmd(['sleep', '1']) - bb_annotations.PrintNamedStep('provision_devices') + + if not bb_utils.TESTING: + # Restart adb to work around bugs, sleep to wait for usb discovery. + adb = android_commands.AndroidCommands() + adb.RestartAdbServer() + RunCmd(['sleep', '1']) + if options.reboot: RebootDevices() provision_cmd = ['build/android/provision_devices.py', '-t', options.target] diff --git a/build/android/pylib/android_commands.py b/build/android/pylib/android_commands.py index f8c0747..9dc50c3 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. |