| 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 797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 808 | 808 |
| 809 if options.platform is None: | 809 if options.platform is None: |
| 810 options.platform = path_utils.PlatformDir() | 810 options.platform = path_utils.PlatformDir() |
| 811 platform_new_results_dir = path_utils.PlatformNewResultsDir() | 811 platform_new_results_dir = path_utils.PlatformNewResultsDir() |
| 812 else: | 812 else: |
| 813 # If the user specified a platform on the command line then use | 813 # If the user specified a platform on the command line then use |
| 814 # that as the name of the output directory for rebaselined files. | 814 # that as the name of the output directory for rebaselined files. |
| 815 platform_new_results_dir = options.platform | 815 platform_new_results_dir = options.platform |
| 816 | 816 |
| 817 if not options.num_test_shells: | 817 if not options.num_test_shells: |
| 818 # Only run stable configurations with multiple test_shells by default. | 818 cpus = 1 |
| 819 if options.target == 'Release': | 819 if sys.platform in ('win32', 'cygwin'): |
| 820 cpus = 1 | 820 cpus = int(os.environ.get('NUMBER_OF_PROCESSORS', 1)) |
| 821 if sys.platform in ('win32', 'cygwin'): | 821 elif (hasattr(os, "sysconf") and |
| 822 cpus = int(os.environ.get('NUMBER_OF_PROCESSORS', 1)) | 822 os.sysconf_names.has_key("SC_NPROCESSORS_ONLN")): |
| 823 elif (hasattr(os, "sysconf") and | 823 # Linux & Unix: |
| 824 os.sysconf_names.has_key("SC_NPROCESSORS_ONLN")): | 824 ncpus = os.sysconf("SC_NPROCESSORS_ONLN") |
| 825 # Linux & Unix: | 825 if isinstance(ncpus, int) and ncpus > 0: |
| 826 ncpus = os.sysconf("SC_NPROCESSORS_ONLN") | 826 cpus = ncpus |
| 827 if isinstance(ncpus, int) and ncpus > 0: | 827 elif sys.platform in ('darwin'): # OSX: |
| 828 cpus = ncpus | 828 cpus = int(os.popen2("sysctl -n hw.ncpu")[1].read()) |
| 829 elif sys.platform in ('darwin'): # OSX: | |
| 830 cpus = int(os.popen2("sysctl -n hw.ncpu")[1].read()) | |
| 831 | 829 |
| 832 # TODO(ojan): Use cpus+1 once we flesh out the flakiness. | 830 # TODO(ojan): Use cpus+1 once we flesh out the flakiness. |
| 833 options.num_test_shells = cpus | 831 options.num_test_shells = cpus |
| 834 | |
| 835 else: | |
| 836 options.num_test_shells = 1 | |
| 837 | 832 |
| 838 logging.info("Running %s test_shells in parallel" % options.num_test_shells) | 833 logging.info("Running %s test_shells in parallel" % options.num_test_shells) |
| 839 | 834 |
| 840 if not options.time_out_ms: | 835 if not options.time_out_ms: |
| 841 if options.num_test_shells > 1: | 836 if options.num_test_shells > 1: |
| 842 options.time_out_ms = str(2 * TestRunner.DEFAULT_TEST_TIMEOUT_MS) | 837 options.time_out_ms = str(2 * TestRunner.DEFAULT_TEST_TIMEOUT_MS) |
| 843 else: | 838 else: |
| 844 options.time_out_ms = str(TestRunner.DEFAULT_TEST_TIMEOUT_MS) | 839 options.time_out_ms = str(TestRunner.DEFAULT_TEST_TIMEOUT_MS) |
| 845 | 840 |
| 846 # Include all tests if none are specified. | 841 # Include all tests if none are specified. |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 991 option_parser.add_option("", "--run-part", | 986 option_parser.add_option("", "--run-part", |
| 992 default=None, | 987 default=None, |
| 993 help=("Run a specified part (n:m), the nth of m" | 988 help=("Run a specified part (n:m), the nth of m" |
| 994 " parts, of the layout tests")) | 989 " parts, of the layout tests")) |
| 995 option_parser.add_option("", "--batch-size", | 990 option_parser.add_option("", "--batch-size", |
| 996 default=None, | 991 default=None, |
| 997 help=("Run a the tests in batches (n), after every " | 992 help=("Run a the tests in batches (n), after every " |
| 998 "n tests, the test shell is relaunched.")) | 993 "n tests, the test shell is relaunched.")) |
| 999 options, args = option_parser.parse_args() | 994 options, args = option_parser.parse_args() |
| 1000 main(options, args) | 995 main(options, args) |
| OLD | NEW |