Chromium Code Reviews| 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 os | |
| 8 | |
| 7 from webkitpy.layout_tests.servers import server_base | 9 from webkitpy.layout_tests.servers import server_base |
| 8 | 10 |
| 9 | 11 |
| 10 class WPTServe(server_base.ServerBase): | 12 class WPTServe(server_base.ServerBase): |
| 11 | 13 |
| 12 def __init__(self, port_obj, output_dir): | 14 def __init__(self, port_obj, output_dir): |
| 13 super(WPTServe, self).__init__(port_obj, output_dir) | 15 super(WPTServe, self).__init__(port_obj, output_dir) |
| 14 # These ports must match wpt_support/wpt.config.json | 16 # These ports must match wpt_support/wpt.config.json |
| 15 http_port, http_alt_port, https_port = (8001, 8081, 8444) | 17 http_port, http_alt_port, https_port = (8001, 8081, 8444) |
| 16 ws_port, wss_port = (9001, 9444) | 18 ws_port, wss_port = (9001, 9444) |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 41 # TODO(burnik): Merge with default start_cmd once we roll in websockets. | 43 # TODO(burnik): Merge with default start_cmd once we roll in websockets. |
| 42 if self._port_obj.host.filesystem.exists(path_to_ws_handlers): | 44 if self._port_obj.host.filesystem.exists(path_to_ws_handlers): |
| 43 start_cmd += ['--ws_doc_root', path_to_ws_handlers] | 45 start_cmd += ['--ws_doc_root', path_to_ws_handlers] |
| 44 | 46 |
| 45 # TODO(tkent): Do not suppress console output on Windows until | 47 # TODO(tkent): Do not suppress console output on Windows until |
| 46 # crbug.com/623613 is resolved. | 48 # crbug.com/623613 is resolved. |
| 47 if not self._platform.is_win(): | 49 if not self._platform.is_win(): |
| 48 self._stdout = self._stderr = self._executive.DEVNULL | 50 self._stdout = self._stderr = self._executive.DEVNULL |
| 49 # TODO(burnik): We should stop setting the CWD once WPT can be run witho ut it. | 51 # TODO(burnik): We should stop setting the CWD once WPT can be run witho ut it. |
| 50 self._cwd = path_to_wpt_root | 52 self._cwd = path_to_wpt_root |
| 51 self._env = {'PYTHONPATH': path_to_thirdparty} | 53 self._env = os.environ.copy() |
|
qyearsley
2016/10/14 15:56:37
Could you change this to:
self._env = port_obj.
tkent
2016/10/14 16:07:04
Done.
I haven't tested Patch Set 2 on Windows. A
| |
| 54 self._env.update({'PYTHONPATH': path_to_thirdparty}) | |
| 52 self._keep_process_reference = True | 55 self._keep_process_reference = True |
| 53 self._start_cmd = start_cmd | 56 self._start_cmd = start_cmd |
| 54 | 57 |
| 55 def _stop_running_server(self): | 58 def _stop_running_server(self): |
| 56 # Clean up the pid file. | 59 # Clean up the pid file. |
| 57 if self._pid and not self._executive.check_running_pid(self._pid): | 60 if self._pid and not self._executive.check_running_pid(self._pid): |
| 58 self._filesystem.remove(self._pid_file) | 61 self._filesystem.remove(self._pid_file) |
| 59 return | 62 return |
| 60 | 63 |
| 61 # TODO(burnik): Figure out a cleaner way of stopping wptserve. | 64 # TODO(burnik): Figure out a cleaner way of stopping wptserve. |
| 62 self._executive.interrupt(self._pid) | 65 self._executive.interrupt(self._pid) |
| 63 | 66 |
| 64 # According to Popen.wait(), this can deadlock when using stdout=PIPE an d/or stderr=PIPE. | 67 # According to Popen.wait(), this can deadlock when using stdout=PIPE an d/or stderr=PIPE. |
| 65 # We're using DEVNULL for both so that should not occur. | 68 # We're using DEVNULL for both so that should not occur. |
| 66 self._process.wait() | 69 self._process.wait() |
| OLD | NEW |