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

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

Issue 2163833003: Logdog for logcats (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update logdog revision + test_runner_wrapper for stream name support Created 4 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 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 datetime 5 import datetime
6 import functools 6 import functools
7 import logging 7 import logging
8 import os 8 import os
9 import shutil 9 import shutil
10 import tempfile 10 import tempfile
11 import threading 11 import threading
12 12
13 from devil import base_error 13 from devil import base_error
14 from devil.android import device_blacklist 14 from devil.android import device_blacklist
15 from devil.android import device_errors 15 from devil.android import device_errors
16 from devil.android import device_list 16 from devil.android import device_list
17 from devil.android import device_utils 17 from devil.android import device_utils
18 from devil.android import logcat_monitor 18 from devil.android import logcat_monitor
19 from devil.utils import cmd_helper
19 from devil.utils import file_utils 20 from devil.utils import file_utils
20 from devil.utils import parallelizer 21 from devil.utils import parallelizer
21 from pylib import constants 22 from pylib import constants
22 from pylib.base import environment 23 from pylib.base import environment
23 24
24 25
25 def _DeviceCachePath(device): 26 def _DeviceCachePath(device):
26 file_name = 'device_cache_%s.json' % device.adb.GetDeviceSerial() 27 file_name = 'device_cache_%s.json' % device.adb.GetDeviceSerial()
27 return os.path.join(constants.GetOutDirectory(), file_name) 28 return os.path.join(constants.GetOutDirectory(), file_name)
28 29
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 with open(cache_path, 'w') as f: 182 with open(cache_path, 'w') as f:
182 f.write(d.DumpCacheData()) 183 f.write(d.DumpCacheData())
183 logging.info('Wrote device cache: %s', cache_path) 184 logging.info('Wrote device cache: %s', cache_path)
184 185
185 self.parallel_devices.pMap(tear_down_device) 186 self.parallel_devices.pMap(tear_down_device)
186 187
187 for m in self._logcat_monitors: 188 for m in self._logcat_monitors:
188 try: 189 try:
189 m.Stop() 190 m.Stop()
190 m.Close() 191 m.Close()
192 add_device_args = ['sed', '-i', '-e',
ghost stip (do not use) 2016/07/27 01:14:17 rename to add_device_cmd
nicholaslin 2016/07/27 19:08:05 Done.
193 's/^/device({0}) /'.
194 format(m.adb.GetDeviceSerial()),
195 m.output_file]
196 cmd_helper.RunCmd(add_device_args)
191 except base_error.BaseError: 197 except base_error.BaseError:
192 logging.exception('Failed to stop logcat monitor for %s', 198 logging.exception('Failed to stop logcat monitor for %s',
193 m.adb.GetDeviceSerial()) 199 m.adb.GetDeviceSerial())
194 200
195 if self._logcat_output_file: 201 if self._logcat_output_file:
196 file_utils.MergeFiles( 202 file_utils.MergeFiles(
197 self._logcat_output_file, 203 self._logcat_output_file,
198 [m.output_file for m in self._logcat_monitors]) 204 [m.output_file for m in self._logcat_monitors])
199 shutil.rmtree(self._logcat_output_dir) 205 shutil.rmtree(self._logcat_output_dir)
200 206
201 def BlacklistDevice(self, device, reason='local_device_failure'): 207 def BlacklistDevice(self, device, reason='local_device_failure'):
202 device_serial = device.adb.GetDeviceSerial() 208 device_serial = device.adb.GetDeviceSerial()
203 if self._blacklist: 209 if self._blacklist:
204 self._blacklist.Extend([device_serial], reason=reason) 210 self._blacklist.Extend([device_serial], reason=reason)
205 with self._devices_lock: 211 with self._devices_lock:
206 self._devices = [d for d in self._devices if str(d) != device_serial] 212 self._devices = [d for d in self._devices if str(d) != device_serial]
207 213
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698