| OLD | NEW |
| 1 # Copyright (C) 2011 Google Inc. All rights reserved. | 1 # Copyright (C) 2011 Google Inc. All rights reserved. |
| 2 # | 2 # |
| 3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
| 4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
| 5 # met: | 5 # met: |
| 6 # | 6 # |
| 7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
| 8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
| 9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
| 10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 22 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 28 | 28 |
| 29 """Start and stop the Apache HTTP server as it is used by the layout tests.""" | 29 """Start and stop the Apache HTTP server as it is used by the layout tests.""" |
| 30 | 30 |
| 31 import logging | 31 import logging |
| 32 import os | |
| 33 import socket | 32 import socket |
| 34 | 33 |
| 35 from webkitpy.layout_tests.servers import server_base | 34 from webkitpy.layout_tests.servers import server_base |
| 36 | 35 |
| 37 | 36 |
| 38 _log = logging.getLogger(__name__) | 37 _log = logging.getLogger(__name__) |
| 39 | 38 |
| 40 | 39 |
| 41 class ApacheHTTP(server_base.ServerBase): | 40 class ApacheHTTP(server_base.ServerBase): |
| 42 | 41 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 '-c', 'SSLCertificateFile "%s"' % cert_file, | 88 '-c', 'SSLCertificateFile "%s"' % cert_file, |
| 90 '-c', 'Alias /inspector-sources "%s"' % inspector_sources_dir, | 89 '-c', 'Alias /inspector-sources "%s"' % inspector_sources_dir, |
| 91 ] | 90 ] |
| 92 | 91 |
| 93 if self._is_win: | 92 if self._is_win: |
| 94 start_cmd += ['-c', "ThreadsPerChild %d" % (self._number_of_servers
* 8)] | 93 start_cmd += ['-c', "ThreadsPerChild %d" % (self._number_of_servers
* 8)] |
| 95 else: | 94 else: |
| 96 start_cmd += ['-c', "StartServers %d" % self._number_of_servers, | 95 start_cmd += ['-c', "StartServers %d" % self._number_of_servers, |
| 97 '-c', "MinSpareServers %d" % self._number_of_servers, | 96 '-c', "MinSpareServers %d" % self._number_of_servers, |
| 98 '-c', "MaxSpareServers %d" % self._number_of_servers, | 97 '-c', "MaxSpareServers %d" % self._number_of_servers, |
| 99 '-C', 'User "%s"' % os.environ.get('USERNAME', os.envi
ron.get('USER', '')), | 98 '-C', 'User "%s"' % self._port_obj.host.environ.get('U
SERNAME', self._port_obj.host.environ.get('USER', '')), |
| 100 '-k', 'start'] | 99 '-k', 'start'] |
| 101 | 100 |
| 102 enable_ipv6 = self._port_obj.http_server_supports_ipv6() | 101 enable_ipv6 = self._port_obj.http_server_supports_ipv6() |
| 103 # Perform part of the checks Apache's APR does when trying to listen to | 102 # Perform part of the checks Apache's APR does when trying to listen to |
| 104 # a specific host/port. This allows us to avoid trying to listen to | 103 # a specific host/port. This allows us to avoid trying to listen to |
| 105 # IPV6 addresses when it fails on Apache. APR itself tries to call | 104 # IPV6 addresses when it fails on Apache. APR itself tries to call |
| 106 # getaddrinfo() again without AI_ADDRCONFIG if the first call fails | 105 # getaddrinfo() again without AI_ADDRCONFIG if the first call fails |
| 107 # with EBADFLAGS, but that is not how it normally fails in our use | 106 # with EBADFLAGS, but that is not how it normally fails in our use |
| 108 # cases, so ignore that for now. | 107 # cases, so ignore that for now. |
| 109 # See https://bugs.webkit.org/show_bug.cgi?id=98602#c7 | 108 # See https://bugs.webkit.org/show_bug.cgi?id=98602#c7 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 retval = proc.returncode | 170 retval = proc.returncode |
| 172 err = proc.stderr.read() | 171 err = proc.stderr.read() |
| 173 if retval or len(err): | 172 if retval or len(err): |
| 174 raise server_base.ServerError('Failed to stop %s: %s' % (self._name,
err)) | 173 raise server_base.ServerError('Failed to stop %s: %s' % (self._name,
err)) |
| 175 | 174 |
| 176 # For some reason apache isn't guaranteed to have actually stopped after | 175 # For some reason apache isn't guaranteed to have actually stopped after |
| 177 # the stop command returns, so we wait a little while longer for the | 176 # the stop command returns, so we wait a little while longer for the |
| 178 # pid file to be removed. | 177 # pid file to be removed. |
| 179 if not self._wait_for_action(lambda: not self._filesystem.exists(self._p
id_file)): | 178 if not self._wait_for_action(lambda: not self._filesystem.exists(self._p
id_file)): |
| 180 raise server_base.ServerError('Failed to stop %s: pid file still exi
sts' % self._name) | 179 raise server_base.ServerError('Failed to stop %s: pid file still exi
sts' % self._name) |
| OLD | NEW |