| OLD | NEW |
| 1 #!/bin/env python | 1 #!/bin/env python |
| 2 # Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2006-2008 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 """Run layout tests using the test_shell. | 6 """Run layout tests using the test_shell. |
| 7 | 7 |
| 8 This is a port of the existing webkit test script run-webkit-tests. | 8 This is a port of the existing webkit test script run-webkit-tests. |
| 9 | 9 |
| 10 The TestRunner class runs a series of tests (TestType interface) against a set | 10 The TestRunner class runs a series of tests (TestType interface) against a set |
| (...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 672 basedir = path_utils.WebKitRoot() | 672 basedir = path_utils.WebKitRoot() |
| 673 basedir = os.path.join(basedir, options.target) | 673 basedir = os.path.join(basedir, options.target) |
| 674 | 674 |
| 675 options.results_directory = path_utils.GetAbsolutePath( | 675 options.results_directory = path_utils.GetAbsolutePath( |
| 676 os.path.join(basedir, options.results_directory)) | 676 os.path.join(basedir, options.results_directory)) |
| 677 | 677 |
| 678 if options.platform is None: | 678 if options.platform is None: |
| 679 options.platform = path_utils.PlatformDir() | 679 options.platform = path_utils.PlatformDir() |
| 680 | 680 |
| 681 if not options.num_test_shells: | 681 if not options.num_test_shells: |
| 682 # For now, only run Windows-Release in parallel until we make other | 682 # All configurations are still to flaky to have this on by default. |
| 683 # configurations more stable. | 683 if False: |
| 684 if sys.platform in ('win32', 'cygwin') and options.target == 'Release': | |
| 685 cpus = 1 | 684 cpus = 1 |
| 686 if sys.platform in ('win32', 'cygwin'): | 685 if sys.platform in ('win32', 'cygwin'): |
| 687 cpus = int(os.environ.get('NUMBER_OF_PROCESSORS', 1)) | 686 cpus = int(os.environ.get('NUMBER_OF_PROCESSORS', 1)) |
| 688 elif (hasattr(os, "sysconf") and | 687 elif (hasattr(os, "sysconf") and |
| 689 os.sysconf_names.has_key("SC_NPROCESSORS_ONLN")): | 688 os.sysconf_names.has_key("SC_NPROCESSORS_ONLN")): |
| 690 # Linux & Unix: | 689 # Linux & Unix: |
| 691 ncpus = os.sysconf("SC_NPROCESSORS_ONLN") | 690 ncpus = os.sysconf("SC_NPROCESSORS_ONLN") |
| 692 if isinstance(ncpus, int) and ncpus > 0: | 691 if isinstance(ncpus, int) and ncpus > 0: |
| 693 cpus = ncpus | 692 cpus = ncpus |
| 694 elif sys.platform in ('darwin'): # OSX: | 693 elif sys.platform in ('darwin'): # OSX: |
| 695 cpus = int(os.popen2("sysctl -n hw.ncpu")[1].read()) | 694 cpus = int(os.popen2("sysctl -n hw.ncpu")[1].read()) |
| 696 | 695 |
| 697 # TODO: Do timing tests on a single-core machine. | 696 # TODO: Do timing tests on a single-core machine. |
| 698 options.num_test_shells = 2 * cpus | 697 options.num_test_shells = 2 * cpus |
| 699 | 698 |
| 700 # Some HTTP tests start timing out when tests are run in parallel. | 699 # Some HTTP tests start timing out when tests are run in parallel. |
| 701 # TODO(ojan): Impelement per-test-timeouts instead. http://crbug.com/9613 | 700 # TODO(ojan): Impelement per-test-timeouts instead. http://crbug.com/9613 |
| 702 if not options.time_out_ms: | 701 if not options.time_out_ms: |
| 703 options.time_out_ms = '20000' | 702 options.time_out_ms = '20000' |
| 704 | 703 |
| 705 else: | 704 else: |
| 706 options.num_test_shells = 1 | 705 options.num_test_shells = 1 |
| 707 | 706 |
| 707 logging.info("Running %s test_shells in parallel" % options.num_test_shells) |
| 708 |
| 708 # Include all tests if none are specified. | 709 # Include all tests if none are specified. |
| 709 paths = args | 710 paths = args |
| 710 if not paths: | 711 if not paths: |
| 711 paths = [] | 712 paths = [] |
| 712 if options.test_list: | 713 if options.test_list: |
| 713 paths += ReadTestFiles(options.test_list) | 714 paths += ReadTestFiles(options.test_list) |
| 714 if not paths: | 715 if not paths: |
| 715 paths = ['.'] | 716 paths = ['.'] |
| 716 | 717 |
| 717 test_runner = TestRunner(options, paths) | 718 test_runner = TestRunner(options, paths) |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 851 option_parser.add_option("", "--run-part", | 852 option_parser.add_option("", "--run-part", |
| 852 default=None, | 853 default=None, |
| 853 help=("Run a specified part (n:m), the nth of m" | 854 help=("Run a specified part (n:m), the nth of m" |
| 854 " parts, of the layout tests")) | 855 " parts, of the layout tests")) |
| 855 option_parser.add_option("", "--batch-size", | 856 option_parser.add_option("", "--batch-size", |
| 856 default=None, | 857 default=None, |
| 857 help=("Run a the tests in batches (n), after every " | 858 help=("Run a the tests in batches (n), after every " |
| 858 "n tests, the test shell is relaunched.")) | 859 "n tests, the test shell is relaunched.")) |
| 859 options, args = option_parser.parse_args() | 860 options, args = option_parser.parse_args() |
| 860 main(options, args) | 861 main(options, args) |
| OLD | NEW |