Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Side by Side Diff: tools/bisect-perf-regression.py

Issue 413363003: Use a default string when calling os.getenv in bisect-perf-regression.py. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 698 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 709
710 710
711 def SetBuildSystemDefault(build_system, use_goma, goma_dir): 711 def SetBuildSystemDefault(build_system, use_goma, goma_dir):
712 """Sets up any environment variables needed to build with the specified build 712 """Sets up any environment variables needed to build with the specified build
713 system. 713 system.
714 714
715 Args: 715 Args:
716 build_system: A string specifying build system. Currently only 'ninja' or 716 build_system: A string specifying build system. Currently only 'ninja' or
717 'make' are supported.""" 717 'make' are supported."""
718 if build_system == 'ninja': 718 if build_system == 'ninja':
719 gyp_var = os.getenv('GYP_GENERATORS') 719 gyp_var = os.getenv('GYP_GENERATORS', default='')
720 720
721 if not gyp_var or not 'ninja' in gyp_var: 721 if not gyp_var or not 'ninja' in gyp_var:
722 if gyp_var: 722 if gyp_var:
723 os.environ['GYP_GENERATORS'] = gyp_var + ',ninja' 723 os.environ['GYP_GENERATORS'] = gyp_var + ',ninja'
724 else: 724 else:
725 os.environ['GYP_GENERATORS'] = 'ninja' 725 os.environ['GYP_GENERATORS'] = 'ninja'
726 726
727 if IsWindowsHost(): 727 if IsWindowsHost():
728 os.environ['GYP_DEFINES'] = 'component=shared_library '\ 728 os.environ['GYP_DEFINES'] = 'component=shared_library '\
729 'incremental_chrome_dll=1 disable_nacl=1 fastbuild=1 '\ 729 'incremental_chrome_dll=1 disable_nacl=1 fastbuild=1 '\
730 'chromium_win_pch=0' 730 'chromium_win_pch=0'
731 731
732 elif build_system == 'make': 732 elif build_system == 'make':
733 os.environ['GYP_GENERATORS'] = 'make' 733 os.environ['GYP_GENERATORS'] = 'make'
734 else: 734 else:
735 raise RuntimeError('%s build not supported.' % build_system) 735 raise RuntimeError('%s build not supported.' % build_system)
736 736
737 if use_goma: 737 if use_goma:
738 os.environ['GYP_DEFINES'] = '%s %s' % (os.getenv('GYP_DEFINES', ''), 738 os.environ['GYP_DEFINES'] = '%s %s' % (os.getenv('GYP_DEFINES', default=''),
739 'use_goma=1') 739 'use_goma=1')
740 if goma_dir: 740 if goma_dir:
741 os.environ['GYP_DEFINES'] += ' gomadir=%s' % goma_dir 741 os.environ['GYP_DEFINES'] += ' gomadir=%s' % goma_dir
742 742
743 743
744 def BuildWithMake(threads, targets, build_type='Release'): 744 def BuildWithMake(threads, targets, build_type='Release'):
745 cmd = ['make', 'BUILDTYPE=%s' % build_type] 745 cmd = ['make', 'BUILDTYPE=%s' % build_type]
746 746
747 if threads: 747 if threads:
748 cmd.append('-j%d' % threads) 748 cmd.append('-j%d' % threads)
749 749
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
824 824
825 if opts.build_preference == 'msvs': 825 if opts.build_preference == 'msvs':
826 if not os.getenv('VS100COMNTOOLS'): 826 if not os.getenv('VS100COMNTOOLS'):
827 raise RuntimeError( 827 raise RuntimeError(
828 'Path to visual studio could not be determined.') 828 'Path to visual studio could not be determined.')
829 else: 829 else:
830 SetBuildSystemDefault(opts.build_preference, opts.use_goma, 830 SetBuildSystemDefault(opts.build_preference, opts.use_goma,
831 opts.goma_dir) 831 opts.goma_dir)
832 else: 832 else:
833 if not opts.build_preference: 833 if not opts.build_preference:
834 if 'ninja' in os.getenv('GYP_GENERATORS'): 834 if 'ninja' in os.getenv('GYP_GENERATORS', default=''):
835 opts.build_preference = 'ninja' 835 opts.build_preference = 'ninja'
836 else: 836 else:
837 opts.build_preference = 'make' 837 opts.build_preference = 'make'
838 838
839 SetBuildSystemDefault(opts.build_preference, opts.use_goma, opts.goma_dir) 839 SetBuildSystemDefault(opts.build_preference, opts.use_goma, opts.goma_dir)
840 840
841 if not bisect_utils.SetupPlatformBuildEnvironment(opts): 841 if not bisect_utils.SetupPlatformBuildEnvironment(opts):
842 raise RuntimeError('Failed to set platform environment.') 842 raise RuntimeError('Failed to set platform environment.')
843 843
844 @staticmethod 844 @staticmethod
(...skipping 3337 matching lines...) Expand 10 before | Expand all | Expand 10 after
4182 # The perf dashboard scrapes the "results" step in order to comment on 4182 # The perf dashboard scrapes the "results" step in order to comment on
4183 # bugs. If you change this, please update the perf dashboard as well. 4183 # bugs. If you change this, please update the perf dashboard as well.
4184 bisect_utils.OutputAnnotationStepStart('Results') 4184 bisect_utils.OutputAnnotationStepStart('Results')
4185 print 'Error: %s' % e.message 4185 print 'Error: %s' % e.message
4186 if opts.output_buildbot_annotations: 4186 if opts.output_buildbot_annotations:
4187 bisect_utils.OutputAnnotationStepClosed() 4187 bisect_utils.OutputAnnotationStepClosed()
4188 return 1 4188 return 1
4189 4189
4190 if __name__ == '__main__': 4190 if __name__ == '__main__':
4191 sys.exit(main()) 4191 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698