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

Side by Side Diff: build/android/pylib/gtest/test_package.py

Issue 16854020: Strip out \r characters from pexpect's log capture before adding the results. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 6 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 5
6 import logging 6 import logging
7 import os 7 import os
8 import re 8 import re
9 9
10 from pylib import constants 10 from pylib import constants
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 while True: 148 while True:
149 full_test_name = None 149 full_test_name = None
150 found = p.expect([re_run, re_passed, re_runner_fail], 150 found = p.expect([re_run, re_passed, re_runner_fail],
151 timeout=self.timeout) 151 timeout=self.timeout)
152 if found == 1: # re_passed 152 if found == 1: # re_passed
153 break 153 break
154 elif found == 2: # re_runner_fail 154 elif found == 2: # re_runner_fail
155 break 155 break
156 else: # re_run 156 else: # re_run
157 full_test_name = p.match.group(1).replace('\r', '') 157 full_test_name = p.match.group(1).replace('\r', '')
158 log = p.before.replace('\r', '')
158 found = p.expect([re_ok, re_fail, re_crash], timeout=self.timeout) 159 found = p.expect([re_ok, re_fail, re_crash], timeout=self.timeout)
159 if found == 0: # re_ok 160 if found == 0: # re_ok
160 if full_test_name == p.match.group(1).replace('\r', ''): 161 if full_test_name == p.match.group(1).replace('\r', ''):
161 results.AddResult(base_test_result.BaseTestResult( 162 results.AddResult(base_test_result.BaseTestResult(
162 full_test_name, base_test_result.ResultType.PASS, 163 full_test_name, base_test_result.ResultType.PASS,
163 log=p.before)) 164 log=log))
164 elif found == 2: # re_crash 165 elif found == 2: # re_crash
165 results.AddResult(base_test_result.BaseTestResult( 166 results.AddResult(base_test_result.BaseTestResult(
166 full_test_name, base_test_result.ResultType.CRASH, 167 full_test_name, base_test_result.ResultType.CRASH,
167 log=p.before)) 168 log=log))
168 break 169 break
169 else: # re_fail 170 else: # re_fail
170 results.AddResult(base_test_result.BaseTestResult( 171 results.AddResult(base_test_result.BaseTestResult(
171 full_test_name, base_test_result.ResultType.FAIL, log=p.before)) 172 full_test_name, base_test_result.ResultType.FAIL, log=log))
172 except pexpect.EOF: 173 except pexpect.EOF:
173 logging.error('Test terminated - EOF') 174 logging.error('Test terminated - EOF')
174 # We're here because either the device went offline, or the test harness 175 # We're here because either the device went offline, or the test harness
175 # crashed without outputting the CRASHED marker (crbug.com/175538). 176 # crashed without outputting the CRASHED marker (crbug.com/175538).
176 if not self.adb.IsOnline(): 177 if not self.adb.IsOnline():
177 raise errors.DeviceUnresponsiveError('Device %s went offline.' % 178 raise errors.DeviceUnresponsiveError('Device %s went offline.' %
178 self.device) 179 self.device)
179 if full_test_name: 180 if full_test_name:
180 results.AddResult(base_test_result.BaseTestResult( 181 results.AddResult(base_test_result.BaseTestResult(
181 full_test_name, base_test_result.ResultType.CRASH, log=p.before)) 182 full_test_name, base_test_result.ResultType.CRASH, log=log))
182 except pexpect.TIMEOUT: 183 except pexpect.TIMEOUT:
183 logging.error('Test terminated after %d second timeout.', 184 logging.error('Test terminated after %d second timeout.',
184 self.timeout) 185 self.timeout)
185 if full_test_name: 186 if full_test_name:
186 results.AddResult(base_test_result.BaseTestResult( 187 results.AddResult(base_test_result.BaseTestResult(
187 full_test_name, base_test_result.ResultType.TIMEOUT, log=p.before)) 188 full_test_name, base_test_result.ResultType.TIMEOUT, log=log))
188 finally: 189 finally:
189 p.close() 190 p.close()
190 191
191 ret_code = self._GetGTestReturnCode() 192 ret_code = self._GetGTestReturnCode()
192 if ret_code: 193 if ret_code:
193 logging.critical( 194 logging.critical(
194 'gtest exit code: %d\npexpect.before: %s\npexpect.after: %s', 195 'gtest exit code: %d\npexpect.before: %s\npexpect.after: %s',
195 ret_code, p.before, p.after) 196 ret_code, p.before, p.after)
196 197
197 return results 198 return results
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