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

Side by Side Diff: scripts/slave/zip_build.py

Issue 11379003: Add Windows ASAN bots. (Closed) Base URL: http://git.chromium.org/chromium/tools/build.git@neuter
Patch Set: Add CHROME_ALLOCATOR environment var to tests Created 8 years, 1 month 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
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 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 """ Creates a zip file in the staging dir with the result of a compile. 6 """ Creates a zip file in the staging dir with the result of a compile.
7 It can be sent to other machines for testing. 7 It can be sent to other machines for testing.
8 """ 8 """
9 9
10 import csv 10 import csv
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 tmp_revision_file.close() 187 tmp_revision_file.close()
188 chromium_utils.MakeWorldReadable(tmp_revision_file.name) 188 chromium_utils.MakeWorldReadable(tmp_revision_file.name)
189 dest_path = os.path.join(dirname, 189 dest_path = os.path.join(dirname,
190 chromium_utils.FULL_BUILD_REVISION_FILENAME) 190 chromium_utils.FULL_BUILD_REVISION_FILENAME)
191 shutil.move(tmp_revision_file.name, dest_path) 191 shutil.move(tmp_revision_file.name, dest_path)
192 except IOError: 192 except IOError:
193 print 'Writing to revision file in %s failed.' % dirname 193 print 'Writing to revision file in %s failed.' % dirname
194 194
195 195
196 def MakeUnversionedArchive(build_dir, staging_dir, zip_file_list, 196 def MakeUnversionedArchive(build_dir, staging_dir, zip_file_list,
197 zip_file_name): 197 zip_file_name, filters):
198 """Creates an unversioned full build archive. 198 """Creates an unversioned full build archive.
199 Returns the path of the created archive.""" 199 Returns the path of the created archive."""
200 replacements = []
201 if 'asan' in filters:
Roger McFarlane (Chromium) 2012/11/21 19:29:52 Maybe take the filter as a collection of functions
iannucci 2012/11/21 22:26:57 Good idea. Done.
202 def ASANFilter(path):
203 head, tail = os.path.split(path)
204 parts = tail.split('.', 1)
205 if len(parts) == 1:
206 return path
207 if parts[-1].startswith('asan'): # skip 'foo.asan.exe' entirely
208 return None
209 parts.insert(1, 'asan')
210 asan_path = os.path.join(head, '.'.join(parts))
211 if os.path.exists(asan_path):
212 return asan_path
213 return path
214 replacements.append(ASANFilter)
215
200 (zip_dir, zip_file) = chromium_utils.MakeZip(staging_dir, 216 (zip_dir, zip_file) = chromium_utils.MakeZip(staging_dir,
201 zip_file_name, 217 zip_file_name,
202 zip_file_list, 218 zip_file_list,
203 build_dir, 219 build_dir,
204 raise_error=True) 220 raise_error=True,
221 replacements=replacements)
205 chromium_utils.RemoveDirectory(zip_dir) 222 chromium_utils.RemoveDirectory(zip_dir)
206 if not os.path.exists(zip_file): 223 if not os.path.exists(zip_file):
207 raise StagingError('Failed to make zip package %s' % zip_file) 224 raise StagingError('Failed to make zip package %s' % zip_file)
208 chromium_utils.MakeWorldReadable(zip_file) 225 chromium_utils.MakeWorldReadable(zip_file)
209 226
210 # Report the size of the zip file to help catch when it gets too big and 227 # Report the size of the zip file to help catch when it gets too big and
211 # can cause bot failures from timeouts during downloads to testers. 228 # can cause bot failures from timeouts during downloads to testers.
212 zip_size = os.stat(zip_file)[stat.ST_SIZE] 229 zip_size = os.stat(zip_file)[stat.ST_SIZE]
213 print 'Zip file is %ld bytes' % zip_size 230 print 'Zip file is %ld bytes' % zip_size
214 231
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 329
313 # Build the list of files to archive. 330 # Build the list of files to archive.
314 root_files = os.listdir(build_dir) 331 root_files = os.listdir(build_dir)
315 path_filter = PathMatcher(options) 332 path_filter = PathMatcher(options)
316 print path_filter 333 print path_filter
317 print ('\nActually excluded: %s' % 334 print ('\nActually excluded: %s' %
318 [f for f in root_files if not path_filter.Match(f)]) 335 [f for f in root_files if not path_filter.Match(f)])
319 336
320 zip_file_list = [f for f in root_files if path_filter.Match(f)] 337 zip_file_list = [f for f in root_files if path_filter.Match(f)]
321 zip_file = MakeUnversionedArchive(build_dir, staging_dir, zip_file_list, 338 zip_file = MakeUnversionedArchive(build_dir, staging_dir, zip_file_list,
322 unversioned_base_name) 339 unversioned_base_name, options.filters)
323 340
324 zip_base, zip_ext = MakeVersionedArchive(zip_file, version_suffix, options) 341 zip_base, zip_ext = MakeVersionedArchive(zip_file, version_suffix, options)
325 PruneOldArchives(staging_dir, zip_base, zip_ext) 342 PruneOldArchives(staging_dir, zip_base, zip_ext)
326 343
327 # Update the latest revision file in the staging directory 344 # Update the latest revision file in the staging directory
328 # to allow testers to figure out the latest packaged revision 345 # to allow testers to figure out the latest packaged revision
329 # without downloading tarballs. 346 # without downloading tarballs.
330 WriteRevisionFile(staging_dir, build_revision) 347 WriteRevisionFile(staging_dir, build_revision)
331 348
332 return 0 349 return 0
333 350
334 351
335 def main(argv): 352 def main(argv):
336 option_parser = optparse.OptionParser() 353 option_parser = optparse.OptionParser()
337 option_parser.add_option('--target', 354 option_parser.add_option('--target',
338 help='build target to archive (Debug or Release)') 355 help='build target to archive (Debug or Release)')
339 option_parser.add_option('--src-dir', default='src', 356 option_parser.add_option('--src-dir', default='src',
340 help='path to the top-level sources directory') 357 help='path to the top-level sources directory')
341 option_parser.add_option('--build-dir', default='chrome', 358 option_parser.add_option('--build-dir', default='chrome',
342 help=('path to main build directory (the parent of ' 359 help=('path to main build directory (the parent of '
343 'the Release or Debug directory)')) 360 'the Release or Debug directory)'))
344 option_parser.add_option('--exclude-files', default='', 361 option_parser.add_option('--exclude-files', default='',
345 help=('Comma separated list of files that should ' 362 help=('Comma separated list of files that should '
346 'always be excluded from the zip.')) 363 'always be excluded from the zip.'))
347 option_parser.add_option('--include-files', default='', 364 option_parser.add_option('--include-files', default='',
348 help=('Comma separated list of files that should ' 365 help=('Comma separated list of files that should '
349 'always be included in the zip.')) 366 'always be included in the zip.'))
350 option_parser.add_option('--webkit-dir', 367 option_parser.add_option('--webkit-dir',
351 help='webkit directory path, relative to --src-dir') 368 help='webkit directory path, relative to --src-dir')
369 option_parser.add_option('--filters', action='append', default=[],
370 help='Filters to apply to build zip '
371 '(avail: "asan").')
352 chromium_utils.AddPropertiesOptions(option_parser) 372 chromium_utils.AddPropertiesOptions(option_parser)
353 373
354 options, args = option_parser.parse_args(argv) 374 options, args = option_parser.parse_args(argv)
355 375
356 if not options.target: 376 if not options.target:
357 options.target = options.factory_properties.get('target', 'Release') 377 options.target = options.factory_properties.get('target', 'Release')
358 if not options.webkit_dir: 378 if not options.webkit_dir:
359 options.webkit_dir = options.factory_properties.get('webkit_dir') 379 options.webkit_dir = options.factory_properties.get('webkit_dir')
360 380
361 # When option_parser is passed argv as a list, it can return the caller as 381 # When option_parser is passed argv as a list, it can return the caller as
362 # first unknown arg. So throw a warning if we have two or more unknown 382 # first unknown arg. So throw a warning if we have two or more unknown
363 # arguments. 383 # arguments.
364 if args[1:]: 384 if args[1:]:
365 print 'Warning -- unknown arguments' % args[1:] 385 print 'Warning -- unknown arguments' % args[1:]
366 386
387 if options.factory_properties.get('asan'):
388 options.filters.append('asan')
389 options.filters = set(options.filters)
390
367 return Archive(options) 391 return Archive(options)
368 392
393
369 if '__main__' == __name__: 394 if '__main__' == __name__:
370 sys.exit(main(sys.argv)) 395 sys.exit(main(sys.argv))
OLDNEW
« scripts/slave/chromium/win_apply_asan.py ('K') | « scripts/slave/chromium/win_apply_asan.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698