| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2006-2009 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 """Initialize test runner data structures. | 124 """Initialize test runner data structures. |
| 125 | 125 |
| 126 Args: | 126 Args: |
| 127 options: a dictionary of command line options | 127 options: a dictionary of command line options |
| 128 """ | 128 """ |
| 129 self._options = options | 129 self._options = options |
| 130 | 130 |
| 131 self._http_server = http_server.Lighttpd(options.results_directory) | 131 self._http_server = http_server.Lighttpd(options.results_directory) |
| 132 self._websocket_server = websocket_server.PyWebSocket( | 132 self._websocket_server = websocket_server.PyWebSocket( |
| 133 options.results_directory) | 133 options.results_directory) |
| 134 self._websocket_secure_server = websocket_server.PyWebSocket( | 134 # disable wss server. need to install pyOpenSSL on buildbots. |
| 135 options.results_directory, use_tls=True, port=9323) | 135 # self._websocket_secure_server = websocket_server.PyWebSocket( |
| 136 # options.results_directory, use_tls=True, port=9323) |
| 136 | 137 |
| 137 # a list of TestType objects | 138 # a list of TestType objects |
| 138 self._test_types = [] | 139 self._test_types = [] |
| 139 | 140 |
| 140 # a set of test files, and the same tests as a list | 141 # a set of test files, and the same tests as a list |
| 141 self._test_files = set() | 142 self._test_files = set() |
| 142 self._test_files_list = None | 143 self._test_files_list = None |
| 143 self._file_dir = path_utils.GetAbsolutePath(os.path.dirname(sys.argv[0])) | 144 self._file_dir = path_utils.GetAbsolutePath(os.path.dirname(sys.argv[0])) |
| 144 | 145 |
| 145 def __del__(self): | 146 def __del__(self): |
| 146 logging.info("flushing stdout") | 147 logging.info("flushing stdout") |
| 147 sys.stdout.flush() | 148 sys.stdout.flush() |
| 148 logging.info("flushing stderr") | 149 logging.info("flushing stderr") |
| 149 sys.stderr.flush() | 150 sys.stderr.flush() |
| 150 logging.info("stopping http server") | 151 logging.info("stopping http server") |
| 151 # Stop the http server. | 152 # Stop the http server. |
| 152 self._http_server.Stop() | 153 self._http_server.Stop() |
| 153 # Stop the Web Socket / Web Socket Secure servers. | 154 # Stop the Web Socket / Web Socket Secure servers. |
| 154 self._websocket_server.Stop() | 155 self._websocket_server.Stop() |
| 155 self._websocket_secure_server.Stop() | 156 # self._websocket_secure_server.Stop() |
| 156 | 157 |
| 157 def GatherFilePaths(self, paths): | 158 def GatherFilePaths(self, paths): |
| 158 """Find all the files to test. | 159 """Find all the files to test. |
| 159 | 160 |
| 160 args: | 161 args: |
| 161 paths: a list of globs to use instead of the defaults.""" | 162 paths: a list of globs to use instead of the defaults.""" |
| 162 self._test_files = test_files.GatherTestFiles(paths) | 163 self._test_files = test_files.GatherTestFiles(paths) |
| 163 logging.info('Found: %d tests' % len(self._test_files)) | 164 logging.info('Found: %d tests' % len(self._test_files)) |
| 164 | 165 |
| 165 def ParseExpectations(self, platform, is_debug_mode): | 166 def ParseExpectations(self, platform, is_debug_mode): |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 filename_queue = self._GetTestFileQueue(test_files) | 458 filename_queue = self._GetTestFileQueue(test_files) |
| 458 | 459 |
| 459 # If we have http tests, the first one will be an http test. | 460 # If we have http tests, the first one will be an http test. |
| 460 if ((test_files and test_files[0].find(self.HTTP_SUBDIR) >= 0) | 461 if ((test_files and test_files[0].find(self.HTTP_SUBDIR) >= 0) |
| 461 or self._options.randomize_order): | 462 or self._options.randomize_order): |
| 462 self._http_server.Start() | 463 self._http_server.Start() |
| 463 | 464 |
| 464 # Start Web Socket server. | 465 # Start Web Socket server. |
| 465 if (self._ContainWebSocketTest(test_files)): | 466 if (self._ContainWebSocketTest(test_files)): |
| 466 self._websocket_server.Start() | 467 self._websocket_server.Start() |
| 467 self._websocket_secure_server.Start() | 468 # self._websocket_secure_server.Start() |
| 468 | 469 |
| 469 # Instantiate TestShellThreads and start them. | 470 # Instantiate TestShellThreads and start them. |
| 470 threads = [] | 471 threads = [] |
| 471 for i in xrange(int(self._options.num_test_shells)): | 472 for i in xrange(int(self._options.num_test_shells)): |
| 472 # Create separate TestTypes instances for each thread. | 473 # Create separate TestTypes instances for each thread. |
| 473 test_types = [] | 474 test_types = [] |
| 474 for t in self._test_types: | 475 for t in self._test_types: |
| 475 test_types.append(t(self._options.platform, | 476 test_types.append(t(self._options.platform, |
| 476 self._options.results_directory)) | 477 self._options.results_directory)) |
| 477 | 478 |
| (...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1268 "this script.")) | 1269 "this script.")) |
| 1269 option_parser.add_option("", "--find-baselines", action="store_true", | 1270 option_parser.add_option("", "--find-baselines", action="store_true", |
| 1270 default=False, | 1271 default=False, |
| 1271 help="Prints a table mapping tests to their " | 1272 help="Prints a table mapping tests to their " |
| 1272 "expected results") | 1273 "expected results") |
| 1273 option_parser.add_option("", "--experimental-fully-parallel", | 1274 option_parser.add_option("", "--experimental-fully-parallel", |
| 1274 action="store_true", default=False, | 1275 action="store_true", default=False, |
| 1275 help="run all tests in parallel") | 1276 help="run all tests in parallel") |
| 1276 options, args = option_parser.parse_args() | 1277 options, args = option_parser.parse_args() |
| 1277 main(options, args) | 1278 main(options, args) |
| OLD | NEW |