| 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 import json | 5 import json |
| 6 import re | 6 import re |
| 7 import time | 7 import time |
| 8 import urllib | 8 import urllib |
| 9 | 9 |
| 10 from . import depot_config | 10 from . import depot_config |
| (...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 if i < len(self.revisions) - 1: | 439 if i < len(self.revisions) - 1: |
| 440 self.revisions[i].next_revision = self.revisions[i + 1] | 440 self.revisions[i].next_revision = self.revisions[i + 1] |
| 441 | 441 |
| 442 def check_improvement_direction(self): # pragma: no cover | 442 def check_improvement_direction(self): # pragma: no cover |
| 443 """Verifies that the change from 'good' to 'bad' is in the right direction. | 443 """Verifies that the change from 'good' to 'bad' is in the right direction. |
| 444 | 444 |
| 445 The change between the test results obtained for the given 'good' and | 445 The change between the test results obtained for the given 'good' and |
| 446 'bad' revisions is expected to be considered a regression. The | 446 'bad' revisions is expected to be considered a regression. The |
| 447 `improvement_direction` attribute is positive if a larger number is | 447 `improvement_direction` attribute is positive if a larger number is |
| 448 considered better, and negative if a smaller number is considered better. | 448 considered better, and negative if a smaller number is considered better. |
| 449 |
| 450 Returns: |
| 451 True if the check passes (i.e. no problem), False if the change is not |
| 452 a regression according to the improvement direction. |
| 449 """ | 453 """ |
| 450 good = self.good_rev.mean_value | 454 good = self.good_rev.mean_value |
| 451 bad = self.bad_rev.mean_value | 455 bad = self.bad_rev.mean_value |
| 452 | 456 |
| 453 if self.is_return_code_mode(): | 457 if self.is_return_code_mode(): |
| 454 if good == 1 or bad == 0: | |
| 455 self._set_failed_return_code_direction_results() | |
| 456 return False | |
| 457 return True | 458 return True |
| 458 | 459 |
| 459 direction = self.improvement_direction | 460 direction = self.improvement_direction |
| 460 if direction is None: | 461 if direction is None: |
| 461 return True | 462 return True |
| 462 if (bad > good and direction > 0) or (bad < good and direction < 0): | 463 if (bad > good and direction > 0) or (bad < good and direction < 0): |
| 463 self._set_failed_direction_results() | 464 self._set_failed_direction_results() |
| 464 return False | 465 return False |
| 465 return True | 466 return True |
| 466 | 467 |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 843 }) | 844 }) |
| 844 return revision_rows | 845 return revision_rows |
| 845 | 846 |
| 846 def _get_build_url(self): | 847 def _get_build_url(self): |
| 847 properties = self.api.m.properties | 848 properties = self.api.m.properties |
| 848 bot_url = properties.get('buildbotURL', | 849 bot_url = properties.get('buildbotURL', |
| 849 'http://build.chromium.org/p/chromium/') | 850 'http://build.chromium.org/p/chromium/') |
| 850 builder_name = urllib.quote(properties.get('buildername', '')) | 851 builder_name = urllib.quote(properties.get('buildername', '')) |
| 851 builder_number = str(properties.get('buildnumber', '')) | 852 builder_number = str(properties.get('buildnumber', '')) |
| 852 return '%sbuilders/%s/builds/%s' % (bot_url, builder_name, builder_number) | 853 return '%sbuilders/%s/builds/%s' % (bot_url, builder_name, builder_number) |
| OLD | NEW |