| 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 from webkitpy.layout_tests.servers import server_base | 7 from webkitpy.layout_tests.servers import server_base |
| 8 | 8 |
| 9 | 9 |
| 10 class WPTServe(server_base.ServerBase): | 10 class WPTServe(server_base.ServerBase): |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 # TODO(burnik): Merge with default start_cmd once we roll in websockets. | 41 # TODO(burnik): Merge with default start_cmd once we roll in websockets. |
| 42 if self._port_obj.host.filesystem.exists(path_to_ws_handlers): | 42 if self._port_obj.host.filesystem.exists(path_to_ws_handlers): |
| 43 start_cmd += ['--ws_doc_root', path_to_ws_handlers] | 43 start_cmd += ['--ws_doc_root', path_to_ws_handlers] |
| 44 | 44 |
| 45 # TODO(tkent): Do not suppress console output on Windows until | 45 # TODO(tkent): Do not suppress console output on Windows until |
| 46 # crbug.com/623613 is resolved. | 46 # crbug.com/623613 is resolved. |
| 47 if not self._platform.is_win(): | 47 if not self._platform.is_win(): |
| 48 self._stdout = self._stderr = self._executive.DEVNULL | 48 self._stdout = self._stderr = self._executive.DEVNULL |
| 49 # TODO(burnik): We should stop setting the CWD once WPT can be run witho
ut it. | 49 # TODO(burnik): We should stop setting the CWD once WPT can be run witho
ut it. |
| 50 self._cwd = path_to_wpt_root | 50 self._cwd = path_to_wpt_root |
| 51 self._env = {'PYTHONPATH': path_to_thirdparty} | 51 self._env = port_obj.host.environ.copy() |
| 52 self._env.update({'PYTHONPATH': path_to_thirdparty}) |
| 52 self._keep_process_reference = True | 53 self._keep_process_reference = True |
| 53 self._start_cmd = start_cmd | 54 self._start_cmd = start_cmd |
| 54 | 55 |
| 55 def _stop_running_server(self): | 56 def _stop_running_server(self): |
| 56 # Clean up the pid file. | 57 # Clean up the pid file. |
| 57 if self._pid and not self._executive.check_running_pid(self._pid): | 58 if self._pid and not self._executive.check_running_pid(self._pid): |
| 58 self._filesystem.remove(self._pid_file) | 59 self._filesystem.remove(self._pid_file) |
| 59 return | 60 return |
| 60 | 61 |
| 61 # TODO(burnik): Figure out a cleaner way of stopping wptserve. | 62 # TODO(burnik): Figure out a cleaner way of stopping wptserve. |
| 62 self._executive.interrupt(self._pid) | 63 self._executive.interrupt(self._pid) |
| 63 | 64 |
| 64 # According to Popen.wait(), this can deadlock when using stdout=PIPE an
d/or stderr=PIPE. | 65 # 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. | 66 # We're using DEVNULL for both so that should not occur. |
| 66 self._process.wait() | 67 self._process.wait() |
| OLD | NEW |