| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 self._start_cmd = start_cmd | 53 self._start_cmd = start_cmd |
| 54 | 54 |
| 55 expiration_date = datetime.date(2025, 1, 4) | 55 expiration_date = datetime.date(2025, 1, 4) |
| 56 if datetime.date.today() > expiration_date - datetime.timedelta(30): | 56 if datetime.date.today() > expiration_date - datetime.timedelta(30): |
| 57 logging.getLogger(__name__).error( | 57 logging.getLogger(__name__).error( |
| 58 'Pre-generated keys and certificates are going to be expired at
%s.' | 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.' | 59 ' Please re-generate them by following steps in %s/README.chromi
um.' |
| 60 % (expiration_date.strftime('%b %d %Y'), path_to_wpt_support)) | 60 % (expiration_date.strftime('%b %d %Y'), path_to_wpt_support)) |
| 61 | 61 |
| 62 def _stop_running_server(self): | 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 |
| 63 # Clean up the pid file. | 75 # Clean up the pid file. |
| 64 if self._pid and not self._executive.check_running_pid(self._pid): | 76 if self._filesystem.exists(self._pid_file): |
| 65 self._filesystem.remove(self._pid_file) | 77 self._filesystem.remove(self._pid_file) |
| 66 return | |
| 67 | |
| 68 # TODO(burnik): Figure out a cleaner way of stopping wptserve. | |
| 69 if self._platform.is_win(): | |
| 70 self._executive.kill_process(self._pid) | |
| 71 else: | |
| 72 self._executive.interrupt(self._pid) | |
| 73 | |
| 74 # According to Popen.wait(), this can deadlock when using stdout=PIPE an
d/or stderr=PIPE. | |
| 75 # We're using DEVNULL for both so that should not occur. | |
| 76 self._process.wait() | |
| OLD | NEW |