| 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 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 630 Returns: | 630 Returns: |
| 631 A tuple of the output and return code. | 631 A tuple of the output and return code. |
| 632 """ | 632 """ |
| 633 (output, return_code) = RunGit(command, cwd=cwd) | 633 (output, return_code) = RunGit(command, cwd=cwd) |
| 634 | 634 |
| 635 assert not return_code, 'An error occurred while running'\ | 635 assert not return_code, 'An error occurred while running'\ |
| 636 ' "git %s"' % ' '.join(command) | 636 ' "git %s"' % ' '.join(command) |
| 637 return output | 637 return output |
| 638 | 638 |
| 639 | 639 |
| 640 def SetBuildSystemDefault(build_system): | 640 def SetBuildSystemDefault(build_system, use_goma): |
| 641 """Sets up any environment variables needed to build with the specified build | 641 """Sets up any environment variables needed to build with the specified build |
| 642 system. | 642 system. |
| 643 | 643 |
| 644 Args: | 644 Args: |
| 645 build_system: A string specifying build system. Currently only 'ninja' or | 645 build_system: A string specifying build system. Currently only 'ninja' or |
| 646 'make' are supported.""" | 646 'make' are supported.""" |
| 647 if build_system == 'ninja': | 647 if build_system == 'ninja': |
| 648 gyp_var = os.getenv('GYP_GENERATORS') | 648 gyp_var = os.getenv('GYP_GENERATORS') |
| 649 | 649 |
| 650 if not gyp_var or not 'ninja' in gyp_var: | 650 if not gyp_var or not 'ninja' in gyp_var: |
| 651 if gyp_var: | 651 if gyp_var: |
| 652 os.environ['GYP_GENERATORS'] = gyp_var + ',ninja' | 652 os.environ['GYP_GENERATORS'] = gyp_var + ',ninja' |
| 653 else: | 653 else: |
| 654 os.environ['GYP_GENERATORS'] = 'ninja' | 654 os.environ['GYP_GENERATORS'] = 'ninja' |
| 655 | 655 |
| 656 if IsWindows(): | 656 if IsWindows(): |
| 657 os.environ['GYP_DEFINES'] = 'component=shared_library '\ | 657 os.environ['GYP_DEFINES'] = 'component=shared_library '\ |
| 658 'incremental_chrome_dll=1 disable_nacl=1 fastbuild=1 '\ | 658 'incremental_chrome_dll=1 disable_nacl=1 fastbuild=1 '\ |
| 659 'chromium_win_pch=0' | 659 'chromium_win_pch=0' |
| 660 |
| 660 elif build_system == 'make': | 661 elif build_system == 'make': |
| 661 os.environ['GYP_GENERATORS'] = 'make' | 662 os.environ['GYP_GENERATORS'] = 'make' |
| 662 else: | 663 else: |
| 663 raise RuntimeError('%s build not supported.' % build_system) | 664 raise RuntimeError('%s build not supported.' % build_system) |
| 664 | 665 |
| 666 if use_goma: |
| 667 os.environ['GYP_DEFINES'] = '%s %s' % (os.getenv('GYP_DEFINES', ''), |
| 668 'use_goma=1') |
| 669 |
| 665 | 670 |
| 666 def BuildWithMake(threads, targets, build_type='Release'): | 671 def BuildWithMake(threads, targets, build_type='Release'): |
| 667 cmd = ['make', 'BUILDTYPE=%s' % build_type] | 672 cmd = ['make', 'BUILDTYPE=%s' % build_type] |
| 668 | 673 |
| 669 if threads: | 674 if threads: |
| 670 cmd.append('-j%d' % threads) | 675 cmd.append('-j%d' % threads) |
| 671 | 676 |
| 672 cmd += targets | 677 cmd += targets |
| 673 | 678 |
| 674 return_code = RunProcess(cmd) | 679 return_code = RunProcess(cmd) |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 742 """ | 747 """ |
| 743 if IsWindows(): | 748 if IsWindows(): |
| 744 if not opts.build_preference: | 749 if not opts.build_preference: |
| 745 opts.build_preference = 'msvs' | 750 opts.build_preference = 'msvs' |
| 746 | 751 |
| 747 if opts.build_preference == 'msvs': | 752 if opts.build_preference == 'msvs': |
| 748 if not os.getenv('VS100COMNTOOLS'): | 753 if not os.getenv('VS100COMNTOOLS'): |
| 749 raise RuntimeError( | 754 raise RuntimeError( |
| 750 'Path to visual studio could not be determined.') | 755 'Path to visual studio could not be determined.') |
| 751 else: | 756 else: |
| 752 SetBuildSystemDefault(opts.build_preference) | 757 SetBuildSystemDefault(opts.build_preference, opts.use_goma) |
| 753 else: | 758 else: |
| 754 if not opts.build_preference: | 759 if not opts.build_preference: |
| 755 if 'ninja' in os.getenv('GYP_GENERATORS'): | 760 if 'ninja' in os.getenv('GYP_GENERATORS'): |
| 756 opts.build_preference = 'ninja' | 761 opts.build_preference = 'ninja' |
| 757 else: | 762 else: |
| 758 opts.build_preference = 'make' | 763 opts.build_preference = 'make' |
| 759 | 764 |
| 760 SetBuildSystemDefault(opts.build_preference) | 765 SetBuildSystemDefault(opts.build_preference, opts.use_goma) |
| 761 | 766 |
| 762 if not bisect_utils.SetupPlatformBuildEnvironment(opts): | 767 if not bisect_utils.SetupPlatformBuildEnvironment(opts): |
| 763 raise RuntimeError('Failed to set platform environment.') | 768 raise RuntimeError('Failed to set platform environment.') |
| 764 | 769 |
| 765 @staticmethod | 770 @staticmethod |
| 766 def FromOpts(opts): | 771 def FromOpts(opts): |
| 767 builder = None | 772 builder = None |
| 768 if opts.target_platform == 'cros': | 773 if opts.target_platform == 'cros': |
| 769 builder = CrosBuilder(opts) | 774 builder = CrosBuilder(opts) |
| 770 elif opts.target_platform == 'android': | 775 elif opts.target_platform == 'android': |
| (...skipping 1594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2365 return_code = RunProcess(cmd) | 2370 return_code = RunProcess(cmd) |
| 2366 os.chdir(cwd) | 2371 os.chdir(cwd) |
| 2367 return not return_code | 2372 return not return_code |
| 2368 | 2373 |
| 2369 def PerformPreSyncCleanup(self, revision, depot): | 2374 def PerformPreSyncCleanup(self, revision, depot): |
| 2370 """Performs any necessary cleanup before syncing. | 2375 """Performs any necessary cleanup before syncing. |
| 2371 | 2376 |
| 2372 Returns: | 2377 Returns: |
| 2373 True if successful. | 2378 True if successful. |
| 2374 """ | 2379 """ |
| 2375 if depot == 'chromium': | 2380 if depot == 'chromium' or depot == 'android-chrome': |
| 2376 # Removes third_party/libjingle. At some point, libjingle was causing | 2381 # Removes third_party/libjingle. At some point, libjingle was causing |
| 2377 # issues syncing when using the git workflow (crbug.com/266324). | 2382 # issues syncing when using the git workflow (crbug.com/266324). |
| 2383 os.chdir(self.src_cwd) |
| 2378 if not bisect_utils.RemoveThirdPartyDirectory('libjingle'): | 2384 if not bisect_utils.RemoveThirdPartyDirectory('libjingle'): |
| 2379 return False | 2385 return False |
| 2380 # Removes third_party/skia. At some point, skia was causing | 2386 # Removes third_party/skia. At some point, skia was causing |
| 2381 # issues syncing when using the git workflow (crbug.com/377951). | 2387 # issues syncing when using the git workflow (crbug.com/377951). |
| 2382 if not bisect_utils.RemoveThirdPartyDirectory('skia'): | 2388 if not bisect_utils.RemoveThirdPartyDirectory('skia'): |
| 2383 return False | 2389 return False |
| 2384 return self.PerformWebkitDirectoryCleanup(revision) | 2390 if depot == 'chromium': |
| 2391 # The fast webkit cleanup doesn't work for android_chrome |
| 2392 # The switch from Webkit to Blink that this deals with now happened |
| 2393 # quite a long time ago so this is unlikely to be a problem. |
| 2394 return self.PerformWebkitDirectoryCleanup(revision) |
| 2385 elif depot == 'cros': | 2395 elif depot == 'cros': |
| 2386 return self.PerformCrosChrootCleanup() | 2396 return self.PerformCrosChrootCleanup() |
| 2387 return True | 2397 return True |
| 2388 | 2398 |
| 2389 def RunPostSync(self, depot): | 2399 def RunPostSync(self, depot): |
| 2390 """Performs any work after syncing. | 2400 """Performs any work after syncing. |
| 2391 | 2401 |
| 2392 Returns: | 2402 Returns: |
| 2393 True if successful. | 2403 True if successful. |
| 2394 """ | 2404 """ |
| (...skipping 1367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3762 help='Path to a script which can be used to modify ' | 3772 help='Path to a script which can be used to modify ' |
| 3763 'the bisect script\'s behavior.') | 3773 'the bisect script\'s behavior.') |
| 3764 group.add_option('--cros_board', | 3774 group.add_option('--cros_board', |
| 3765 type='str', | 3775 type='str', |
| 3766 help='The cros board type to build.') | 3776 help='The cros board type to build.') |
| 3767 group.add_option('--cros_remote_ip', | 3777 group.add_option('--cros_remote_ip', |
| 3768 type='str', | 3778 type='str', |
| 3769 help='The remote machine to image to.') | 3779 help='The remote machine to image to.') |
| 3770 group.add_option('--use_goma', | 3780 group.add_option('--use_goma', |
| 3771 action="store_true", | 3781 action="store_true", |
| 3772 help='Add a bunch of extra threads for goma.') | 3782 help='Add a bunch of extra threads for goma, and enable ' |
| 3783 'goma') |
| 3773 group.add_option('--output_buildbot_annotations', | 3784 group.add_option('--output_buildbot_annotations', |
| 3774 action="store_true", | 3785 action="store_true", |
| 3775 help='Add extra annotation output for buildbot.') | 3786 help='Add extra annotation output for buildbot.') |
| 3776 group.add_option('--gs_bucket', | 3787 group.add_option('--gs_bucket', |
| 3777 default='', | 3788 default='', |
| 3778 dest='gs_bucket', | 3789 dest='gs_bucket', |
| 3779 type='str', | 3790 type='str', |
| 3780 help=('Name of Google Storage bucket to upload or ' | 3791 help=('Name of Google Storage bucket to upload or ' |
| 3781 'download build. e.g., chrome-perf')) | 3792 'download build. e.g., chrome-perf')) |
| 3782 group.add_option('--target_arch', | 3793 group.add_option('--target_arch', |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3966 # The perf dashboard scrapes the "results" step in order to comment on | 3977 # The perf dashboard scrapes the "results" step in order to comment on |
| 3967 # bugs. If you change this, please update the perf dashboard as well. | 3978 # bugs. If you change this, please update the perf dashboard as well. |
| 3968 bisect_utils.OutputAnnotationStepStart('Results') | 3979 bisect_utils.OutputAnnotationStepStart('Results') |
| 3969 print 'Error: %s' % e.message | 3980 print 'Error: %s' % e.message |
| 3970 if opts.output_buildbot_annotations: | 3981 if opts.output_buildbot_annotations: |
| 3971 bisect_utils.OutputAnnotationStepClosed() | 3982 bisect_utils.OutputAnnotationStepClosed() |
| 3972 return 1 | 3983 return 1 |
| 3973 | 3984 |
| 3974 if __name__ == '__main__': | 3985 if __name__ == '__main__': |
| 3975 sys.exit(main()) | 3986 sys.exit(main()) |
| OLD | NEW |