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

Side by Side Diff: tools/coverity/coverity.py

Issue 3175001: Build just chrome to shorten the Coverity build and analysis... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Remove a stale TODO comment. Created 10 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/python 1 #!/usr/bin/python
2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2010 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 """ 6 """
7 Runs Coverity Prevent on a build of Chromium. 7 Runs Coverity Prevent on a build of Chromium.
8 8
9 This script should be run in a Visual Studio Command Prompt, so that the 9 This script should be run in a Visual Studio Command Prompt, so that the
10 INCLUDE, LIB, and PATH environment variables are set properly for Visual 10 INCLUDE, LIB, and PATH environment variables are set properly for Visual
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 """Reads the coverity password in from a file where it was stashed""" 81 """Reads the coverity password in from a file where it was stashed"""
82 pwfile = open(pwfilename, 'r') 82 pwfile = open(pwfilename, 'r')
83 password = pwfile.readline() 83 password = pwfile.readline()
84 pwfile.close() 84 pwfile.close()
85 return password.rstrip() 85 return password.rstrip()
86 86
87 def _RunCommand(cmd, dry_run, shell=False, echo_cmd=True): 87 def _RunCommand(cmd, dry_run, shell=False, echo_cmd=True):
88 """Runs the command if dry_run is false, otherwise just prints the command.""" 88 """Runs the command if dry_run is false, otherwise just prints the command."""
89 if echo_cmd: 89 if echo_cmd:
90 print cmd 90 print cmd
91 # TODO(wtc): Check the return value of subprocess.call, which is the return
92 # value of the command.
93 if not dry_run: 91 if not dry_run:
94 return subprocess.call(cmd, shell=shell) 92 return subprocess.call(cmd, shell=shell)
95 else: 93 else:
96 return 0 94 return 0
97 95
98 def _ReleaseLock(lock_file, lock_filename): 96 def _ReleaseLock(lock_file, lock_filename):
99 """Removes the lockfile. Function-ized so we can bail from anywhere""" 97 """Removes the lockfile. Function-ized so we can bail from anywhere"""
100 os.close(lock_file) 98 os.close(lock_file)
101 os.remove(lock_filename) 99 os.remove(lock_filename)
102 100
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 shutil.rmtree(options.coverity_intermediate_dir,True) 162 shutil.rmtree(options.coverity_intermediate_dir,True)
165 os.mkdir(options.coverity_intermediate_dir) 163 os.mkdir(options.coverity_intermediate_dir)
166 164
167 print 'Elapsed time: %ds' % (time.time() - start_time) 165 print 'Elapsed time: %ds' % (time.time() - start_time)
168 166
169 use_shell_during_make = False 167 use_shell_during_make = False
170 if sys.platform == 'linux2': 168 if sys.platform == 'linux2':
171 use_shell_during_make = True 169 use_shell_during_make = True
172 os.chdir('src') 170 os.chdir('src')
173 _RunCommand('pwd', options.dry_run, shell=True) 171 _RunCommand('pwd', options.dry_run, shell=True)
174 cmd = '%s/cov-build --dir %s make BUILDTYPE=%s' % ( 172 cmd = '%s/cov-build --dir %s make BUILDTYPE=%s chrome' % (
175 options.coverity_bin_dir, options.coverity_intermediate_dir, 173 options.coverity_bin_dir, options.coverity_intermediate_dir,
176 options.target) 174 options.target)
177 elif sys.platform == 'win32': 175 elif sys.platform == 'win32':
178 cmd = '%s\\cov-build.exe --dir %s devenv.com %s\\%s /build %s' % ( 176 cmd = ('%s\\cov-build.exe --dir %s devenv.com %s\\%s /build %s '
177 '/project chrome.vcproj') % (
179 options.coverity_bin_dir, options.coverity_intermediate_dir, 178 options.coverity_bin_dir, options.coverity_intermediate_dir,
180 options.source_dir, options.solution_file, options.target) 179 options.source_dir, options.solution_file, options.target)
181 elif sys.platform == 'darwin': 180 elif sys.platform == 'darwin':
182 use_shell_during_make = True 181 use_shell_during_make = True
183 os.chdir('src/build') 182 os.chdir('src/chrome')
184 _RunCommand('pwd', options.dry_run, shell=True) 183 _RunCommand('pwd', options.dry_run, shell=True)
185 cmd = ('%s/cov-build --dir %s xcodebuild -project all.xcodeproj ' 184 cmd = ('%s/cov-build --dir %s xcodebuild -project chrome.xcodeproj '
186 '-configuration %s -target All') % ( 185 '-configuration %s -target chrome') % (
187 options.coverity_bin_dir, options.coverity_intermediate_dir, 186 options.coverity_bin_dir, options.coverity_intermediate_dir,
188 options.target) 187 options.target)
189 188
190 189
191 _RunCommand(cmd, options.dry_run, shell=use_shell_during_make) 190 _RunCommand(cmd, options.dry_run, shell=use_shell_during_make)
192 print 'Elapsed time: %ds' % (time.time() - start_time) 191 print 'Elapsed time: %ds' % (time.time() - start_time)
193 192
194 cov_analyze_exe = os.path.join(options.coverity_bin_dir,'cov-analyze') 193 cov_analyze_exe = os.path.join(options.coverity_bin_dir,'cov-analyze')
195 cmd = '%s --dir %s %s' % (cov_analyze_exe, 194 cmd = '%s --dir %s %s' % (cov_analyze_exe,
196 options.coverity_intermediate_dir, 195 options.coverity_intermediate_dir,
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 helpmsg = ('By default, the intermediate dir is emptied before analysis. ' 292 helpmsg = ('By default, the intermediate dir is emptied before analysis. '
294 'This switch disables that behavior.') 293 'This switch disables that behavior.')
295 option_parser.add_option('', '--preserve-intermediate-dir', 294 option_parser.add_option('', '--preserve-intermediate-dir',
296 action='store_true', help=helpmsg, 295 action='store_true', help=helpmsg,
297 default=False) 296 default=False)
298 297
299 options, args = option_parser.parse_args() 298 options, args = option_parser.parse_args()
300 299
301 result = main(options, args) 300 result = main(options, args)
302 sys.exit(result) 301 sys.exit(result)
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