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 1487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1498 elapsed_time = time.time() - start_time | 1498 elapsed_time = time.time() - start_time |
1499 if elapsed_time > build_timeout: | 1499 if elapsed_time > build_timeout: |
1500 raise RuntimeError('Timed out while waiting %ds for %s build.' % | 1500 raise RuntimeError('Timed out while waiting %ds for %s build.' % |
1501 (build_timeout, revision)) | 1501 (build_timeout, revision)) |
1502 print ('Time elapsed: %ss, still waiting for %s build' % | 1502 print ('Time elapsed: %ss, still waiting for %s build' % |
1503 (elapsed_time, revision)) | 1503 (elapsed_time, revision)) |
1504 time.sleep(poll_interval) | 1504 time.sleep(poll_interval) |
1505 return False | 1505 return False |
1506 | 1506 |
1507 def IsDownloadable(self, depot): | 1507 def IsDownloadable(self, depot): |
1508 """Checks if we can download builds for the depot from cloud.""" | 1508 """Checks if build is downloadable based on target platform and depot.""" |
1509 return (depot == 'chromium' or 'chromium' in DEPOT_DEPS_NAME[depot]['from'] | 1509 if self.opts.target_platform in ['chromium'] and self.opts.gs_bucket: |
1510 or 'v8' in DEPOT_DEPS_NAME[depot]['from']) | 1510 return (depot == 'chromium' or |
1511 'chromium' in DEPOT_DEPS_NAME[depot]['from'] or | |
1512 'v8' in DEPOT_DEPS_NAME[depot]['from']) | |
1513 return False | |
qyearsley
2014/04/10 19:14:46
I guess this could theoretically also be written a
| |
1511 | 1514 |
1512 def UpdateDeps(self, revision, depot, deps_file): | 1515 def UpdateDeps(self, revision, depot, deps_file): |
1513 """Updates DEPS file with new revision of dependency repository. | 1516 """Updates DEPS file with new revision of dependency repository. |
1514 | 1517 |
1515 This method search DEPS for a particular pattern in which depot revision | 1518 This method search DEPS for a particular pattern in which depot revision |
1516 is specified (e.g "webkit_revision": "123456"). If a match is found then | 1519 is specified (e.g "webkit_revision": "123456"). If a match is found then |
1517 it resolves the given git hash to SVN revision and replace it in DEPS file. | 1520 it resolves the given git hash to SVN revision and replace it in DEPS file. |
1518 | 1521 |
1519 Args: | 1522 Args: |
1520 revision: A git hash revision of the dependency repository. | 1523 revision: A git hash revision of the dependency repository. |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1687 | 1690 |
1688 Returns: | 1691 Returns: |
1689 True if the build was successful. | 1692 True if the build was successful. |
1690 """ | 1693 """ |
1691 if self.opts.debug_ignore_build: | 1694 if self.opts.debug_ignore_build: |
1692 return True | 1695 return True |
1693 cwd = os.getcwd() | 1696 cwd = os.getcwd() |
1694 os.chdir(self.src_cwd) | 1697 os.chdir(self.src_cwd) |
1695 # Fetch build archive for the given revision from the cloud storage when | 1698 # Fetch build archive for the given revision from the cloud storage when |
1696 # the storage bucket is passed. | 1699 # the storage bucket is passed. |
1697 if self.IsDownloadable(depot) and self.opts.gs_bucket and revision: | 1700 if self.IsDownloadable(depot) and revision: |
1698 deps_patch = None | 1701 deps_patch = None |
1699 if depot != 'chromium': | 1702 if depot != 'chromium': |
1700 # Create a DEPS patch with new revision for dependency repository. | 1703 # Create a DEPS patch with new revision for dependency repository. |
1701 (revision, deps_patch) = self.CreateDEPSPatch(depot, revision) | 1704 (revision, deps_patch) = self.CreateDEPSPatch(depot, revision) |
1702 # Get SVN revision for the given SHA, since builds are archived using SVN | 1705 # Get SVN revision for the given SHA, since builds are archived using SVN |
1703 # revision. | 1706 # revision. |
1704 chromium_revision = self.source_control.SVNFindRev(revision) | 1707 chromium_revision = self.source_control.SVNFindRev(revision) |
1705 if not chromium_revision: | 1708 if not chromium_revision: |
1706 raise RuntimeError( | 1709 raise RuntimeError( |
1707 'Failed to determine SVN revision for %s' % revision) | 1710 'Failed to determine SVN revision for %s' % revision) |
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2198 return ('Skipped revision: [%s]' % str(revision), | 2201 return ('Skipped revision: [%s]' % str(revision), |
2199 BUILD_RESULT_SKIPPED) | 2202 BUILD_RESULT_SKIPPED) |
2200 | 2203 |
2201 start_build_time = time.time() | 2204 start_build_time = time.time() |
2202 if self.BuildCurrentRevision(depot, revision): | 2205 if self.BuildCurrentRevision(depot, revision): |
2203 after_build_time = time.time() | 2206 after_build_time = time.time() |
2204 results = self.RunPerformanceTestAndParseResults(command_to_run, | 2207 results = self.RunPerformanceTestAndParseResults(command_to_run, |
2205 metric) | 2208 metric) |
2206 # Restore build output directory once the tests are done, to avoid | 2209 # Restore build output directory once the tests are done, to avoid |
2207 # any descrepancy. | 2210 # any descrepancy. |
2208 if depot == 'chromium' and self.opts.gs_bucket and revision: | 2211 if self.IsDownloadable(depot) and revision: |
2209 self.BackupOrRestoreOutputdirectory(restore=True) | 2212 self.BackupOrRestoreOutputdirectory(restore=True) |
2210 | 2213 |
2211 if results[1] == 0: | 2214 if results[1] == 0: |
2212 external_revisions = self.Get3rdPartyRevisionsFromCurrentRevision( | 2215 external_revisions = self.Get3rdPartyRevisionsFromCurrentRevision( |
2213 depot, revision) | 2216 depot, revision) |
2214 | 2217 |
2215 if not external_revisions is None: | 2218 if not external_revisions is None: |
2216 return (results[0], results[1], external_revisions, | 2219 return (results[0], results[1], external_revisions, |
2217 time.time() - after_build_time, after_build_time - | 2220 time.time() - after_build_time, after_build_time - |
2218 start_build_time) | 2221 start_build_time) |
(...skipping 1419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3638 # The perf dashboard scrapes the "results" step in order to comment on | 3641 # The perf dashboard scrapes the "results" step in order to comment on |
3639 # bugs. If you change this, please update the perf dashboard as well. | 3642 # bugs. If you change this, please update the perf dashboard as well. |
3640 bisect_utils.OutputAnnotationStepStart('Results') | 3643 bisect_utils.OutputAnnotationStepStart('Results') |
3641 print 'Error: %s' % e.message | 3644 print 'Error: %s' % e.message |
3642 if opts.output_buildbot_annotations: | 3645 if opts.output_buildbot_annotations: |
3643 bisect_utils.OutputAnnotationStepClosed() | 3646 bisect_utils.OutputAnnotationStepClosed() |
3644 return 1 | 3647 return 1 |
3645 | 3648 |
3646 if __name__ == '__main__': | 3649 if __name__ == '__main__': |
3647 sys.exit(main()) | 3650 sys.exit(main()) |
OLD | NEW |