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

Side by Side Diff: scripts/slave/recipe_modules/auto_bisect/revision_state.py

Issue 2224583003: Check if device disconnects every time the last test of a revision fails (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/build.git@master
Patch Set: 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 | « 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 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 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 """An interface for holding state and result of revisions in a bisect job. 5 """An interface for holding state and result of revisions in a bisect job.
6 6
7 When implementing support for tests other than perf, one should extend this 7 When implementing support for tests other than perf, one should extend this
8 class so that the bisect module and recipe can use it. 8 class so that the bisect module and recipe can use it.
9 9
10 See perf_revision_state for an example. 10 See perf_revision_state for an example.
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 'From': lambda *args: None, 178 'From': lambda *args: None,
179 } 179 }
180 return deps_data 180 return deps_data
181 181
182 def _read_content(self, url, file_name, branch): # pragma: no cover 182 def _read_content(self, url, file_name, branch): # pragma: no cover
183 """Uses gitiles recipe module to download and read file contents.""" 183 """Uses gitiles recipe module to download and read file contents."""
184 try: 184 try:
185 return self.bisector.api.m.gitiles.download_file( 185 return self.bisector.api.m.gitiles.download_file(
186 repository_url=url, file_path=file_name, branch=branch) 186 repository_url=url, file_path=file_name, branch=branch)
187 except TypeError: 187 except TypeError:
188 print 'Could not read content for %s/%s/%s' % (url, file_name, branch) 188 print 'Could not read content for %s/%s/%s' % (url, file_name, branch)
189 return None 189 return None
190 190
191 def read_deps(self, recipe_tester_name): 191 def read_deps(self, recipe_tester_name):
192 """Sets the dependencies for this revision from the contents of DEPS.""" 192 """Sets the dependencies for this revision from the contents of DEPS."""
193 api = self.bisector.api 193 api = self.bisector.api
194 if self.deps: 194 if self.deps:
195 return 195 return
196 if self.bisector.internal_bisect: # pragma: no cover 196 if self.bisector.internal_bisect: # pragma: no cover
197 self.deps_file_contents = self._read_content( 197 self.deps_file_contents = self._read_content(
198 depot_config.DEPOT_DEPS_NAME[self.depot_name]['url'], 198 depot_config.DEPOT_DEPS_NAME[self.depot_name]['url'],
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 # stdout of the command, and 'results' is itself a dict with the key 348 # stdout of the command, and 'results' is itself a dict with the key
349 # 'values' unless the test failed, in which case 'results' will contain 349 # 'values' unless the test failed, in which case 'results' will contain
350 # the 'error' key explaining the type of error. 350 # the 'error' key explaining the type of error.
351 results = test_results['results'] 351 results = test_results['results']
352 if results.get('errors'): 352 if results.get('errors'):
353 self.status = RevisionState.FAILED 353 self.status = RevisionState.FAILED
354 if 'MISSING_METRIC' in results.get('errors'): # pragma: no cover 354 if 'MISSING_METRIC' in results.get('errors'): # pragma: no cover
355 self.bisector.surface_result('MISSING_METRIC') 355 self.bisector.surface_result('MISSING_METRIC')
356 return 356 return
357 self.values += results['values'] 357 self.values += results['values']
358 api = self.bisector.api
359 if test_results['retcodes'][-1] != 0 and (
sullivan 2016/08/08 22:13:28 Is test_results['retcodes'] always defined? Is it
RobertoCN 2016/08/08 22:46:42 it will always be a list. And as long as the test
Ziqi Xiong 2016/08/09 18:59:11 Done.
360 api.m.chromium.c.TARGET_PLATFORM == 'android'): #pragma: no cover
361 api.m.chromium_android.device_status()
sullivan 2016/08/08 22:13:28 What does device_status() do?
Ziqi Xiong 2016/08/09 18:59:11 It rechecks the devices connected to host and then
362 current_connected_devices = api.m.chromium_android.devices
363 current_device = api.m.bisect_tester.device_to_test
364 if current_device not in current_connected_devices:
365 raise api.m.step.StepFailure('Test device disconnected.')
358 if self.bisector.is_return_code_mode(): 366 if self.bisector.is_return_code_mode():
359 retcodes = test_results['retcodes'] 367 retcodes = test_results['retcodes']
360 self.overall_return_code = 0 if all(v == 0 for v in retcodes) else 1 368 self.overall_return_code = 0 if all(v == 0 for v in retcodes) else 1
361 # Keeping mean_value for compatibility with dashboard. 369 # Keeping mean_value for compatibility with dashboard.
362 # TODO(robertocn): refactor mean_value, specially when uploading results 370 # TODO(robertocn): refactor mean_value, specially when uploading results
363 # to dashboard. 371 # to dashboard.
364 self.mean_value = self.overall_return_code 372 self.mean_value = self.overall_return_code
365 elif self.values: 373 elif self.values:
366 api = self.bisector.api 374 api = self.bisector.api
367 self.mean_value = api.m.math_utils.mean(self.values) 375 self.mean_value = api.m.math_utils.mean(self.values)
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 else: 595 else:
588 next_revision_to_test.retest() 596 next_revision_to_test.retest()
589 597
590 def __repr__(self): 598 def __repr__(self):
591 if self.overall_return_code is not None: 599 if self.overall_return_code is not None:
592 return ('RevisionState(rev=%s, values=%r, overall_return_code=%r, ' 600 return ('RevisionState(rev=%s, values=%r, overall_return_code=%r, '
593 'std_dev=%r)') % (self.revision_string(), self.values, 601 'std_dev=%r)') % (self.revision_string(), self.values,
594 self.overall_return_code, self.std_dev) 602 self.overall_return_code, self.std_dev)
595 return ('RevisionState(rev=%s, values=%r, mean_value=%r, std_dev=%r)' % ( 603 return ('RevisionState(rev=%s, values=%r, mean_value=%r, std_dev=%r)' % (
596 self.revision_string(), self.values, self.mean_value, self.std_dev)) 604 self.revision_string(), self.values, self.mean_value, self.std_dev))
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