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

Side by Side Diff: build/android/pylib/android_commands.py

Issue 12035016: Android: fixes timeout for WaitForLogMatch. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 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 """Provides an interface to communicate with the device via the adb command. 5 """Provides an interface to communicate with the device via the adb command.
6 6
7 Assumes adb binary is currently on system path. 7 Assumes adb binary is currently on system path.
8 """ 8 """
9 9
10 import collections 10 import collections
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after
771 assert build_type 771 assert build_type
772 return build_type 772 return build_type
773 773
774 def StartMonitoringLogcat(self, clear=True, timeout=10, logfile=None, 774 def StartMonitoringLogcat(self, clear=True, timeout=10, logfile=None,
775 filters=None): 775 filters=None):
776 """Starts monitoring the output of logcat, for use with WaitForLogMatch. 776 """Starts monitoring the output of logcat, for use with WaitForLogMatch.
777 777
778 Args: 778 Args:
779 clear: If True the existing logcat output will be cleared, to avoiding 779 clear: If True the existing logcat output will be cleared, to avoiding
780 matching historical output lurking in the log. 780 matching historical output lurking in the log.
781 timeout: How long WaitForLogMatch will wait for the given match 781 timeout: How long WaitForLogMatch will wait for the given match
Sami 2013/01/22 01:37:25 It seems like we could get rid of the timeout argu
bulach 2013/01/22 01:55:58 as discussed, deprecating this parameter and creat
782 filters: A list of logcat filters to be used. 782 filters: A list of logcat filters to be used.
783 """ 783 """
784 if clear: 784 if clear:
785 self.RunShellCommand('logcat -c') 785 self.RunShellCommand('logcat -c')
786 args = [] 786 args = []
787 if self._adb._target_arg: 787 if self._adb._target_arg:
788 args += shlex.split(self._adb._target_arg) 788 args += shlex.split(self._adb._target_arg)
789 args += ['logcat', '-v', 'threadtime'] 789 args += ['logcat', '-v', 'threadtime']
790 if filters: 790 if filters:
791 args.extend(filters) 791 args.extend(filters)
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
833 """ 833 """
834 logging.info('<<< Waiting for logcat:' + str(success_re.pattern)) 834 logging.info('<<< Waiting for logcat:' + str(success_re.pattern))
835 t0 = time.time() 835 t0 = time.time()
836 while True: 836 while True:
837 if not self._logcat: 837 if not self._logcat:
838 self.StartMonitoringLogcat(clear, timeout=timeout) 838 self.StartMonitoringLogcat(clear, timeout=timeout)
839 try: 839 try:
840 while True: 840 while True:
841 # Note this will block for upto the timeout _per log line_, so we need 841 # Note this will block for upto the timeout _per log line_, so we need
842 # to calculate the overall timeout remaining since t0. 842 # to calculate the overall timeout remaining since t0.
843 time_remaining = t0 + self._logcat.timeout - time.time() 843 time_remaining = t0 + timeout - time.time()
844 if time_remaining < 0: raise pexpect.TIMEOUT(self._logcat) 844 if time_remaining < 0: raise pexpect.TIMEOUT(self._logcat)
845 self._logcat.expect(PEXPECT_LINE_RE, timeout=time_remaining) 845 self._logcat.expect(PEXPECT_LINE_RE, timeout=time_remaining)
846 line = self._logcat.match.group(1) 846 line = self._logcat.match.group(1)
847 if error_re: 847 if error_re:
848 error_match = error_re.search(line) 848 error_match = error_re.search(line)
849 if error_match: 849 if error_match:
850 return None 850 return None
851 success_match = success_re.search(line) 851 success_match = success_re.search(line)
852 if success_match: 852 if success_match:
853 return success_match 853 return success_match
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
1146 """ 1146 """
1147 def __init__(self, output): 1147 def __init__(self, output):
1148 self._output = output 1148 self._output = output
1149 1149
1150 def write(self, data): 1150 def write(self, data):
1151 data = data.replace('\r\r\n', '\n') 1151 data = data.replace('\r\r\n', '\n')
1152 self._output.write(data) 1152 self._output.write(data)
1153 1153
1154 def flush(self): 1154 def flush(self):
1155 self._output.flush() 1155 self._output.flush()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698