diff options
author | robertocn <robertocn@chromium.org> | 2015-09-04 14:19:32 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-09-04 21:20:11 +0000 |
commit | 0179090eb844b39ea55bd70e8e2202c4d3a81026 (patch) | |
tree | f7966327e20476ab141ab99559557c6e1ff01ca5 | |
parent | ab0a1f73678c030d8a5168dc8d78ea69c9e52dba (diff) | |
download | chromium_src-0179090eb844b39ea55bd70e8e2202c4d3a81026.zip chromium_src-0179090eb844b39ea55bd70e8e2202c4d3a81026.tar.gz chromium_src-0179090eb844b39ea55bd70e8e2202c4d3a81026.tar.bz2 |
Revert of [Android] Don't use a device blacklist if one isn't provided. (patchset #1 id:1 of https://codereview.chromium.org/1314823011/ )
Reason for revert:
Speculative revert, some builders (Nexus 5, 6 and 9 under chromium.gpu) are failing at the device status check step after this change due to:
File "build/android/buildbot/bb_device_status_check.py", line 154, in blacklisting_device_status
if not serial in blacklist.Read():
AttributeError: 'NoneType' object has no attribute 'Read'
See http://build.chromium.org/p/chromium.gpu/builders/Android%20Debug%20%28Nexus%205%29/builds/2067 for example.
Original issue's description:
> [Android] Don't use a device blacklist if one isn't provided.
>
> BUG=517709
>
> Committed: https://crrev.com/be5c91849d2196f97c7a4e0b3e90597c3f2b4c40
> Cr-Commit-Position: refs/heads/master@{#347473}
TBR=rnephew@chromium.org,jbudorick@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=517709
Review URL: https://codereview.chromium.org/1306653005
Cr-Commit-Position: refs/heads/master@{#347489}
-rwxr-xr-x | build/android/adb_install_apk.py | 9 | ||||
-rwxr-xr-x | build/android/adb_reverse_forwarder.py | 8 | ||||
-rwxr-xr-x | build/android/buildbot/bb_device_status_check.py | 8 | ||||
-rw-r--r-- | build/android/devil/android/device_blacklist.py | 27 | ||||
-rw-r--r-- | build/android/devil/android/device_utils.py | 6 | ||||
-rwxr-xr-x | build/android/enable_asserts.py | 7 | ||||
-rwxr-xr-x | build/android/provision_devices.py | 8 | ||||
-rw-r--r-- | build/android/pylib/local/device/local_device_environment.py | 5 | ||||
-rwxr-xr-x | build/android/screenshot.py | 7 | ||||
-rwxr-xr-x | build/android/test_runner.py | 9 | ||||
-rwxr-xr-x | build/android/tombstones.py | 7 | ||||
-rwxr-xr-x | build/android/update_verification.py | 7 |
12 files changed, 72 insertions, 36 deletions
diff --git a/build/android/adb_install_apk.py b/build/android/adb_install_apk.py index 4f299ef..e00981f 100755 --- a/build/android/adb_install_apk.py +++ b/build/android/adb_install_apk.py @@ -83,9 +83,12 @@ def main(): and helper.GetSplitName()): splits.append(f) - blacklist = (device_blacklist.Blacklist(args.blacklist_file) - if args.blacklist_file - else None) + if args.blacklist_file: + blacklist = device_blacklist.Blacklist(args.blacklist_file) + else: + # TODO(jbudorick): Remove this once the bots are converted. + blacklist = device_blacklist.Blacklist(device_blacklist.BLACKLIST_JSON) + devices = device_utils.DeviceUtils.HealthyDevices(blacklist) if args.device: diff --git a/build/android/adb_reverse_forwarder.py b/build/android/adb_reverse_forwarder.py index d85a8aa..44b1b97 100755 --- a/build/android/adb_reverse_forwarder.py +++ b/build/android/adb_reverse_forwarder.py @@ -56,9 +56,11 @@ def main(argv): parser.error('Bad port number') sys.exit(1) - blacklist = (device_blacklist.Blacklist(options.blacklist_file) - if options.blacklist_file - else None) + if options.blacklist_file: + blacklist = device_blacklist.Blacklist(options.blacklist_file) + else: + blacklist = None + devices = device_utils.DeviceUtils.HealthyDevices(blacklist) if options.device: diff --git a/build/android/buildbot/bb_device_status_check.py b/build/android/buildbot/bb_device_status_check.py index 9d54fe3..7cd6cd0 100755 --- a/build/android/buildbot/bb_device_status_check.py +++ b/build/android/buildbot/bb_device_status_check.py @@ -295,9 +295,11 @@ def main(): run_tests_helper.SetLogLevel(args.verbose) - blacklist = (device_blacklist.Blacklist(args.blacklist_file) - if args.blacklist_file - else None) + if args.blacklist_file: + blacklist = device_blacklist.Blacklist(args.blacklist_file) + else: + # TODO(jbudorick): Remove this once bots pass the blacklist file. + blacklist = device_blacklist.Blacklist(device_blacklist.BLACKLIST_JSON) last_devices_path = os.path.join( args.out_dir, device_list.LAST_DEVICES_FILENAME) diff --git a/build/android/devil/android/device_blacklist.py b/build/android/devil/android/device_blacklist.py index 615b3e6..0724654 100644 --- a/build/android/devil/android/device_blacklist.py +++ b/build/android/devil/android/device_blacklist.py @@ -3,7 +3,6 @@ # found in the LICENSE file. import json -import logging import os import threading @@ -50,16 +49,34 @@ class Blacklist(object): Args: devices: list of bad devices to be added to the blacklist file. """ - logging.info('Adding %s to blacklist %s', ','.join(devices), self._path) with self._blacklist_lock: - blacklist = self.Read() + blacklist = ReadBlacklist() blacklist.extend(devices) - self.Write(blacklist) + WriteBlacklist(blacklist) def Reset(self): """Erases the blacklist file if it exists.""" - logging.info('Resetting blacklist %s', self._path) with self._blacklist_lock: if os.path.exists(self._path): os.remove(self._path) + +def ReadBlacklist(): + # TODO(jbudorick): Phase out once all clients have migrated. + return Blacklist(BLACKLIST_JSON).Read() + + +def WriteBlacklist(blacklist): + # TODO(jbudorick): Phase out once all clients have migrated. + Blacklist(BLACKLIST_JSON).Write(blacklist) + + +def ExtendBlacklist(devices): + # TODO(jbudorick): Phase out once all clients have migrated. + Blacklist(BLACKLIST_JSON).Extend(devices) + + +def ResetBlacklist(): + # TODO(jbudorick): Phase out once all clients have migrated. + Blacklist(BLACKLIST_JSON).Reset() + diff --git a/build/android/devil/android/device_utils.py b/build/android/devil/android/device_utils.py index 6109341..416009a 100644 --- a/build/android/devil/android/device_utils.py +++ b/build/android/devil/android/device_utils.py @@ -1922,7 +1922,11 @@ class DeviceUtils(object): @classmethod def HealthyDevices(cls, blacklist=None, **kwargs): - blacklisted_devices = blacklist.Read() if blacklist else [] + if not blacklist: + # TODO(jbudorick): Remove once clients pass in the blacklist. + blacklist = device_blacklist.Blacklist(device_blacklist.BLACKLIST_JSON) + + blacklisted_devices = blacklist.Read() def blacklisted(adb): if adb.GetDeviceSerial() in blacklisted_devices: logging.warning('Device %s is blacklisted.', adb.GetDeviceSerial()) diff --git a/build/android/enable_asserts.py b/build/android/enable_asserts.py index 0616567..1c60277 100755 --- a/build/android/enable_asserts.py +++ b/build/android/enable_asserts.py @@ -28,9 +28,10 @@ def main(): args = parser.parse_args() - blacklist = (device_blacklist.Blacklist(args.blacklist_file) - if args.blacklist_file - else None) + if args.blacklist_file: + blacklist = device_blacklist.Blacklist(args.blacklist_file) + else: + blacklist = None # TODO(jbudorick): Accept optional serial number and run only for the # specified device when present. diff --git a/build/android/provision_devices.py b/build/android/provision_devices.py index 1379377..0a7f8fd7 100755 --- a/build/android/provision_devices.py +++ b/build/android/provision_devices.py @@ -53,9 +53,11 @@ class _PHASES(object): def ProvisionDevices(args): - blacklist = (device_blacklist.Blacklist(args.blacklist_file) - if args.blacklist_file - else None) + if args.blacklist_file: + blacklist = device_blacklist.Blacklist(args.blacklist_file) + else: + # TODO(jbudorick): Remove once the bots have switched over. + blacklist = device_blacklist.Blacklist(device_blacklist.BLACKLIST_JSON) devices = device_utils.DeviceUtils.HealthyDevices(blacklist) if args.device: diff --git a/build/android/pylib/local/device/local_device_environment.py b/build/android/pylib/local/device/local_device_environment.py index f146f7a..7a20903 100644 --- a/build/android/pylib/local/device/local_device_environment.py +++ b/build/android/pylib/local/device/local_device_environment.py @@ -14,9 +14,8 @@ class LocalDeviceEnvironment(environment.Environment): def __init__(self, args, _error_func): super(LocalDeviceEnvironment, self).__init__() - self._blacklist = (device_blacklist.Blacklist(args.blacklist_file) - if args.blacklist_file - else None) + self._blacklist = device_blacklist.Blacklist( + args.blacklist_file or device_blacklist.BLACKLIST_JSON) self._device_serial = args.test_device self._devices = [] self._max_tries = 1 + args.num_retries diff --git a/build/android/screenshot.py b/build/android/screenshot.py index 902e068..b039796 100755 --- a/build/android/screenshot.py +++ b/build/android/screenshot.py @@ -75,9 +75,10 @@ def main(): if options.verbose: logging.getLogger().setLevel(logging.DEBUG) - blacklist = (device_blacklist.Blacklist(options.blacklist_file) - if options.blacklist_file - else None) + if options.blacklist_file: + blacklist = device_blacklist.Blacklist(options.blacklist_file) + else: + blacklist = None devices = device_utils.DeviceUtils.HealthyDevices(blacklist) if options.device: diff --git a/build/android/test_runner.py b/build/android/test_runner.py index 18b87ad..204c81c 100755 --- a/build/android/test_runner.py +++ b/build/android/test_runner.py @@ -895,10 +895,13 @@ def _GetAttachedDevices(blacklist_file, test_device): Returns: A list of attached devices. """ - blacklist = (device_blacklist.Blacklist(blacklist_file) - if blacklist_file - else None) + if not blacklist_file: + # TODO(jbudorick): Remove this once bots pass the blacklist file. + blacklist_file = device_blacklist.BLACKLIST_JSON + logging.warning('Using default device blacklist %s', + device_blacklist.BLACKLIST_JSON) + blacklist = device_blacklist.Blacklist(blacklist_file) attached_devices = device_utils.DeviceUtils.HealthyDevices(blacklist) if test_device: test_device = [d for d in attached_devices if d == test_device] diff --git a/build/android/tombstones.py b/build/android/tombstones.py index f7f5bdc..b1c79d3 100755 --- a/build/android/tombstones.py +++ b/build/android/tombstones.py @@ -237,9 +237,10 @@ def main(): 'crash stacks.') options, _ = parser.parse_args() - blacklist = (device_blacklist.Blacklist(options.blacklist_file) - if options.blacklist_file - else None) + if options.blacklist_file: + blacklist = device_blacklist.Blacklist(options.blacklist_file) + else: + blacklist = None if options.device: devices = [device_utils.DeviceUtils(options.device)] diff --git a/build/android/update_verification.py b/build/android/update_verification.py index b25ea49..c73a061 100755 --- a/build/android/update_verification.py +++ b/build/android/update_verification.py @@ -90,9 +90,10 @@ def main(): args = parser.parse_args() run_tests_helper.SetLogLevel(args.verbose) - blacklist = (device_blacklist.Blacklist(args.blacklist_file) - if args.blacklist_file - else None) + if args.blacklist_file: + blacklist = device_blacklist.Blacklist(args.blacklist_file) + else: + blacklist = None devices = device_utils.DeviceUtils.HealthyDevices(blacklist) if not devices: |