Chromium Code Reviews| Index: scripts/slave/recipe_modules/chromium_android/api.py |
| diff --git a/scripts/slave/recipe_modules/chromium_android/api.py b/scripts/slave/recipe_modules/chromium_android/api.py |
| index 8d989dea1cd45651e19324acf1eb62ebe7c839f0..880bed9a805441c923648382a272934319bf38ff 100644 |
| --- a/scripts/slave/recipe_modules/chromium_android/api.py |
| +++ b/scripts/slave/recipe_modules/chromium_android/api.py |
| @@ -22,6 +22,7 @@ class AndroidApi(recipe_api.RecipeApi): |
| super(AndroidApi, self).__init__(**kwargs) |
| self._devices = None |
| self._file_changes_path = None |
| + self._known_devices_path = None |
| def get_config_defaults(self): |
| return { |
| @@ -32,7 +33,7 @@ class AndroidApi(recipe_api.RecipeApi): |
| @property |
| def devices(self): |
| assert self._devices is not None,\ |
| - 'devices is only available after device_status_check()' |
| + 'devices is only available after device_status()' |
| return self._devices |
| @property |
| @@ -324,35 +325,62 @@ class AndroidApi(recipe_api.RecipeApi): |
| reboot_timeout=None, max_battery_temp=None, |
| remove_system_webview=False): |
| self.authorize_adb_devices() |
| - self.device_status_check(restart_usb=restart_usb) |
| + self.device_recovery() |
| self.provision_devices( |
| skip_wipe=skip_wipe, disable_location=disable_location, |
| min_battery_level=min_battery_level, disable_network=disable_network, |
| disable_java_debug=disable_java_debug, reboot_timeout=reboot_timeout, |
| max_battery_temp=max_battery_temp, |
| remove_system_webview=remove_system_webview) |
| + self.device_status() |
| @property |
| def blacklist_file(self): |
| return self.out_path.join('bad_devices.json') |
| - def device_status_check(self, restart_usb=False, **kwargs): |
| - # TODO(phajdan.jr): Remove path['build'] usage, http://crbug.com/437264 . |
| - devices_path = self.m.path['build'].join('site_config', '.known_devices') |
| + # TODO(rnephew): Get rid of this when everything calls device_recovery and |
| + # device_status directly. |
| + def device_status_check(self): |
| + self.device_recovery() |
| + self.device_status() |
| + |
| + @property |
| + def known_devices_path(self): |
| + if self._known_devices_path is None: |
| + self._known_devices_path = self.m.path['build'].join('site_config', |
| + '.known_devices') |
| + return self._known_devices_path |
| + |
| + def device_recovery(self, restart_usb=False, **kwargs): |
| args = [ |
| - '--adb-path', self.m.adb.adb_path(), |
| '--blacklist-file', self.blacklist_file, |
|
jbudorick
2016/06/24 14:40:47
This should still be specifying --adb-path
rnephew (Reviews Here)
2016/06/24 17:35:06
Done.
|
| - '--json-output', self.m.json.output(), |
| - '--known-devices-file', devices_path, |
| + '--known-devices-file', self.known_devices_path, |
| + '-v' |
| ] |
| - if restart_usb: |
| - args += ['--restart-usb'] |
| + self.m.step( |
| + 'device_recovery', |
| + [self.m.path['checkout'].join('third_party', 'catapult', 'devil', |
| + 'devil', 'android', 'tools', |
| + 'device_recovery.py')] + args, |
| + env=self.m.chromium.get_env(), |
| + infra_step=True, |
| + **kwargs) |
| + def device_status(self, **kwargs): |
| + buildbot_file = '/home/chrome-bot/.adb_device_info' |
| + args = [ |
| + '--json-output', self.m.json.output(), |
|
jbudorick
2016/06/24 14:40:47
This also should still be specifying --adb-path
rnephew (Reviews Here)
2016/06/24 17:35:06
Done.
|
| + '--blacklist-file', self.blacklist_file, |
| + '--known-devices-file', self.known_devices_path, |
| + '--buildbot-path', buildbot_file, |
| + '-v', '--overwrite-known-devices-files', |
| + ] |
| try: |
| result = self.m.step( |
| - 'device_status_check', |
| - [self.m.path['checkout'].join('build', 'android', 'buildbot', |
| - 'bb_device_status_check.py')] + args, |
| + 'device_status', |
| + [self.m.path['checkout'].join('third_party', 'catapult', 'devil', |
| + 'devil', 'android', 'tools', |
| + 'device_status.py')] + args, |
| step_test_data=lambda: self.m.json.test_api.output([ |
| { |
| "battery": { |
| @@ -486,12 +514,6 @@ class AndroidApi(recipe_api.RecipeApi): |
| env=self.m.chromium.get_env(), |
| infra_step=True, |
| **kwargs) |
| - blacklisted_devices = result.json.output |
| - if blacklisted_devices: |
| - result.presentation.status = self.m.step.WARNING |
| - for d in blacklisted_devices: |
| - key = 'blacklisted %s' % d |
| - result.presentation.logs[key] = [d] |
| def apk_path(self, apk): |
| return self.m.chromium.output_dir.join('apks', apk) if apk else None |
| @@ -875,7 +897,7 @@ class AndroidApi(recipe_api.RecipeApi): |
| else: |
| self.spawn_logcat_monitor() |
| self.authorize_adb_devices() |
| - self.device_status_check() |
| + self.device_recovery() |
| if perf_setup: |
| kwargs = { |
| 'min_battery_level': 95, |
| @@ -886,6 +908,7 @@ class AndroidApi(recipe_api.RecipeApi): |
| kwargs = {} |
| self.provision_devices(remove_system_webview=remove_system_webview, |
| **kwargs) |
| + self.device_status() |
| if self.m.chromium.c.gyp_env.GYP_DEFINES.get('asan', 0) == 1: |
| self.asan_device_setup() |