OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Performance Test Bisect Tool | 6 """Performance Test Bisect Tool |
7 | 7 |
8 This script bisects a series of changelists using binary search. It starts at | 8 This script bisects a series of changelists using binary search. It starts at |
9 a bad revision where a performance metric has regressed, and asks for a last | 9 a bad revision where a performance metric has regressed, and asks for a last |
10 known-good revision. It will then binary search across this revision range by | 10 known-good revision. It will then binary search across this revision range by |
(...skipping 2955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2966 | 2966 |
2967 cmd = ['log', '--format=%ct', '-1', bad_revision] | 2967 cmd = ['log', '--format=%ct', '-1', bad_revision] |
2968 output = CheckRunGit(cmd, cwd=cwd) | 2968 output = CheckRunGit(cmd, cwd=cwd) |
2969 bad_commit_time = int(output) | 2969 bad_commit_time = int(output) |
2970 | 2970 |
2971 return good_commit_time <= bad_commit_time | 2971 return good_commit_time <= bad_commit_time |
2972 else: | 2972 else: |
2973 # Cros/svn use integers | 2973 # Cros/svn use integers |
2974 return int(good_revision) <= int(bad_revision) | 2974 return int(good_revision) <= int(bad_revision) |
2975 | 2975 |
| 2976 def CanPerformBisect(self, revision_to_check): |
| 2977 """Checks whether a given revision is bisectable. |
| 2978 |
| 2979 Note: At present it checks whether a given revision is bisectable on |
| 2980 android bots(refer crbug.com/385324). |
| 2981 |
| 2982 Args: |
| 2983 revision_to_check: Known good revision. |
| 2984 |
| 2985 Returns: |
| 2986 A dictionary indicating the result. If revision is not bisectable, |
| 2987 this will contain the field "error", otherwise None. |
| 2988 """ |
| 2989 if self.opts.target_platform == 'android': |
| 2990 revision_to_check = self.source_control.SVNFindRev(revision_to_check) |
| 2991 if IsStringInt(revision_to_check) and revision_to_check < 265549: |
| 2992 return {'error': ( |
| 2993 'Bisect cannot conitnue for the given revision range.\n' |
| 2994 'It is impossible to bisect Android regressions ' |
| 2995 'prior to r265549, which allows the bisect bot to ' |
| 2996 'rely on Telemetry to do apk installation of the most recently ' |
| 2997 'built local ChromeShell(refer to crbug.com/385324).\n' |
| 2998 'Please try bisecting revisions greater than or equal to r265549.')} |
| 2999 return None |
| 3000 |
2976 def Run(self, command_to_run, bad_revision_in, good_revision_in, metric): | 3001 def Run(self, command_to_run, bad_revision_in, good_revision_in, metric): |
2977 """Given known good and bad revisions, run a binary search on all | 3002 """Given known good and bad revisions, run a binary search on all |
2978 intermediate revisions to determine the CL where the performance regression | 3003 intermediate revisions to determine the CL where the performance regression |
2979 occurred. | 3004 occurred. |
2980 | 3005 |
2981 Args: | 3006 Args: |
2982 command_to_run: Specify the command to execute the performance test. | 3007 command_to_run: Specify the command to execute the performance test. |
2983 good_revision: Number/tag of the known good revision. | 3008 good_revision: Number/tag of the known good revision. |
2984 bad_revision: Number/tag of the known bad revision. | 3009 bad_revision: Number/tag of the known bad revision. |
2985 metric: The performance metric to monitor. | 3010 metric: The performance metric to monitor. |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3052 results['error'] = 'bad_revision < good_revision, did you swap these '\ | 3077 results['error'] = 'bad_revision < good_revision, did you swap these '\ |
3053 'by mistake?' | 3078 'by mistake?' |
3054 return results | 3079 return results |
3055 | 3080 |
3056 (bad_revision, good_revision) = self.NudgeRevisionsIfDEPSChange( | 3081 (bad_revision, good_revision) = self.NudgeRevisionsIfDEPSChange( |
3057 bad_revision, good_revision) | 3082 bad_revision, good_revision) |
3058 | 3083 |
3059 if self.opts.output_buildbot_annotations: | 3084 if self.opts.output_buildbot_annotations: |
3060 bisect_utils.OutputAnnotationStepStart('Gathering Revisions') | 3085 bisect_utils.OutputAnnotationStepStart('Gathering Revisions') |
3061 | 3086 |
| 3087 cannot_bisect = self.CanPerformBisect(good_revision) |
| 3088 if cannot_bisect: |
| 3089 results['error'] = cannot_bisect.get('error') |
| 3090 return results |
| 3091 |
3062 print 'Gathering revision range for bisection.' | 3092 print 'Gathering revision range for bisection.' |
3063 # Retrieve a list of revisions to do bisection on. | 3093 # Retrieve a list of revisions to do bisection on. |
3064 src_revision_list = self.GetRevisionList(target_depot, | 3094 src_revision_list = self.GetRevisionList(target_depot, |
3065 bad_revision, | 3095 bad_revision, |
3066 good_revision) | 3096 good_revision) |
3067 | 3097 |
3068 if self.opts.output_buildbot_annotations: | 3098 if self.opts.output_buildbot_annotations: |
3069 bisect_utils.OutputAnnotationStepClosed() | 3099 bisect_utils.OutputAnnotationStepClosed() |
3070 | 3100 |
3071 if src_revision_list: | 3101 if src_revision_list: |
(...skipping 1074 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4146 # The perf dashboard scrapes the "results" step in order to comment on | 4176 # The perf dashboard scrapes the "results" step in order to comment on |
4147 # bugs. If you change this, please update the perf dashboard as well. | 4177 # bugs. If you change this, please update the perf dashboard as well. |
4148 bisect_utils.OutputAnnotationStepStart('Results') | 4178 bisect_utils.OutputAnnotationStepStart('Results') |
4149 print 'Error: %s' % e.message | 4179 print 'Error: %s' % e.message |
4150 if opts.output_buildbot_annotations: | 4180 if opts.output_buildbot_annotations: |
4151 bisect_utils.OutputAnnotationStepClosed() | 4181 bisect_utils.OutputAnnotationStepClosed() |
4152 return 1 | 4182 return 1 |
4153 | 4183 |
4154 if __name__ == '__main__': | 4184 if __name__ == '__main__': |
4155 sys.exit(main()) | 4185 sys.exit(main()) |
OLD | NEW |