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

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

Issue 9601021: Add testing library to running tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build/
Patch Set: Created 8 years, 9 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
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 """A tool to run a chrome test executable, used by the buildbot slaves. 6 """A tool to run a chrome test executable, used by the buildbot slaves.
7 7
8 When this is run, the current directory (cwd) should be the outer build 8 When this is run, the current directory (cwd) should be the outer build
9 directory (e.g., chrome-release/build/). 9 directory (e.g., chrome-release/build/).
10 10
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 # file attributes), and we'd rather have no sandbox than pull in an old 307 # file attributes), and we'd rather have no sandbox than pull in an old
308 # (possibly incompatible) one from the system. 308 # (possibly incompatible) one from the system.
309 os.environ['CHROME_DEVEL_SANDBOX'] = '' 309 os.environ['CHROME_DEVEL_SANDBOX'] = ''
310 310
311 # Nuke anything that appears to be stale chrome items in the temporary 311 # Nuke anything that appears to be stale chrome items in the temporary
312 # directory from previous test runs (i.e.- from crashes or unittest leaks). 312 # directory from previous test runs (i.e.- from crashes or unittest leaks).
313 slave_utils.RemoveChromeTemporaryFiles() 313 slave_utils.RemoveChromeTemporaryFiles()
314 314
315 os.environ['LD_LIBRARY_PATH'] = '%s:%s/lib:%s/lib.target' % (bin_dir, bin_dir, 315 os.environ['LD_LIBRARY_PATH'] = '%s:%s/lib:%s/lib.target' % (bin_dir, bin_dir,
316 bin_dir) 316 bin_dir)
317 # Figure out what we want for a special llvmpipe directory.
318 if (options.llvmpipe and options.llvmpipe_dir and
319 os.path.exists(options.llvmpipe_dir)):
320 os.environ['LD_LIBRARY_PATH'] += ':' + options.llvmpipe_dir
321
317 if options.parallel: 322 if options.parallel:
318 supervisor_path = os.path.join(build_dir, '..', 'tools', 323 supervisor_path = os.path.join(build_dir, '..', 'tools',
319 'sharding_supervisor', 324 'sharding_supervisor',
320 'sharding_supervisor.py') 325 'sharding_supervisor.py')
321 supervisor_args = ['--no-color', '--retry-failed'] 326 supervisor_args = ['--no-color', '--retry-failed']
322 if options.sharding_args: 327 if options.sharding_args:
323 supervisor_args.extend(options.sharding_args.split()) 328 supervisor_args.extend(options.sharding_args.split())
324 command = [sys.executable, supervisor_path] 329 command = [sys.executable, supervisor_path]
325 command.extend(supervisor_args) 330 command.extend(supervisor_args)
326 command.append(test_exe_path) 331 command.append(test_exe_path)
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 if options.enable_pageheap: 437 if options.enable_pageheap:
433 slave_utils.SetPageHeap(build_dir, 'chrome.exe', False) 438 slave_utils.SetPageHeap(build_dir, 'chrome.exe', False)
434 439
435 if options.generate_json_file: 440 if options.generate_json_file:
436 _GenerateJSONForTestResults(options, results_tracker) 441 _GenerateJSONForTestResults(options, results_tracker)
437 442
438 return result 443 return result
439 444
440 445
441 def main(): 446 def main():
447 import platform
448
449 xvfb_path = os.path.join(os.path.dirname(sys.argv[0]), '..', '..',
450 'third_party', 'xvfb', platform.architecture()[0])
451
442 # Initialize logging. 452 # Initialize logging.
443 log_level = logging.INFO 453 log_level = logging.INFO
444 logging.basicConfig(level=log_level, 454 logging.basicConfig(level=log_level,
445 format='%(asctime)s %(filename)s:%(lineno)-3d' 455 format='%(asctime)s %(filename)s:%(lineno)-3d'
446 ' %(levelname)s %(message)s', 456 ' %(levelname)s %(message)s',
447 datefmt='%y%m%d %H:%M:%S') 457 datefmt='%y%m%d %H:%M:%S')
448 458
449 option_parser = optparse.OptionParser(usage=USAGE) 459 option_parser = optparse.OptionParser(usage=USAGE)
450 460
451 # Since the trailing program to run may have has command-line args of its 461 # Since the trailing program to run may have has command-line args of its
(...skipping 27 matching lines...) Expand all
479 option_parser.add_option('', '--run-python-script', action='store_true', 489 option_parser.add_option('', '--run-python-script', action='store_true',
480 default=False, 490 default=False,
481 help='treat first argument as a python script' 491 help='treat first argument as a python script'
482 'to run.') 492 'to run.')
483 option_parser.add_option('', '--generate-json-file', action='store_true', 493 option_parser.add_option('', '--generate-json-file', action='store_true',
484 default=False, 494 default=False,
485 help='output JSON results file if specified.') 495 help='output JSON results file if specified.')
486 option_parser.add_option('', '--parallel', action='store_true', 496 option_parser.add_option('', '--parallel', action='store_true',
487 help='Shard and run tests in parallel for speed ' 497 help='Shard and run tests in parallel for speed '
488 'with sharding_supervisor.') 498 'with sharding_supervisor.')
489 option_parser.add_option('', '--special-xvfb-dir', default=os.path.join( 499 option_parser.add_option('', '--llvmpipe', action='store_true', default=True,
M-A Ruel 2012/03/07 20:29:44 I don't care enough to block you but I think it ju
Peter Mayo 2012/03/08 21:17:35 I think you are right that a single variable makes
490 os.path.dirname(sys.argv[0]), '..', '..', 'xvfb'), 500 help='Use software gpu pipe directory.')
501 option_parser.add_option('', '--no-llvmpipe', action='store_false',
502 dest='llvmpipe',
503 help='Do not use software gpu pipe directory.')
504 option_parser.add_option('', '--llvmpipe-dir', default=xvfb_path,
505 help='Path to software gpu library directory.')
506 option_parser.add_option('', '--special-xvfb-dir', default=xvfb_path,
491 help='Path to virtual X server directory on Linux.') 507 help='Path to virtual X server directory on Linux.')
492 option_parser.add_option('', '--special-xvfb', action='store_true', 508 option_parser.add_option('', '--special-xvfb', action='store_true',
493 default='auto', 509 default='auto',
494 help='use non-default virtual X server on Linux.') 510 help='use non-default virtual X server on Linux.')
495 option_parser.add_option('', '--no-special-xvfb', action='store_false', 511 option_parser.add_option('', '--no-special-xvfb', action='store_false',
496 dest='special_xvfb', 512 dest='special_xvfb',
497 help='Use default virtual X server on Linux.') 513 help='Use default virtual X server on Linux.')
498 option_parser.add_option('', '--auto-special-xvfb', action='store_const', 514 option_parser.add_option('', '--auto-special-xvfb', action='store_const',
499 const='auto', dest='special_xvfb', 515 const='auto', dest='special_xvfb',
500 help='Guess as to virtual X server on Linux.') 516 help='Guess as to virtual X server on Linux.')
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 '%d new files were left in %s: Fix the tests to clean up themselves.' 589 '%d new files were left in %s: Fix the tests to clean up themselves.'
574 ) % ((new_temp_files - temp_files), tempfile.gettempdir()) 590 ) % ((new_temp_files - temp_files), tempfile.gettempdir())
575 # TODO(maruel): Make it an error soon. Not yet since I want to iron out all 591 # TODO(maruel): Make it an error soon. Not yet since I want to iron out all
576 # the remaining cases before. 592 # the remaining cases before.
577 #result = 1 593 #result = 1
578 return result 594 return result
579 595
580 596
581 if '__main__' == __name__: 597 if '__main__' == __name__:
582 sys.exit(main()) 598 sys.exit(main())
OLDNEW
« scripts/master/factory/chromium_commands.py ('K') | « scripts/master/factory/chromium_factory.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698