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

Side by Side Diff: build/android/pylib/remote/device/remote_device_test_run.py

Issue 1277943002: [Android] Detect when remote service loses contact with device. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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/pylib/remote/device/remote_device_gtest_run.py ('k') | no next file » | 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 """Run specific test on specific environment.""" 5 """Run specific test on specific environment."""
6 6
7 import json 7 import json
8 import logging 8 import logging
9 import os 9 import os
10 import re
10 import shutil 11 import shutil
11 import string 12 import string
12 import tempfile 13 import tempfile
13 import time 14 import time
14 import zipfile 15 import zipfile
15 16
16 from pylib.base import test_run 17 from pylib.base import test_run
17 from pylib.remote.device import appurify_constants 18 from pylib.remote.device import appurify_constants
18 from pylib.remote.device import appurify_sanitized 19 from pylib.remote.device import appurify_sanitized
19 from pylib.remote.device import remote_device_helper 20 from pylib.remote.device import remote_device_helper
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 330
330 Raises: 331 Raises:
331 KeyError: If appurify_results/logcat.txt file cannot be found in 332 KeyError: If appurify_results/logcat.txt file cannot be found in
332 downloaded zip. 333 downloaded zip.
333 """ 334 """
334 zip_file = self._DownloadTestResults(None) 335 zip_file = self._DownloadTestResults(None)
335 with zipfile.ZipFile(zip_file) as z: 336 with zipfile.ZipFile(zip_file) as z:
336 try: 337 try:
337 logcat = z.read('appurify_results/logcat.txt') 338 logcat = z.read('appurify_results/logcat.txt')
338 printable_logcat = ''.join(c for c in logcat if c in string.printable) 339 printable_logcat = ''.join(c for c in logcat if c in string.printable)
340 logging.log(level, '---Logging remote device logcat---')
jbudorick 2015/08/06 16:31:36 +1
rnephew (Reviews Here) 2015/08/06 16:42:07 Done.
339 for line in printable_logcat.splitlines(): 341 for line in printable_logcat.splitlines():
340 logging.log(level, line) 342 logging.log(level, line)
343 logging.log(level, '---Ending remote device logcat---')
341 except KeyError: 344 except KeyError:
342 logging.error('No logcat found.') 345 logging.error('No logcat found.')
346
347 def _DidDeviceGoOffline(self):
348 device_offline = re.compile('error: device not found')
jbudorick 2015/08/06 16:31:36 This should be compiled into a constant at module
rnephew (Reviews Here) 2015/08/06 16:42:07 Done.
349 zip_file = self._DownloadTestResults(None)
350 with zipfile.ZipFile(zip_file) as z:
351 adb_trace_log = z.read('adb_trace.log')
352 if any(device_offline.search(l) for l in adb_trace_log.splitlines()):
353 logging.critical('---Logging remote device adb trace log---')
jbudorick 2015/08/06 16:31:36 The function name doesn't imply anything about log
rnephew (Reviews Here) 2015/08/06 16:42:07 Done.
354 for line in adb_trace_log.splitlines():
355 logging.critical(line)
356 logging.critical('---Ending remote device adb trace log---')
357 return True
358 return False
OLDNEW
« no previous file with comments | « build/android/pylib/remote/device/remote_device_gtest_run.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698