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 from webkitpy.layout_tests.servers import server_base | 9 from webkitpy.layout_tests.servers import server_base |
10 | 10 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
42 | 42 |
43 # 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. |
44 if self._port_obj.host.filesystem.exists(path_to_ws_handlers): | 44 if self._port_obj.host.filesystem.exists(path_to_ws_handlers): |
45 start_cmd += ['--ws_doc_root', path_to_ws_handlers] | 45 start_cmd += ['--ws_doc_root', path_to_ws_handlers] |
46 | 46 |
47 self._stdout = self._stderr = self._executive.DEVNULL | 47 self._stdout = self._stderr = self._executive.DEVNULL |
48 # TODO(burnik): We should stop setting the CWD once WPT can be run witho ut it. | 48 # TODO(burnik): We should stop setting the CWD once WPT can be run witho ut it. |
49 self._cwd = path_to_wpt_root | 49 self._cwd = path_to_wpt_root |
50 self._env = port_obj.host.environ.copy() | 50 self._env = port_obj.host.environ.copy() |
51 self._env.update({'PYTHONPATH': path_to_thirdparty}) | 51 self._env.update({'PYTHONPATH': path_to_thirdparty}) |
52 self._keep_process_reference = True | |
qyearsley
2017/01/11 23:52:23
This is also unused, but removing this line is not
| |
53 self._start_cmd = start_cmd | 52 self._start_cmd = start_cmd |
54 | 53 |
55 expiration_date = datetime.date(2025, 1, 4) | 54 expiration_date = datetime.date(2025, 1, 4) |
56 if datetime.date.today() > expiration_date - datetime.timedelta(30): | 55 if datetime.date.today() > expiration_date - datetime.timedelta(30): |
57 logging.getLogger(__name__).error( | 56 logging.getLogger(__name__).error( |
58 'Pre-generated keys and certificates are going to be expired at %s.' | 57 'Pre-generated keys and certificates are going to be expired at %s.' |
59 ' Please re-generate them by following steps in %s/README.chromi um.' | 58 ' Please re-generate them by following steps in %s/README.chromi um.' |
60 % (expiration_date.strftime('%b %d %Y'), path_to_wpt_support)) | 59 % (expiration_date.strftime('%b %d %Y'), path_to_wpt_support)) |
61 | |
62 def _stop_running_server(self): | |
63 while self._pid and self._executive.check_running_pid(self._pid): | |
64 # TODO(burnik): Figure out a cleaner way of stopping wptserve. | |
65 if self._platform.is_win(): | |
66 self._executive.kill_process(self._pid) | |
67 else: | |
68 self._executive.interrupt(self._pid) | |
69 | |
70 # According to Popen.wait(), this can deadlock when using stdout=PIP E and/or stderr=PIPE. | |
71 # We're using DEVNULL for both so that should not occur. | |
72 if self._process is not None: | |
73 self._process.wait() | |
74 | |
75 # Clean up the pid file. | |
76 if self._filesystem.exists(self._pid_file): | |
77 self._filesystem.remove(self._pid_file) | |
OLD | NEW |