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 1409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1420 # angle.git@[a-fA-F0-9]{40}$ and replace git hash. | 1420 # angle.git@[a-fA-F0-9]{40}$ and replace git hash. |
1421 if depot == 'angle': | 1421 if depot == 'angle': |
1422 return _UpdateDEPSForAngle(revision, depot, deps_file) | 1422 return _UpdateDEPSForAngle(revision, depot, deps_file) |
1423 | 1423 |
1424 try: | 1424 try: |
1425 deps_contents = ReadStringFromFile(deps_file) | 1425 deps_contents = ReadStringFromFile(deps_file) |
1426 # Check whether the depot and revision pattern in DEPS file vars | 1426 # Check whether the depot and revision pattern in DEPS file vars |
1427 # e.g. for webkit the format is "webkit_revision": "12345". | 1427 # e.g. for webkit the format is "webkit_revision": "12345". |
1428 deps_revision = re.compile(r'(?<="%s": ")([0-9]+)(?=")' % deps_var, | 1428 deps_revision = re.compile(r'(?<="%s": ")([0-9]+)(?=")' % deps_var, |
1429 re.MULTILINE) | 1429 re.MULTILINE) |
1430 match = re.search(deps_revision, deps_contents) | 1430 new_data = None |
1431 if match: | 1431 if re.search(deps_revision, deps_contents): |
1432 svn_revision = self.source_control.SVNFindRev( | 1432 svn_revision = self.source_control.SVNFindRev( |
1433 revision, self._GetDepotDirectory(depot)) | 1433 revision, self._GetDepotDirectory(depot)) |
1434 if not svn_revision: | 1434 if not svn_revision: |
1435 print 'Could not determine SVN revision for %s' % revision | 1435 print 'Could not determine SVN revision for %s' % revision |
1436 return False | 1436 return False |
1437 # Update the revision information for the given depot | 1437 # Update the revision information for the given depot |
1438 new_data = re.sub(deps_revision, str(svn_revision), deps_contents) | 1438 new_data = re.sub(deps_revision, str(svn_revision), deps_contents) |
1439 else: | |
1440 # Check whether the depot and revision pattern in DEPS file vars | |
1441 # e.g. for webkit the format is "webkit_revision": "559a6d4ab7a84c539..". | |
1442 deps_revision = re.compile( | |
1443 r'(?<=[",\']%s[",\']: [",\'])([a-fA-F0-9]{40})(?=[",\'])' % | |
qyearsley
2014/09/03 01:40:36
1. The character class [",\'] in this regex matche
prasadv
2014/09/03 22:10:14
Done.
| |
1444 deps_var, | |
1445 re.MULTILINE) | |
1446 if re.search(deps_revision, deps_contents): | |
1447 new_data = re.sub(deps_revision, revision, deps_contents) | |
1439 | 1448 |
1449 if new_data: | |
1440 # For v8_bleeding_edge revisions change V8 branch in order | 1450 # For v8_bleeding_edge revisions change V8 branch in order |
1441 # to fetch bleeding edge revision. | 1451 # to fetch bleeding edge revision. |
1442 if depot == 'v8_bleeding_edge': | 1452 if depot == 'v8_bleeding_edge': |
1443 new_data = _UpdateV8Branch(new_data) | 1453 new_data = _UpdateV8Branch(new_data) |
1444 if not new_data: | 1454 if not new_data: |
1445 return False | 1455 return False |
qyearsley
2014/09/03 01:40:36
Refactoring suggestion:
Everything in between lin
prasadv
2014/09/03 22:10:14
Done.
| |
1446 # Write changes to DEPS file | 1456 # Write changes to DEPS file |
1447 WriteStringToFile(new_data, deps_file) | 1457 WriteStringToFile(new_data, deps_file) |
1448 return True | 1458 return True |
1449 except IOError, e: | 1459 except IOError, e: |
1450 print 'Something went wrong while updating DEPS file. [%s]' % e | 1460 print 'Something went wrong while updating DEPS file. [%s]' % e |
1451 return False | 1461 return False |
1452 | 1462 |
1453 def CreateDEPSPatch(self, depot, revision): | 1463 def CreateDEPSPatch(self, depot, revision): |
1454 """Modifies DEPS and returns diff as text. | 1464 """Modifies DEPS and returns diff as text. |
1455 | 1465 |
(...skipping 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2461 if min_revision_data['passed'] == '?': | 2471 if min_revision_data['passed'] == '?': |
2462 next_revision_index = min_revision | 2472 next_revision_index = min_revision |
2463 elif max_revision_data['passed'] == '?': | 2473 elif max_revision_data['passed'] == '?': |
2464 next_revision_index = max_revision | 2474 next_revision_index = max_revision |
2465 elif current_depot in ['android-chrome', 'cros', 'chromium', 'v8']: | 2475 elif current_depot in ['android-chrome', 'cros', 'chromium', 'v8']: |
2466 previous_revision = revision_list[min_revision] | 2476 previous_revision = revision_list[min_revision] |
2467 # If there were changes to any of the external libraries we track, | 2477 # If there were changes to any of the external libraries we track, |
2468 # should bisect the changes there as well. | 2478 # should bisect the changes there as well. |
2469 external_depot = self._FindNextDepotToBisect( | 2479 external_depot = self._FindNextDepotToBisect( |
2470 current_depot, min_revision_data, max_revision_data) | 2480 current_depot, min_revision_data, max_revision_data) |
2471 | |
2472 # If there was no change in any of the external depots, the search | 2481 # If there was no change in any of the external depots, the search |
2473 # is over. | 2482 # is over. |
2474 if not external_depot: | 2483 if not external_depot: |
2475 if current_depot == 'v8': | 2484 if current_depot == 'v8': |
2476 self.warnings.append('Unfortunately, V8 bisection couldn\'t ' | 2485 self.warnings.append('Unfortunately, V8 bisection couldn\'t ' |
2477 'continue any further. The script can only bisect into ' | 2486 'continue any further. The script can only bisect into ' |
2478 'V8\'s bleeding_edge repository if both the current and ' | 2487 'V8\'s bleeding_edge repository if both the current and ' |
2479 'previous revisions in trunk map directly to revisions in ' | 2488 'previous revisions in trunk map directly to revisions in ' |
2480 'bleeding_edge.') | 2489 'bleeding_edge.') |
2481 break | 2490 break |
(...skipping 877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3359 # bugs. If you change this, please update the perf dashboard as well. | 3368 # bugs. If you change this, please update the perf dashboard as well. |
3360 bisect_utils.OutputAnnotationStepStart('Results') | 3369 bisect_utils.OutputAnnotationStepStart('Results') |
3361 print 'Error: %s' % e.message | 3370 print 'Error: %s' % e.message |
3362 if opts.output_buildbot_annotations: | 3371 if opts.output_buildbot_annotations: |
3363 bisect_utils.OutputAnnotationStepClosed() | 3372 bisect_utils.OutputAnnotationStepClosed() |
3364 return 1 | 3373 return 1 |
3365 | 3374 |
3366 | 3375 |
3367 if __name__ == '__main__': | 3376 if __name__ == '__main__': |
3368 sys.exit(main()) | 3377 sys.exit(main()) |
OLD | NEW |