Chromium Code Reviews| Index: tools/auto_bisect/bisect_perf_regression.py |
| diff --git a/tools/auto_bisect/bisect_perf_regression.py b/tools/auto_bisect/bisect_perf_regression.py |
| index fd63d88f46317127fc1f28c671d27aed94233b93..564d2459d1c5c07bbc7803b34f0c7d8e9d43c40d 100755 |
| --- a/tools/auto_bisect/bisect_perf_regression.py |
| +++ b/tools/auto_bisect/bisect_perf_regression.py |
| @@ -54,6 +54,7 @@ from bisect_results import BisectResults |
| from bisect_state import BisectState |
| import bisect_utils |
| import builder |
| +import query_crbug |
| import math_utils |
| import request_build |
| import source_control |
| @@ -2144,6 +2145,7 @@ class BisectPerformanceMetrics(object): |
| Returns: |
| A BisectResults object. |
| """ |
| + |
| # Choose depot to bisect first |
| target_depot = 'chromium' |
| if self.opts.target_platform == 'android-chrome': |
| @@ -2484,6 +2486,7 @@ class BisectOptions(object): |
| self.builder_port = None |
| self.bisect_mode = bisect_utils.BISECT_MODE_MEAN |
| self.improvement_direction = 0 |
| + self.bug_id = '' |
| @staticmethod |
| def _AddBisectOptionsGroup(parser): |
| @@ -2531,6 +2534,10 @@ class BisectOptions(object): |
| bisect_utils.BISECT_MODE_RETURN_CODE], |
| help='The bisect mode. Choices are to bisect on the ' |
| 'difference in mean, std_dev, or return_code.') |
| + group.add_argument('--bug_id', type=str, default='', |
|
Sergiy Byelozyorov
2014/11/03 13:42:00
No need for type=str and default=''. These are def
|
| + help='The id for the bug associated with this bisect. ' + |
| + 'If this number is given, bisect will attempt to ' + |
|
Sergiy Byelozyorov
2014/11/03 13:42:00
Please align with opening ' on the line before lik
|
| + ' verify that the bug is not closed before starting.') |
|
Sergiy Byelozyorov
2014/11/03 13:42:00
Remove space in the beginning - it is already pres
|
| @staticmethod |
| def _AddBuildOptionsGroup(parser): |
| @@ -2542,12 +2549,12 @@ class BisectOptions(object): |
| 'working_directory and that will be used to perform the ' |
| 'bisection. This parameter is optional, if it is not ' |
| 'supplied, the script will work from the current depot.') |
| - group.add_argument('--build_preference', type='choice', |
| + group.add_argument('--build_preference', type=str, |
|
Sergiy Byelozyorov
2014/11/03 13:42:00
Thanks for fixing it. Please remove type='str' arg
|
| choices=['msvs', 'ninja', 'make'], |
| help='The preferred build system to use. On linux/mac ' |
| 'the options are make/ninja. On Windows, the ' |
| 'options are msvs/ninja.') |
| - group.add_argument('--target_platform', type='choice', default='chromium', |
| + group.add_argument('--target_platform', type=str, default='chromium', |
| choices=['chromium', 'android', 'android-chrome'], |
| help='The target platform. Choices are "chromium" ' |
| '(current platform), or "android". If you specify ' |
| @@ -2572,18 +2579,18 @@ class BisectOptions(object): |
| group.add_argument('--gs_bucket', default='', dest='gs_bucket', |
| help='Name of Google Storage bucket to upload or ' |
| 'download build. e.g., chrome-perf') |
| - group.add_argument('--target_arch', type='choice', default='ia32', |
| + group.add_argument('--target_arch', type=str, default='ia32', |
| dest='target_arch', choices=['ia32', 'x64', 'arm'], |
| help='The target build architecture. Choices are "ia32" ' |
| '(default), "x64" or "arm".') |
| - group.add_argument('--target_build_type', type='choice', default='Release', |
| + group.add_argument('--target_build_type', type=str, default='Release', |
| choices=['Release', 'Debug'], |
| help='The target build type. Choices are "Release" ' |
| '(default), or "Debug".') |
| group.add_argument('--builder_host', dest='builder_host', |
| help='Host address of server to produce build by ' |
| 'posting try job request.') |
| - group.add_argument('--builder_port', dest='builder_port', type='int', |
| + group.add_argument('--builder_port', dest='builder_port', type=int, |
| help='HTTP port of the server to produce build by ' |
| 'posting try job request.') |
| @@ -2600,7 +2607,7 @@ class BisectOptions(object): |
| action='store_true', |
| help='DEBUG: Don\'t score the confidence of the initial ' |
| 'good and bad revisions\' test results.') |
| - group.add_argument('--debug_fake_first_test_mean', type='int', default='0', |
| + group.add_argument('--debug_fake_first_test_mean', type=int, default='0', |
| help='DEBUG: When faking performance tests, return this ' |
| 'value as the mean of the first performance test, ' |
| 'and return a mean of 0.0 for further tests.') |
| @@ -2626,7 +2633,7 @@ class BisectOptions(object): |
| def ParseCommandLine(self): |
| """Parses the command line for bisect options.""" |
| parser = self._CreateCommandLineParser() |
| - opts, _ = parser.parse_args() |
| + opts = parser.parse_args() |
| try: |
| if (not opts.metric and |
| @@ -2707,6 +2714,23 @@ def main(): |
| opts = BisectOptions() |
| opts.ParseCommandLine() |
| + if opts.bug_id: |
| + if opts.output_buildbot_annotations: |
| + bisect_utils.OutputAnnotationStepStart('Checking Issue Tracker') |
| + issue_closed = query_crbug.CheckIssueClosed(opts.bug_id) |
| + if issue_closed: |
| + print 'Aborting bisect because bug is closed' |
| + else: |
| + print 'Could not confirm bug is closed, proceeding.' |
| + if opts.output_buildbot_annotations: |
| + bisect_utils.OutputAnnotationStepClosed() |
| + if issue_closed: |
| + results = BisectResults(abort_reason='the bug is closed.') |
| + bisect_test = BisectPerformanceMetrics(opts, os.getcwd()) |
| + bisect_test.printer.FormatAndPrintResults(results) |
| + return 0 |
| + |
| + |
| if opts.extra_src: |
| extra_src = bisect_utils.LoadExtraSrc(opts.extra_src) |
| if not extra_src: |