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 = TestRunner._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 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
669 print | 672 print |
670 self._PrintTestListTiming("Tests marked as SLOW:", slow_tests) | 673 self._PrintTestListTiming("Tests marked as SLOW:", slow_tests) |
671 print | 674 print |
672 self._PrintTestListTiming("Tests that timed out or crashed:", | 675 self._PrintTestListTiming("Tests that timed out or crashed:", |
673 timeout_or_crash_tests) | 676 timeout_or_crash_tests) |
674 print | 677 print |
675 | 678 |
676 def _PrintTestListTiming(self, title, test_list): | 679 def _PrintTestListTiming(self, title, test_list): |
677 logging.debug(title) | 680 logging.debug(title) |
678 for test_tuple in test_list: | 681 for test_tuple in test_list: |
679 filename = test_tuple.filename[len(path_utils.LayoutDataDir()) + 1:] | 682 filename = test_tuple.filename[len(path_utils.LayoutTestsDir()) + 1:] |
680 filename = filename.replace('\\', '/') | 683 filename = filename.replace('\\', '/') |
681 test_run_time = round(test_tuple.test_run_time, 1) | 684 test_run_time = round(test_tuple.test_run_time, 1) |
682 logging.debug("%s took %s seconds" % (filename, test_run_time)) | 685 logging.debug("%s took %s seconds" % (filename, test_run_time)) |
683 | 686 |
684 def _PrintDirectoryTimings(self, directory_test_timings): | 687 def _PrintDirectoryTimings(self, directory_test_timings): |
685 timings = [] | 688 timings = [] |
686 for directory in directory_test_timings: | 689 for directory in directory_test_timings: |
687 num_tests, time_for_directory = directory_test_timings[directory] | 690 num_tests, time_for_directory = directory_test_timings[directory] |
688 timings.append((round(time_for_directory, 1), directory, num_tests)) | 691 timings.append((round(time_for_directory, 1), directory, num_tests)) |
689 timings.sort() | 692 timings.sort() |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
995 options.time_out_ms = str(2 * TestRunner.DEFAULT_TEST_TIMEOUT_MS) | 998 options.time_out_ms = str(2 * TestRunner.DEFAULT_TEST_TIMEOUT_MS) |
996 else: | 999 else: |
997 options.time_out_ms = str(TestRunner.DEFAULT_TEST_TIMEOUT_MS) | 1000 options.time_out_ms = str(TestRunner.DEFAULT_TEST_TIMEOUT_MS) |
998 | 1001 |
999 # Include all tests if none are specified. | 1002 # Include all tests if none are specified. |
1000 paths = args | 1003 paths = args |
1001 if not paths: | 1004 if not paths: |
1002 paths = [] | 1005 paths = [] |
1003 if options.test_list: | 1006 if options.test_list: |
1004 paths += ReadTestFiles(options.test_list) | 1007 paths += ReadTestFiles(options.test_list) |
1005 if not paths: | |
1006 paths = ['.'] | |
1007 | 1008 |
1008 test_runner = TestRunner(options, paths, platform_new_results_dir) | 1009 test_runner = TestRunner(options, paths, platform_new_results_dir) |
1009 | 1010 |
1010 if options.lint_test_files: | 1011 if options.lint_test_files: |
1011 # Just creating the TestRunner checks the syntax of the test lists. | 1012 # Just creating the TestRunner checks the syntax of the test lists. |
1012 print ("If there are no fail messages, errors or exceptions, then the " | 1013 print ("If there are no fail messages, errors or exceptions, then the " |
1013 "lint succeeded.") | 1014 "lint succeeded.") |
1014 return | 1015 return |
1015 | 1016 |
1016 try: | 1017 try: |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1144 option_parser.add_option("", "--run-part", | 1145 option_parser.add_option("", "--run-part", |
1145 default=None, | 1146 default=None, |
1146 help=("Run a specified part (n:m), the nth of m" | 1147 help=("Run a specified part (n:m), the nth of m" |
1147 " parts, of the layout tests")) | 1148 " parts, of the layout tests")) |
1148 option_parser.add_option("", "--batch-size", | 1149 option_parser.add_option("", "--batch-size", |
1149 default=None, | 1150 default=None, |
1150 help=("Run a the tests in batches (n), after every " | 1151 help=("Run a the tests in batches (n), after every " |
1151 "n tests, the test shell is relaunched.")) | 1152 "n tests, the test shell is relaunched.")) |
1152 options, args = option_parser.parse_args() | 1153 options, args = option_parser.parse_args() |
1153 main(options, args) | 1154 main(options, args) |
OLD | NEW |