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

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 json files to include links 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
« no previous file with comments | « build/android/BUILD.gn ('k') | build/android/test_wrapper/logdog_wrapper.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 with open(cache_path, 'w') as f: 181 with open(cache_path, 'w') as f:
182 f.write(d.DumpCacheData()) 182 f.write(d.DumpCacheData())
183 logging.info('Wrote device cache: %s', cache_path) 183 logging.info('Wrote device cache: %s', cache_path)
184 184
185 self.parallel_devices.pMap(tear_down_device) 185 self.parallel_devices.pMap(tear_down_device)
186 186
187 for m in self._logcat_monitors: 187 for m in self._logcat_monitors:
188 try: 188 try:
189 m.Stop() 189 m.Stop()
190 m.Close() 190 m.Close()
191 _, temp_path = tempfile.mkstemp()
192 with open(m.output_file, 'r') as infile:
193 with open(temp_path, 'w') as outfile:
194 for line in infile:
195 outfile.write('Device(%s) %s' % (m.adb.GetDeviceSerial(), line))
196 shutil.move(temp_path, m.output_file)
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())
200 except IOError:
201 logging.exception('Failed to locate logcat for device %s',
202 m.adb.GetDeviceSerial())
194 203
195 if self._logcat_output_file: 204 if self._logcat_output_file:
196 file_utils.MergeFiles( 205 file_utils.MergeFiles(
197 self._logcat_output_file, 206 self._logcat_output_file,
198 [m.output_file for m in self._logcat_monitors]) 207 [m.output_file for m in self._logcat_monitors])
199 shutil.rmtree(self._logcat_output_dir) 208 shutil.rmtree(self._logcat_output_dir)
200 209
201 def BlacklistDevice(self, device, reason='local_device_failure'): 210 def BlacklistDevice(self, device, reason='local_device_failure'):
202 device_serial = device.adb.GetDeviceSerial() 211 device_serial = device.adb.GetDeviceSerial()
203 if self._blacklist: 212 if self._blacklist:
204 self._blacklist.Extend([device_serial], reason=reason) 213 self._blacklist.Extend([device_serial], reason=reason)
205 with self._devices_lock: 214 with self._devices_lock:
206 self._devices = [d for d in self._devices if str(d) != device_serial] 215 self._devices = [d for d in self._devices if str(d) != device_serial]
207 216
OLDNEW
« no previous file with comments | « build/android/BUILD.gn ('k') | build/android/test_wrapper/logdog_wrapper.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698