| OLD | NEW |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """Start and stop the WPTserve servers as they're used by the layout tests.""" | 5 """Start and stop the WPTserve servers as they're used by the layout tests.""" |
| 6 | 6 |
| 7 import datetime | 7 import datetime |
| 8 import logging | 8 import logging |
| 9 | 9 |
| 10 from webkitpy.common.webkit_finder import WebKitFinder | 10 from webkitpy.common.path_finder import PathFinder |
| 11 from webkitpy.layout_tests.servers import server_base | 11 from webkitpy.layout_tests.servers import server_base |
| 12 | 12 |
| 13 | 13 |
| 14 _log = logging.getLogger(__name__) | 14 _log = logging.getLogger(__name__) |
| 15 | 15 |
| 16 | 16 |
| 17 class WPTServe(server_base.ServerBase): | 17 class WPTServe(server_base.ServerBase): |
| 18 | 18 |
| 19 def __init__(self, port_obj, output_dir): | 19 def __init__(self, port_obj, output_dir): |
| 20 super(WPTServe, self).__init__(port_obj, output_dir) | 20 super(WPTServe, self).__init__(port_obj, output_dir) |
| 21 # These ports must match wpt_support/wpt.config.json | 21 # These ports must match wpt_support/wpt.config.json |
| 22 http_port, http_alt_port, https_port = (8001, 8081, 8444) | 22 http_port, http_alt_port, https_port = (8001, 8081, 8444) |
| 23 ws_port, wss_port = (9001, 9444) | 23 ws_port, wss_port = (9001, 9444) |
| 24 self._name = 'wptserve' | 24 self._name = 'wptserve' |
| 25 self._log_prefixes = ('access_log', 'error_log') | 25 self._log_prefixes = ('access_log', 'error_log') |
| 26 self._mappings = [{'port': http_port}, | 26 self._mappings = [{'port': http_port}, |
| 27 {'port': http_alt_port}, | 27 {'port': http_alt_port}, |
| 28 {'port': https_port, 'sslcert': True}, | 28 {'port': https_port, 'sslcert': True}, |
| 29 {'port': ws_port}, | 29 {'port': ws_port}, |
| 30 {'port': wss_port, 'sslcert': True}] | 30 {'port': wss_port, 'sslcert': True}] |
| 31 | 31 |
| 32 # TODO(burnik): We can probably avoid PID files for WPT in the future. | 32 # TODO(burnik): We can probably avoid PID files for WPT in the future. |
| 33 fs = self._filesystem | 33 fs = self._filesystem |
| 34 self._pid_file = fs.join(self._runtime_path, '%s.pid' % self._name) | 34 self._pid_file = fs.join(self._runtime_path, '%s.pid' % self._name) |
| 35 | 35 |
| 36 finder = WebKitFinder(fs) | 36 finder = PathFinder(fs) |
| 37 path_to_thirdparty = finder.path_from_tools_scripts('webkitpy', 'thirdpa
rty') | 37 path_to_thirdparty = finder.path_from_tools_scripts('webkitpy', 'thirdpa
rty') |
| 38 path_to_wpt_support = finder.path_from_tools_scripts('webkitpy', 'thirdp
arty', 'wpt') | 38 path_to_wpt_support = finder.path_from_tools_scripts('webkitpy', 'thirdp
arty', 'wpt') |
| 39 path_to_wpt_root = fs.join(path_to_wpt_support, 'wpt') | 39 path_to_wpt_root = fs.join(path_to_wpt_support, 'wpt') |
| 40 path_to_wpt_config = fs.join(path_to_wpt_support, 'wpt.config.json') | 40 path_to_wpt_config = fs.join(path_to_wpt_support, 'wpt.config.json') |
| 41 path_to_wpt_tests = fs.abspath(fs.join(self._port_obj.layout_tests_dir()
, 'external', 'wpt')) | 41 path_to_wpt_tests = fs.abspath(fs.join(self._port_obj.layout_tests_dir()
, 'external', 'wpt')) |
| 42 path_to_ws_handlers = fs.join(path_to_wpt_tests, 'websockets', 'handlers
') | 42 path_to_ws_handlers = fs.join(path_to_wpt_tests, 'websockets', 'handlers
') |
| 43 serve_script = fs.join(path_to_wpt_root, 'serve') | 43 serve_script = fs.join(path_to_wpt_root, 'serve') |
| 44 start_cmd = [self._port_obj.host.executable, | 44 start_cmd = [self._port_obj.host.executable, |
| 45 '-u', serve_script, | 45 '-u', serve_script, |
| 46 '--config', path_to_wpt_config, | 46 '--config', path_to_wpt_config, |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 self._executive.kill_process(self._pid) | 87 self._executive.kill_process(self._pid) |
| 88 else: | 88 else: |
| 89 self._executive.interrupt(self._pid) | 89 self._executive.interrupt(self._pid) |
| 90 | 90 |
| 91 # According to Popen.wait(), this can deadlock when using stdout=PIPE or | 91 # According to Popen.wait(), this can deadlock when using stdout=PIPE or |
| 92 # stderr=PIPE. We're using DEVNULL for both so that should not occur. | 92 # stderr=PIPE. We're using DEVNULL for both so that should not occur. |
| 93 if self._process is not None: | 93 if self._process is not None: |
| 94 self._process.wait() | 94 self._process.wait() |
| 95 | 95 |
| 96 return False | 96 return False |
| OLD | NEW |