| 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 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 # file attributes), and we'd rather have no sandbox than pull in an old | 308 # file attributes), and we'd rather have no sandbox than pull in an old |
| 309 # (possibly incompatible) one from the system. | 309 # (possibly incompatible) one from the system. |
| 310 os.environ['CHROME_DEVEL_SANDBOX'] = '' | 310 os.environ['CHROME_DEVEL_SANDBOX'] = '' |
| 311 | 311 |
| 312 # Nuke anything that appears to be stale chrome items in the temporary | 312 # Nuke anything that appears to be stale chrome items in the temporary |
| 313 # directory from previous test runs (i.e.- from crashes or unittest leaks). | 313 # directory from previous test runs (i.e.- from crashes or unittest leaks). |
| 314 slave_utils.RemoveChromeTemporaryFiles() | 314 slave_utils.RemoveChromeTemporaryFiles() |
| 315 | 315 |
| 316 os.environ['LD_LIBRARY_PATH'] = '%s:%s/lib:%s/lib.target' % (bin_dir, bin_dir, | 316 os.environ['LD_LIBRARY_PATH'] = '%s:%s/lib:%s/lib.target' % (bin_dir, bin_dir, |
| 317 bin_dir) | 317 bin_dir) |
| 318 # Figure out what we want for a special llvmpipe directory. |
| 319 if (options.llvmpipe_dir and os.path.exists(options.llvmpipe_dir)): |
| 320 os.environ['LD_LIBRARY_PATH'] += ':' + options.llvmpipe_dir |
| 321 |
| 318 if options.parallel: | 322 if options.parallel: |
| 319 supervisor_path = os.path.join(build_dir, '..', 'tools', | 323 supervisor_path = os.path.join(build_dir, '..', 'tools', |
| 320 'sharding_supervisor', | 324 'sharding_supervisor', |
| 321 'sharding_supervisor.py') | 325 'sharding_supervisor.py') |
| 322 supervisor_args = ['--no-color', '--retry-failed'] | 326 supervisor_args = ['--no-color', '--retry-failed'] |
| 323 if options.sharding_args: | 327 if options.sharding_args: |
| 324 supervisor_args.extend(options.sharding_args.split()) | 328 supervisor_args.extend(options.sharding_args.split()) |
| 325 command = [sys.executable, supervisor_path] | 329 command = [sys.executable, supervisor_path] |
| 326 command.extend(supervisor_args) | 330 command.extend(supervisor_args) |
| 327 command.append(test_exe_path) | 331 command.append(test_exe_path) |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 if options.enable_pageheap: | 437 if options.enable_pageheap: |
| 434 slave_utils.SetPageHeap(build_dir, 'chrome.exe', False) | 438 slave_utils.SetPageHeap(build_dir, 'chrome.exe', False) |
| 435 | 439 |
| 436 if options.generate_json_file: | 440 if options.generate_json_file: |
| 437 _GenerateJSONForTestResults(options, results_tracker) | 441 _GenerateJSONForTestResults(options, results_tracker) |
| 438 | 442 |
| 439 return result | 443 return result |
| 440 | 444 |
| 441 | 445 |
| 442 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 |
| 443 # Initialize logging. | 452 # Initialize logging. |
| 444 log_level = logging.INFO | 453 log_level = logging.INFO |
| 445 logging.basicConfig(level=log_level, | 454 logging.basicConfig(level=log_level, |
| 446 format='%(asctime)s %(filename)s:%(lineno)-3d' | 455 format='%(asctime)s %(filename)s:%(lineno)-3d' |
| 447 ' %(levelname)s %(message)s', | 456 ' %(levelname)s %(message)s', |
| 448 datefmt='%y%m%d %H:%M:%S') | 457 datefmt='%y%m%d %H:%M:%S') |
| 449 | 458 |
| 450 option_parser = optparse.OptionParser(usage=USAGE) | 459 option_parser = optparse.OptionParser(usage=USAGE) |
| 451 | 460 |
| 452 # 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 Loading... |
| 480 option_parser.add_option('', '--run-python-script', action='store_true', | 489 option_parser.add_option('', '--run-python-script', action='store_true', |
| 481 default=False, | 490 default=False, |
| 482 help='treat first argument as a python script' | 491 help='treat first argument as a python script' |
| 483 'to run.') | 492 'to run.') |
| 484 option_parser.add_option('', '--generate-json-file', action='store_true', | 493 option_parser.add_option('', '--generate-json-file', action='store_true', |
| 485 default=False, | 494 default=False, |
| 486 help='output JSON results file if specified.') | 495 help='output JSON results file if specified.') |
| 487 option_parser.add_option('', '--parallel', action='store_true', | 496 option_parser.add_option('', '--parallel', action='store_true', |
| 488 help='Shard and run tests in parallel for speed ' | 497 help='Shard and run tests in parallel for speed ' |
| 489 'with sharding_supervisor.') | 498 'with sharding_supervisor.') |
| 490 option_parser.add_option('', '--special-xvfb-dir', default=os.path.join( | 499 option_parser.add_option('', '--llvmpipe', action='store_const', |
| 491 os.path.dirname(sys.argv[0]), '..', '..', 'xvfb'), | 500 value=xvfb_path, dest='llvmpipe_dir', |
| 501 help='Use software gpu pipe directory.') |
| 502 option_parser.add_option('', '--no-llvmpipe', action='store_false', |
| 503 value=None, dest='llvmpipe_dir', |
| 504 help='Do not use software gpu pipe directory.') |
| 505 option_parser.add_option('', '--llvmpipe-dir', |
| 506 default=None, dest='llvmpipe_dir', |
| 507 help='Path to software gpu library directory.') |
| 508 option_parser.add_option('', '--special-xvfb-dir', default=xvfb_path, |
| 492 help='Path to virtual X server directory on Linux.') | 509 help='Path to virtual X server directory on Linux.') |
| 493 option_parser.add_option('', '--special-xvfb', action='store_true', | 510 option_parser.add_option('', '--special-xvfb', action='store_true', |
| 494 default='auto', | 511 default='auto', |
| 495 help='use non-default virtual X server on Linux.') | 512 help='use non-default virtual X server on Linux.') |
| 496 option_parser.add_option('', '--no-special-xvfb', action='store_false', | 513 option_parser.add_option('', '--no-special-xvfb', action='store_false', |
| 497 dest='special_xvfb', | 514 dest='special_xvfb', |
| 498 help='Use default virtual X server on Linux.') | 515 help='Use default virtual X server on Linux.') |
| 499 option_parser.add_option('', '--auto-special-xvfb', action='store_const', | 516 option_parser.add_option('', '--auto-special-xvfb', action='store_const', |
| 500 const='auto', dest='special_xvfb', | 517 const='auto', dest='special_xvfb', |
| 501 help='Guess as to virtual X server on Linux.') | 518 help='Guess as to virtual X server on Linux.') |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 574 '%d new files were left in %s: Fix the tests to clean up themselves.' | 591 '%d new files were left in %s: Fix the tests to clean up themselves.' |
| 575 ) % ((new_temp_files - temp_files), tempfile.gettempdir()) | 592 ) % ((new_temp_files - temp_files), tempfile.gettempdir()) |
| 576 # TODO(maruel): Make it an error soon. Not yet since I want to iron out all | 593 # TODO(maruel): Make it an error soon. Not yet since I want to iron out all |
| 577 # the remaining cases before. | 594 # the remaining cases before. |
| 578 #result = 1 | 595 #result = 1 |
| 579 return result | 596 return result |
| 580 | 597 |
| 581 | 598 |
| 582 if '__main__' == __name__: | 599 if '__main__' == __name__: |
| 583 sys.exit(main()) | 600 sys.exit(main()) |
| OLD | NEW |