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

Side by Side Diff: build/android/pylib/local/device/local_device_environment.py

Issue 1430663002: specify the reason for blacklisting (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add reason for local device failures Created 5 years, 1 month 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 unified diff | Download patch
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import logging 5 import logging
6 import os 6 import os
7 import threading 7 import threading
8 8
9 from devil.android import device_blacklist 9 from devil.android import device_blacklist
10 from devil.android import device_errors 10 from devil.android import device_errors
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 def TearDown(self): 89 def TearDown(self):
90 # Write the cache even when not using it so that it will be ready the first 90 # Write the cache even when not using it so that it will be ready the first
91 # time that it is enabled. Writing it every time is also necessary so that 91 # time that it is enabled. Writing it every time is also necessary so that
92 # an invalid cache can be flushed just by disabling it for one run. 92 # an invalid cache can be flushed just by disabling it for one run.
93 for d in self._devices: 93 for d in self._devices:
94 cache_path = _DeviceCachePath(d) 94 cache_path = _DeviceCachePath(d)
95 with open(cache_path, 'w') as f: 95 with open(cache_path, 'w') as f:
96 f.write(d.DumpCacheData()) 96 f.write(d.DumpCacheData())
97 logging.info('Wrote device cache: %s', cache_path) 97 logging.info('Wrote device cache: %s', cache_path)
98 98
99 def BlacklistDevice(self, device): 99 def BlacklistDevice(self, device, reason='local_device_failure'):
100 if not self._blacklist: 100 if not self._blacklist:
101 logging.warning( 101 logging.warning(
102 'Attempted to blacklist %s, but no blacklist was provided.', 102 'Attempted to blacklist %s, but no blacklist was provided.',
103 str(device)) 103 str(device))
104 return 104 return
105 105
106 device_serial = device.adb.GetDeviceSerial() 106 device_serial = device.adb.GetDeviceSerial()
107 self._blacklist.Extend([device_serial]) 107 self._blacklist.Extend([device_serial], reason=reason)
108 with self._devices_lock: 108 with self._devices_lock:
109 self._devices = [d for d in self._devices if str(d) != device_serial] 109 self._devices = [d for d in self._devices if str(d) != device_serial]
110 110
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698