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

Side by Side Diff: ios/build/bots/scripts/xctest_utils.py

Issue 2805133005: Support running eg tests with xctestrun file on devices. (Closed)
Patch Set: test-filter Created 3 years, 8 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 | « ios/build/bots/scripts/test_runner.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 (c) 2016 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2016 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 json 5 import json
6 import os 6 import os
7 import re 7 import re
8 import tempfile 8 import tempfile
9 9
10 10
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 self._current_test = '' 205 self._current_test = ''
206 return 206 return
207 207
208 # Is it the start of a test? 208 # Is it the start of a test?
209 results = self._test_start.match(line) 209 results = self._test_start.match(line)
210 if results: 210 if results:
211 if self._current_test: 211 if self._current_test:
212 if self._test_status[self._current_test][0] == 'started': 212 if self._test_status[self._current_test][0] == 'started':
213 self._test_status[self._current_test] = ( 213 self._test_status[self._current_test] = (
214 'timeout', self._failure_description) 214 'timeout', self._failure_description)
215 test_name = '%s.%s' % (results.group(1), results.group(2)) 215 test_name = '%s/%s' % (results.group(1), results.group(2))
216 self._test_status[test_name] = ('started', ['Did not complete.']) 216 self._test_status[test_name] = ('started', ['Did not complete.'])
217 self._current_test = test_name 217 self._current_test = test_name
218 if self.retrying_failed: 218 if self.retrying_failed:
219 self._failure_description = self._test_status[test_name][1] 219 self._failure_description = self._test_status[test_name][1]
220 self._failure_description.extend(['', 'RETRY OUTPUT:', '']) 220 self._failure_description.extend(['', 'RETRY OUTPUT:', ''])
221 else: 221 else:
222 self._failure_description = [] 222 self._failure_description = []
223 return 223 return
224 224
225 # Is it a test success line? 225 # Is it a test success line?
226 results = self._test_ok.match(line) 226 results = self._test_ok.match(line)
227 if results: 227 if results:
228 test_name = '%s.%s' % (results.group(1), results.group(2)) 228 test_name = '%s/%s' % (results.group(1), results.group(2))
229 status = self._StatusOfTest(test_name) 229 status = self._StatusOfTest(test_name)
230 if status != 'started': 230 if status != 'started':
231 self._RecordError(line, 'success while in status %s' % status) 231 self._RecordError(line, 'success while in status %s' % status)
232 if self.retrying_failed: 232 if self.retrying_failed:
233 self._test_status[test_name] = ('warning', self._failure_description) 233 self._test_status[test_name] = ('warning', self._failure_description)
234 else: 234 else:
235 self._test_status[test_name] = ('OK', []) 235 self._test_status[test_name] = ('OK', [])
236 self._failure_description = [] 236 self._failure_description = []
237 self._current_test = '' 237 self._current_test = ''
238 return 238 return
239 239
240 # Is it a test failure line? 240 # Is it a test failure line?
241 results = self._test_fail.match(line) 241 results = self._test_fail.match(line)
242 if results: 242 if results:
243 test_name = '%s.%s' % (results.group(1), results.group(2)) 243 test_name = '%s/%s' % (results.group(1), results.group(2))
244 status = self._StatusOfTest(test_name) 244 status = self._StatusOfTest(test_name)
245 if status not in ('started', 'failed', 'timeout'): 245 if status not in ('started', 'failed', 'timeout'):
246 self._RecordError(line, 'failure while in status %s' % status) 246 self._RecordError(line, 'failure while in status %s' % status)
247 # Don't overwrite the failure description when a failing test is listed a 247 # Don't overwrite the failure description when a failing test is listed a
248 # second time in the summary, or if it was already recorded as timing 248 # second time in the summary, or if it was already recorded as timing
249 # out. 249 # out.
250 if status not in ('failed', 'timeout'): 250 if status not in ('failed', 'timeout'):
251 self._test_status[test_name] = ('failed', self._failure_description) 251 self._test_status[test_name] = ('failed', self._failure_description)
252 self._failure_description = [] 252 self._failure_description = []
253 self._current_test = '' 253 self._current_test = ''
254 return 254 return
255 255
256 # Is it the start of the retry tests? 256 # Is it the start of the retry tests?
257 results = self._retry_message.match(line) 257 results = self._retry_message.match(line)
258 if results: 258 if results:
259 self.retrying_failed = True 259 self.retrying_failed = True
260 return 260 return
261 261
262 # Random line: if we're in a test, collect it for the failure description. 262 # Random line: if we're in a test, collect it for the failure description.
263 # Tests may run simultaneously, so this might be off, but it's worth a try. 263 # Tests may run simultaneously, so this might be off, but it's worth a try.
264 # This also won't work if a test times out before it begins running. 264 # This also won't work if a test times out before it begins running.
265 if self._current_test: 265 if self._current_test:
266 self._failure_description.append(line) 266 self._failure_description.append(line)
OLDNEW
« no previous file with comments | « ios/build/bots/scripts/test_runner.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698