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 |
| 8 import logging |
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 26 matching lines...) Expand all Loading... |
43 start_cmd += ['--ws_doc_root', path_to_ws_handlers] | 45 start_cmd += ['--ws_doc_root', path_to_ws_handlers] |
44 | 46 |
45 self._stdout = self._stderr = self._executive.DEVNULL | 47 self._stdout = self._stderr = self._executive.DEVNULL |
46 # 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. |
47 self._cwd = path_to_wpt_root | 49 self._cwd = path_to_wpt_root |
48 self._env = port_obj.host.environ.copy() | 50 self._env = port_obj.host.environ.copy() |
49 self._env.update({'PYTHONPATH': path_to_thirdparty}) | 51 self._env.update({'PYTHONPATH': path_to_thirdparty}) |
50 self._keep_process_reference = True | 52 self._keep_process_reference = True |
51 self._start_cmd = start_cmd | 53 self._start_cmd = start_cmd |
52 | 54 |
| 55 expiration_date = datetime.date(2025, 1, 4) |
| 56 if datetime.date.today() > expiration_date - datetime.timedelta(30): |
| 57 logging.getLogger(__name__).error( |
| 58 '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.' |
| 60 % (expiration_date.strftime('%b %d %Y'), path_to_wpt_support)) |
| 61 |
53 def _stop_running_server(self): | 62 def _stop_running_server(self): |
54 # Clean up the pid file. | 63 # Clean up the pid file. |
55 if self._pid and not self._executive.check_running_pid(self._pid): | 64 if self._pid and not self._executive.check_running_pid(self._pid): |
56 self._filesystem.remove(self._pid_file) | 65 self._filesystem.remove(self._pid_file) |
57 return | 66 return |
58 | 67 |
59 # TODO(burnik): Figure out a cleaner way of stopping wptserve. | 68 # TODO(burnik): Figure out a cleaner way of stopping wptserve. |
60 if self._platform.is_win(): | 69 if self._platform.is_win(): |
61 self._executive.kill_process(self._pid) | 70 self._executive.kill_process(self._pid) |
62 else: | 71 else: |
63 self._executive.interrupt(self._pid) | 72 self._executive.interrupt(self._pid) |
64 | 73 |
65 # According to Popen.wait(), this can deadlock when using stdout=PIPE an
d/or stderr=PIPE. | 74 # According to Popen.wait(), this can deadlock when using stdout=PIPE an
d/or stderr=PIPE. |
66 # We're using DEVNULL for both so that should not occur. | 75 # We're using DEVNULL for both so that should not occur. |
67 self._process.wait() | 76 self._process.wait() |
OLD | NEW |