OLD | NEW |
---|---|
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 Loading... | |
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 Loading... | |
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 | |
Marc-Antoine Ruel (Google)
2012/03/06 23:38:03
Why function local?
Peter Mayo
2012/03/07 16:22:48
Conflict with line 132 variable name. This seemed
| |
448 | |
442 # Initialize logging. | 449 # Initialize logging. |
443 log_level = logging.INFO | 450 log_level = logging.INFO |
444 logging.basicConfig(level=log_level, | 451 logging.basicConfig(level=log_level, |
445 format='%(asctime)s %(filename)s:%(lineno)-3d' | 452 format='%(asctime)s %(filename)s:%(lineno)-3d' |
446 ' %(levelname)s %(message)s', | 453 ' %(levelname)s %(message)s', |
447 datefmt='%y%m%d %H:%M:%S') | 454 datefmt='%y%m%d %H:%M:%S') |
448 | 455 |
449 option_parser = optparse.OptionParser(usage=USAGE) | 456 option_parser = optparse.OptionParser(usage=USAGE) |
450 | 457 |
451 # Since the trailing program to run may have has command-line args of its | 458 # Since the trailing program to run may have has command-line args of its |
(...skipping 27 matching lines...) Expand all Loading... | |
479 option_parser.add_option('', '--run-python-script', action='store_true', | 486 option_parser.add_option('', '--run-python-script', action='store_true', |
480 default=False, | 487 default=False, |
481 help='treat first argument as a python script' | 488 help='treat first argument as a python script' |
482 'to run.') | 489 'to run.') |
483 option_parser.add_option('', '--generate-json-file', action='store_true', | 490 option_parser.add_option('', '--generate-json-file', action='store_true', |
484 default=False, | 491 default=False, |
485 help='output JSON results file if specified.') | 492 help='output JSON results file if specified.') |
486 option_parser.add_option('', '--parallel', action='store_true', | 493 option_parser.add_option('', '--parallel', action='store_true', |
487 help='Shard and run tests in parallel for speed ' | 494 help='Shard and run tests in parallel for speed ' |
488 'with sharding_supervisor.') | 495 'with sharding_supervisor.') |
496 option_parser.add_option('', '--llvmpipe', action='store_true', | |
Marc-Antoine Ruel (Google)
2012/03/06 23:38:03
Why add this flag at all?
Peter Mayo
2012/03/07 16:22:48
i) I don't believe in adding options that don't ha
| |
497 default=True, help='Use software gpu pipe directory.') | |
498 option_parser.add_option('', '--no-llvmpipe', action='store_false', | |
499 default=False, dest='llvmpipe', | |
Peter Mayo
2012/03/07 16:22:48
Contradictory defaults.
| |
500 help='Do not use software gpu pipe directory.') | |
501 option_parser.add_option('', '--llvmpipe-dir', default=os.path.join( | |
Marc-Antoine Ruel (Google)
2012/03/06 23:38:03
Shouldn't just specifying --lvmpipe-dir enable it?
Peter Mayo
2012/03/07 16:22:48
I'd like to leave that to the person who implement
| |
502 os.path.dirname(sys.argv[0]), '..', '..', 'third_party', 'xvfb', | |
503 platform.architecture()[0]), | |
504 help='Path to software gpu library directory.') | |
489 option_parser.add_option('', '--special-xvfb-dir', default=os.path.join( | 505 option_parser.add_option('', '--special-xvfb-dir', default=os.path.join( |
490 os.path.dirname(sys.argv[0]), '..', '..', 'xvfb'), | 506 os.path.dirname(sys.argv[0]), '..', '..', 'third_party', 'xvfb', |
491 help='Path to virtual X server directory on Linux.') | 507 platform.architecture()[0]), |
508 help='Path to virtual X server directory on Linux.') | |
492 option_parser.add_option('', '--special-xvfb', action='store_true', | 509 option_parser.add_option('', '--special-xvfb', action='store_true', |
493 default='auto', | 510 default='auto', |
494 help='use non-default virtual X server on Linux.') | 511 help='use non-default virtual X server on Linux.') |
495 option_parser.add_option('', '--no-special-xvfb', action='store_false', | 512 option_parser.add_option('', '--no-special-xvfb', action='store_false', |
496 dest='special_xvfb', | 513 dest='special_xvfb', |
497 help='Use default virtual X server on Linux.') | 514 help='Use default virtual X server on Linux.') |
498 option_parser.add_option('', '--auto-special-xvfb', action='store_const', | 515 option_parser.add_option('', '--auto-special-xvfb', action='store_const', |
499 const='auto', dest='special_xvfb', | 516 const='auto', dest='special_xvfb', |
500 help='Guess as to virtual X server on Linux.') | 517 help='Guess as to virtual X server on Linux.') |
501 option_parser.add_option('', '--xvfb', action='store_true', dest='xvfb', | 518 option_parser.add_option('', '--xvfb', action='store_true', dest='xvfb', |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
573 '%d new files were left in %s: Fix the tests to clean up themselves.' | 590 '%d new files were left in %s: Fix the tests to clean up themselves.' |
574 ) % ((new_temp_files - temp_files), tempfile.gettempdir()) | 591 ) % ((new_temp_files - temp_files), tempfile.gettempdir()) |
575 # TODO(maruel): Make it an error soon. Not yet since I want to iron out all | 592 # TODO(maruel): Make it an error soon. Not yet since I want to iron out all |
576 # the remaining cases before. | 593 # the remaining cases before. |
577 #result = 1 | 594 #result = 1 |
578 return result | 595 return result |
579 | 596 |
580 | 597 |
581 if '__main__' == __name__: | 598 if '__main__' == __name__: |
582 sys.exit(main()) | 599 sys.exit(main()) |
OLD | NEW |