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 2222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2233 | 2233 |
2234 cmd = ['log', '--format=%ct', '-1', bad_revision] | 2234 cmd = ['log', '--format=%ct', '-1', bad_revision] |
2235 output = bisect_utils.CheckRunGit(cmd, cwd=cwd) | 2235 output = bisect_utils.CheckRunGit(cmd, cwd=cwd) |
2236 bad_commit_time = int(output) | 2236 bad_commit_time = int(output) |
2237 | 2237 |
2238 return good_commit_time <= bad_commit_time | 2238 return good_commit_time <= bad_commit_time |
2239 else: | 2239 else: |
2240 # Cros/svn use integers | 2240 # Cros/svn use integers |
2241 return int(good_revision) <= int(bad_revision) | 2241 return int(good_revision) <= int(bad_revision) |
2242 | 2242 |
2243 def CanPerformBisect(self, revision_to_check): | 2243 def CanPerformBisect(self, good_revision, bad_revision): |
2244 """Checks whether a given revision is bisectable. | 2244 """Checks whether a given revision is bisectable. |
2245 | 2245 |
2246 Note: At present it checks whether a given revision is bisectable on | 2246 Checks for following: |
2247 android bots(refer crbug.com/385324). | 2247 1. Non-bisectable revsions for android bots (refer to crbug.com/385324). |
| 2248 2. Non-bisectable revsions for Windows bots (refer to crbug.com/405274). |
2248 | 2249 |
2249 Args: | 2250 Args: |
2250 revision_to_check: Known good revision. | 2251 good_revision: Known good revision. |
| 2252 bad_revision: Known bad revision. |
2251 | 2253 |
2252 Returns: | 2254 Returns: |
2253 A dictionary indicating the result. If revision is not bisectable, | 2255 A dictionary indicating the result. If revision is not bisectable, |
2254 this will contain the field "error", otherwise None. | 2256 this will contain the field "error", otherwise None. |
2255 """ | 2257 """ |
2256 if self.opts.target_platform == 'android': | 2258 if self.opts.target_platform == 'android': |
2257 revision_to_check = self.source_control.SVNFindRev(revision_to_check) | 2259 good_revision = self.source_control.SVNFindRev(good_revision) |
2258 if (bisect_utils.IsStringInt(revision_to_check) | 2260 if (bisect_utils.IsStringInt(good_revision) |
2259 and revision_to_check < 265549): | 2261 and good_revision < 265549): |
2260 return {'error': ( | 2262 return {'error': ( |
2261 'Bisect cannot conitnue for the given revision range.\n' | 2263 'Bisect cannot conitnue for the given revision range.\n' |
2262 'It is impossible to bisect Android regressions ' | 2264 'It is impossible to bisect Android regressions ' |
2263 'prior to r265549, which allows the bisect bot to ' | 2265 'prior to r265549, which allows the bisect bot to ' |
2264 'rely on Telemetry to do apk installation of the most recently ' | 2266 'rely on Telemetry to do apk installation of the most recently ' |
2265 'built local ChromeShell(refer to crbug.com/385324).\n' | 2267 'built local ChromeShell(refer to crbug.com/385324).\n' |
2266 'Please try bisecting revisions greater than or equal to r265549.')} | 2268 'Please try bisecting revisions greater than or equal to r265549.')} |
| 2269 |
| 2270 if bisect_utils.IsWindowsHost(): |
| 2271 good_revision = self.source_control.SVNFindRev(good_revision) |
| 2272 bad_revision = self.source_control.SVNFindRev(bad_revision) |
| 2273 if (bisect_utils.IsStringInt(good_revision) and |
| 2274 bisect_utils.IsStringInt(bad_revision)): |
| 2275 if (289987 <= good_revision < 290716 or |
| 2276 289987 <= bad_revision < 290716): |
| 2277 return {'error': ('Oops! Revision between r289987 and r290716 are ' |
| 2278 'marked as dead zone for Windows due to ' |
| 2279 'crbug.com/405274. Please try another range.')} |
| 2280 |
2267 return None | 2281 return None |
2268 | 2282 |
2269 def Run(self, command_to_run, bad_revision_in, good_revision_in, metric): | 2283 def Run(self, command_to_run, bad_revision_in, good_revision_in, metric): |
2270 """Given known good and bad revisions, run a binary search on all | 2284 """Given known good and bad revisions, run a binary search on all |
2271 intermediate revisions to determine the CL where the performance regression | 2285 intermediate revisions to determine the CL where the performance regression |
2272 occurred. | 2286 occurred. |
2273 | 2287 |
2274 Args: | 2288 Args: |
2275 command_to_run: Specify the command to execute the performance test. | 2289 command_to_run: Specify the command to execute the performance test. |
2276 good_revision: Number/tag of the known good revision. | 2290 good_revision: Number/tag of the known good revision. |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2346 results['error'] = ('bad_revision < good_revision, did you swap these ' | 2360 results['error'] = ('bad_revision < good_revision, did you swap these ' |
2347 'by mistake?') | 2361 'by mistake?') |
2348 return results | 2362 return results |
2349 | 2363 |
2350 bad_revision, good_revision = self.NudgeRevisionsIfDEPSChange( | 2364 bad_revision, good_revision = self.NudgeRevisionsIfDEPSChange( |
2351 bad_revision, good_revision) | 2365 bad_revision, good_revision) |
2352 | 2366 |
2353 if self.opts.output_buildbot_annotations: | 2367 if self.opts.output_buildbot_annotations: |
2354 bisect_utils.OutputAnnotationStepStart('Gathering Revisions') | 2368 bisect_utils.OutputAnnotationStepStart('Gathering Revisions') |
2355 | 2369 |
2356 cannot_bisect = self.CanPerformBisect(good_revision) | 2370 cannot_bisect = self.CanPerformBisect(good_revision, bad_revision) |
2357 if cannot_bisect: | 2371 if cannot_bisect: |
2358 results['error'] = cannot_bisect.get('error') | 2372 results['error'] = cannot_bisect.get('error') |
2359 return results | 2373 return results |
2360 | 2374 |
2361 print 'Gathering revision range for bisection.' | 2375 print 'Gathering revision range for bisection.' |
2362 # Retrieve a list of revisions to do bisection on. | 2376 # Retrieve a list of revisions to do bisection on. |
2363 src_revision_list = self.GetRevisionList( | 2377 src_revision_list = self.GetRevisionList( |
2364 target_depot, bad_revision, good_revision) | 2378 target_depot, bad_revision, good_revision) |
2365 | 2379 |
2366 if self.opts.output_buildbot_annotations: | 2380 if self.opts.output_buildbot_annotations: |
(...skipping 989 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3356 # bugs. If you change this, please update the perf dashboard as well. | 3370 # bugs. If you change this, please update the perf dashboard as well. |
3357 bisect_utils.OutputAnnotationStepStart('Results') | 3371 bisect_utils.OutputAnnotationStepStart('Results') |
3358 print 'Error: %s' % e.message | 3372 print 'Error: %s' % e.message |
3359 if opts.output_buildbot_annotations: | 3373 if opts.output_buildbot_annotations: |
3360 bisect_utils.OutputAnnotationStepClosed() | 3374 bisect_utils.OutputAnnotationStepClosed() |
3361 return 1 | 3375 return 1 |
3362 | 3376 |
3363 | 3377 |
3364 if __name__ == '__main__': | 3378 if __name__ == '__main__': |
3365 sys.exit(main()) | 3379 sys.exit(main()) |
OLD | NEW |