| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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.get('retcodes') and test_results['retcodes'][-1] != 0 and ( |
| 360 api.m.chromium.c.TARGET_PLATFORM == 'android'): #pragma: no cover |
| 361 api.m.chromium_android.device_status() |
| 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 # We need to manually raise step failure here because we are catching |
| 366 # them further down the line to enable return_code bisects and bisecting |
| 367 # on benchmarks that are a little flaky. |
| 368 raise api.m.step.StepFailure('Test device disconnected.') |
| 358 if self.bisector.is_return_code_mode(): | 369 if self.bisector.is_return_code_mode(): |
| 359 retcodes = test_results['retcodes'] | 370 retcodes = test_results['retcodes'] |
| 360 self.overall_return_code = 0 if all(v == 0 for v in retcodes) else 1 | 371 self.overall_return_code = 0 if all(v == 0 for v in retcodes) else 1 |
| 361 # Keeping mean_value for compatibility with dashboard. | 372 # Keeping mean_value for compatibility with dashboard. |
| 362 # TODO(robertocn): refactor mean_value, specially when uploading results | 373 # TODO(robertocn): refactor mean_value, specially when uploading results |
| 363 # to dashboard. | 374 # to dashboard. |
| 364 self.mean_value = self.overall_return_code | 375 self.mean_value = self.overall_return_code |
| 365 elif self.values: | 376 elif self.values: |
| 366 api = self.bisector.api | 377 api = self.bisector.api |
| 367 self.mean_value = api.m.math_utils.mean(self.values) | 378 self.mean_value = api.m.math_utils.mean(self.values) |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 587 else: | 598 else: |
| 588 next_revision_to_test.retest() | 599 next_revision_to_test.retest() |
| 589 | 600 |
| 590 def __repr__(self): | 601 def __repr__(self): |
| 591 if self.overall_return_code is not None: | 602 if self.overall_return_code is not None: |
| 592 return ('RevisionState(rev=%s, values=%r, overall_return_code=%r, ' | 603 return ('RevisionState(rev=%s, values=%r, overall_return_code=%r, ' |
| 593 'std_dev=%r)') % (self.revision_string(), self.values, | 604 'std_dev=%r)') % (self.revision_string(), self.values, |
| 594 self.overall_return_code, self.std_dev) | 605 self.overall_return_code, self.std_dev) |
| 595 return ('RevisionState(rev=%s, values=%r, mean_value=%r, std_dev=%r)' % ( | 606 return ('RevisionState(rev=%s, values=%r, mean_value=%r, std_dev=%r)' % ( |
| 596 self.revision_string(), self.values, self.mean_value, self.std_dev)) | 607 self.revision_string(), self.values, self.mean_value, self.std_dev)) |
| OLD | NEW |