| 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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 self._http_server.Stop() | 139 self._http_server.Stop() |
| 140 | 140 |
| 141 def _GatherTestFiles(self, paths): | 141 def _GatherTestFiles(self, paths): |
| 142 """Generate a set of test files and place them in self._test_files | 142 """Generate a set of test files and place them in self._test_files |
| 143 | 143 |
| 144 Args: | 144 Args: |
| 145 paths: a list of command line paths relative to the webkit/tests | 145 paths: a list of command line paths relative to the webkit/tests |
| 146 directory. glob patterns are ok. | 146 directory. glob patterns are ok. |
| 147 """ | 147 """ |
| 148 paths_to_walk = set() | 148 paths_to_walk = set() |
| 149 # if paths is empty, provide a pre-defined list. |
| 150 if not paths: |
| 151 paths = _shardable_directories |
| 149 for path in paths: | 152 for path in paths: |
| 150 # If there's an * in the name, assume it's a glob pattern. | 153 # If there's an * in the name, assume it's a glob pattern. |
| 151 path = os.path.join(path_utils.LayoutDataDir(), path) | 154 path = os.path.join(path_utils.LayoutTestsDir(path), path) |
| 152 if path.find('*') > -1: | 155 if path.find('*') > -1: |
| 153 filenames = glob.glob(path) | 156 filenames = glob.glob(path) |
| 154 paths_to_walk.update(filenames) | 157 paths_to_walk.update(filenames) |
| 155 else: | 158 else: |
| 156 paths_to_walk.add(path) | 159 paths_to_walk.add(path) |
| 157 | 160 |
| 158 # Now walk all the paths passed in on the command line and get filenames | 161 # Now walk all the paths passed in on the command line and get filenames |
| 159 for path in paths_to_walk: | 162 for path in paths_to_walk: |
| 160 if os.path.isfile(path) and self._HasSupportedExtension(path): | 163 if os.path.isfile(path) and self._HasSupportedExtension(path): |
| 161 self._test_files.add(os.path.normpath(path)) | 164 self._test_files.add(os.path.normpath(path)) |
| (...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 969 options.time_out_ms = str(2 * TestRunner.DEFAULT_TEST_TIMEOUT_MS) | 972 options.time_out_ms = str(2 * TestRunner.DEFAULT_TEST_TIMEOUT_MS) |
| 970 else: | 973 else: |
| 971 options.time_out_ms = str(TestRunner.DEFAULT_TEST_TIMEOUT_MS) | 974 options.time_out_ms = str(TestRunner.DEFAULT_TEST_TIMEOUT_MS) |
| 972 | 975 |
| 973 # Include all tests if none are specified. | 976 # Include all tests if none are specified. |
| 974 paths = args | 977 paths = args |
| 975 if not paths: | 978 if not paths: |
| 976 paths = [] | 979 paths = [] |
| 977 if options.test_list: | 980 if options.test_list: |
| 978 paths += ReadTestFiles(options.test_list) | 981 paths += ReadTestFiles(options.test_list) |
| 979 if not paths: | |
| 980 paths = ['.'] | |
| 981 | 982 |
| 982 test_runner = TestRunner(options, paths, platform_new_results_dir) | 983 test_runner = TestRunner(options, paths, platform_new_results_dir) |
| 983 | 984 |
| 984 if options.lint_test_files: | 985 if options.lint_test_files: |
| 985 # Just creating the TestRunner checks the syntax of the test lists. | 986 # Just creating the TestRunner checks the syntax of the test lists. |
| 986 print ("If there are no fail messages, errors or exceptions, then the " | 987 print ("If there are no fail messages, errors or exceptions, then the " |
| 987 "lint succeeded.") | 988 "lint succeeded.") |
| 988 return | 989 return |
| 989 | 990 |
| 990 try: | 991 try: |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1118 option_parser.add_option("", "--run-part", | 1119 option_parser.add_option("", "--run-part", |
| 1119 default=None, | 1120 default=None, |
| 1120 help=("Run a specified part (n:m), the nth of m" | 1121 help=("Run a specified part (n:m), the nth of m" |
| 1121 " parts, of the layout tests")) | 1122 " parts, of the layout tests")) |
| 1122 option_parser.add_option("", "--batch-size", | 1123 option_parser.add_option("", "--batch-size", |
| 1123 default=None, | 1124 default=None, |
| 1124 help=("Run a the tests in batches (n), after every " | 1125 help=("Run a the tests in batches (n), after every " |
| 1125 "n tests, the test shell is relaunched.")) | 1126 "n tests, the test shell is relaunched.")) |
| 1126 options, args = option_parser.parse_args() | 1127 options, args = option_parser.parse_args() |
| 1127 main(options, args) | 1128 main(options, args) |
| OLD | NEW |