Title: [88680] trunk/Tools
Revision
88680
Author
[email protected]
Date
2011-06-13 13:20:05 -0700 (Mon, 13 Jun 2011)

Log Message

2011-06-13  Sheriff Bot  <[email protected]>

        Unreviewed, rolling out r88671.
        http://trac.webkit.org/changeset/88671
        https://bugs.webkit.org/show_bug.cgi?id=62591

        "didn't work" (Requested by dpranke on #webkit).

        * Scripts/new-run-webkit-httpd:
        * Scripts/webkitpy/layout_tests/port/apache_http_server.py:
        * Scripts/webkitpy/layout_tests/port/http_server.py:
        * Scripts/webkitpy/layout_tests/port/http_server_base.py:
        * Scripts/webkitpy/layout_tests/port/http_server_integrationtest.py: Removed.
        * Scripts/webkitpy/layout_tests/port/port_testcase.py:
        * Scripts/webkitpy/layout_tests/port/websocket_server.py:

Modified Paths

Removed Paths

Diff

Modified: trunk/Tools/ChangeLog (88679 => 88680)


--- trunk/Tools/ChangeLog	2011-06-13 20:19:07 UTC (rev 88679)
+++ trunk/Tools/ChangeLog	2011-06-13 20:20:05 UTC (rev 88680)
@@ -1,3 +1,19 @@
+2011-06-13  Sheriff Bot  <[email protected]>
+
+        Unreviewed, rolling out r88671.
+        http://trac.webkit.org/changeset/88671
+        https://bugs.webkit.org/show_bug.cgi?id=62591
+
+        "didn't work" (Requested by dpranke on #webkit).
+
+        * Scripts/new-run-webkit-httpd:
+        * Scripts/webkitpy/layout_tests/port/apache_http_server.py:
+        * Scripts/webkitpy/layout_tests/port/http_server.py:
+        * Scripts/webkitpy/layout_tests/port/http_server_base.py:
+        * Scripts/webkitpy/layout_tests/port/http_server_integrationtest.py: Removed.
+        * Scripts/webkitpy/layout_tests/port/port_testcase.py:
+        * Scripts/webkitpy/layout_tests/port/websocket_server.py:
+
 2011-06-13  Nate Chapin  <[email protected]>
 
         Reviewed by Darin Fisher.

Modified: trunk/Tools/Scripts/new-run-webkit-httpd (88679 => 88680)


--- trunk/Tools/Scripts/new-run-webkit-httpd	2011-06-13 20:19:07 UTC (rev 88679)
+++ trunk/Tools/Scripts/new-run-webkit-httpd	2011-06-13 20:20:05 UTC (rev 88680)
@@ -70,13 +70,9 @@
         if options.server == 'start':
             httpd.start()
         else:
-            # FIXME: We use _shut_down_http_server() instead of stop_http_server()
-            # because stop() only works if start() was called previously in the
-            # same process. _shut_down() is too coarse and may kill unrelated 
-            # web servers, so this is a hack. We should change the interface so we
-            # can rely on pid files or something.
-            port_obj._shut_down_http_server(None)
+            httpd.stop(force=True)
 
+
 def main():
     option_parser = optparse.OptionParser()
     option_parser.add_option('-k', '--server',

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/apache_http_server.py (88679 => 88680)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/apache_http_server.py	2011-06-13 20:19:07 UTC (rev 88679)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/apache_http_server.py	2011-06-13 20:20:05 UTC (rev 88680)
@@ -227,9 +227,7 @@
         """Stops the apache http server."""
         _log.debug("Shutting down any running http servers")
         httpd_pid = None
-        if self._httpd_proc:
-            httpd_pid = self._httpd_proc.pid
-        elif os.path.exists(self._pid_file):
+        if os.path.exists(self._pid_file):
             httpd_pid = int(open(self._pid_file).readline())
-        if httpd_pid:
-            self._executive.kill_process(httpd_pid)
+        # FIXME: We shouldn't be calling a protected method of _port_obj!
+        self._port_obj._shut_down_http_server(httpd_pid)

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/http_server.py (88679 => 88680)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/http_server.py	2011-06-13 20:19:07 UTC (rev 88679)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/http_server.py	2011-06-13 20:20:05 UTC (rev 88680)
@@ -226,14 +226,14 @@
     # TODO(deanm): Find a nicer way to shutdown cleanly.  Our log files are
     # probably not being flushed, etc... why doesn't our python have os.kill ?
 
-    def stop(self):
-        if not self.is_running():
+    def stop(self, force=False):
+        if not force and not self.is_running():
             return
 
         httpd_pid = None
         if self._process:
             httpd_pid = self._process.pid
-        self._executive.kill_process(httpd_pid)
+        self._port_obj._shut_down_http_server(httpd_pid)
 
         if self._process:
             # wait() is not threadsafe and can throw OSError due to:

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/http_server_base.py (88679 => 88680)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/http_server_base.py	2011-06-13 20:19:07 UTC (rev 88679)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/http_server_base.py	2011-06-13 20:20:05 UTC (rev 88680)
@@ -43,7 +43,6 @@
 
     def __init__(self, port_obj):
         self._port_obj = port_obj
-        self._executive = port_obj._executive
 
     def wait_for_action(self, action):
         """Repeat the action for 20 seconds or until it succeeds. Returns

Deleted: trunk/Tools/Scripts/webkitpy/layout_tests/port/http_server_integrationtest.py (88679 => 88680)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/http_server_integrationtest.py	2011-06-13 20:19:07 UTC (rev 88679)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/http_server_integrationtest.py	2011-06-13 20:20:05 UTC (rev 88680)
@@ -1,126 +0,0 @@
-# Copyright (C) 2011 Google Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-#    * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-#    * Redistributions in binary form must reproduce the above
-# copyright notice, this list of conditions and the following disclaimer
-# in the documentation and/or other materials provided with the
-# distribution.
-#    * Neither the name of Google Inc. nor the names of its
-# contributors may be used to endorse or promote products derived from
-# this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-"""Integration testing for the new-run-webkit-httpd script"""
-
-import errno
-import os
-import socket
-import subprocess
-import sys
-import tempfile
-import unittest
-
-from webkitpy.layout_tests.port import port_testcase
-
-
-class NewRunWebKitHTTPdTest(unittest.TestCase):
-    """Tests that new-run-webkit-httpd must pass."""
-    HTTP_PORTS = (8000, 8080, 8443)
-
-    def assert_servers_are_down(self, host, ports):
-        for port in ports:
-            try:
-                test_socket = socket.socket()
-                test_socket.connect((host, port))
-                self.fail()
-            except IOError, e:
-                self.assertTrue(e.errno in (errno.ECONNREFUSED, errno.ECONNRESET))
-            finally:
-                test_socket.close()
-
-    def assert_servers_are_up(self, host, ports):
-        for port in ports:
-            try:
-                test_socket = socket.socket()
-                test_socket.connect((host, port))
-            except IOError, e:
-                self.fail('failed to connect to %s:%d' % (host, port))
-            finally:
-                test_socket.close()
-
-    def run_script(self, args):
-        script_dir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
-        script_path = os.path.join(script_dir, 'new-run-webkit-httpd')
-        return subprocess.call([sys.executable, script_path] + args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
-
-    def integration_test_http_server__normal(self):
-        self.assert_servers_are_down('localhost', self.HTTP_PORTS)
-        self.assertEquals(self.run_script(['--server', 'start']), 0)
-        self.assert_servers_are_up('localhost', self.HTTP_PORTS)
-        self.assertEquals(self.run_script(['--server', 'stop']), 0)
-        self.assert_servers_are_down('localhost', self.HTTP_PORTS)
-
-    def integration_test_http_server__fails(self):
-        # Test that if a port isn't available, the call fails.
-        for port_number in self.HTTP_PORTS:
-            test_socket = socket.socket()
-            try:
-                try:
-                    test_socket.bind(('localhost', port_number))
-                except socket.error, e:
-                    if e.errno in (errno.EADDRINUSE, errno.EALREADY):
-                        self.fail('could not bind to port %d: %s' % (port_number, str(e)))
-                    raise
-                self.assertEquals(self.run_script(['--server', 'start']), 1)
-            finally:
-                self.run_script(['--server', 'stop'])
-                test_socket.close()
-
-        # Test that calling start() twice fails.
-        try:
-            self.assertEquals(self.run_script(['--server', 'start']), 0)
-            self.assertEquals(self.run_script(['--server', 'start']), 1)
-        finally:
-            self.run_script(['--server', 'stop'])
-
-        # Test that calling stop() twice is harmless.
-        self.assertEquals(self.run_script(['--server', 'stop']), 0)
-
-    def maybe_make_dir(self, *comps):
-        try:
-            os.makedirs(os.path.join(*comps))
-        except OSError, e:
-            if e.errno != errno.EEXIST:
-                raise
-
-    def integration_test_http_server_port_and_root(self):
-        tmpdir = tempfile.mkdtemp(prefix='webkitpytest')
-        self.maybe_make_dir(tmpdir, 'http', 'tests')
-        self.maybe_make_dir(tmpdir, 'fast', 'js', 'resources')
-        self.maybe_make_dir(tmpdir, 'media')
-
-        self.assert_servers_are_down('localhost', [18000])
-        self.assertEquals(self.run_script(['--server', 'start', '--port=18000', '--root', tmpdir]), 0)
-        self.assert_servers_are_up('localhost', [18000])
-        self.assertEquals(self.run_script(['--server', 'stop']), 0)
-        self.assert_servers_are_down('localhost', [18000])
-
-
-if __name__ == '__main__':
-    port_testcase.main()

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py (88679 => 88680)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py	2011-06-13 20:19:07 UTC (rev 88679)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py	2011-06-13 20:20:05 UTC (rev 88680)
@@ -48,9 +48,10 @@
 
 class PortTestCase(unittest.TestCase):
     """Tests that all Port implementations must pass."""
-    HTTP_PORTS = (8000, 8080, 8443)
-    WEBSOCKET_PORTS = (8880,)
 
+    HTTP_PORTS = [8000, 8080, 8443]
+    WEBSOCKET_PORTS = [8880]
+
     def port_maker(self, platform):
         """Override to return the class object of the port to be tested,
         or None if a valid port object cannot be constructed on the specified
@@ -91,23 +92,23 @@
     def assert_servers_are_down(self, host, ports):
         for port in ports:
             try:
-                test_socket = socket.socket()
-                test_socket.connect((host, port))
+                s = socket.socket()
+                s.connect((host, port))
                 self.fail()
             except IOError, e:
                 self.assertTrue(e.errno in (errno.ECONNREFUSED, errno.ECONNRESET))
             finally:
-                test_socket.close()
+                s.close()
 
     def assert_servers_are_up(self, host, ports):
         for port in ports:
             try:
-                test_socket = socket.socket()
-                test_socket.connect((host, port))
+                s = socket.socket()
+                s.connect((host, port))
             except IOError, e:
                 self.fail('failed to connect to %s:%d' % (host, port))
             finally:
-                test_socket.close()
+                s.close()
 
     def integration_test_http_lock(self):
         port = self.make_port()
@@ -136,6 +137,7 @@
         port = self.make_port()
         if not port:
             return
+
         self.assert_servers_are_down('localhost', self.HTTP_PORTS)
         port.start_http_server()
         self.assert_servers_are_up('localhost', self.HTTP_PORTS)
@@ -146,12 +148,13 @@
         port = self.make_port()
         if not port:
             return
+
         # Test that if a port isn't available, the call fails.
         for port_number in self.HTTP_PORTS:
-            test_socket = socket.socket()
+            s = socket.socket()
             try:
                 try:
-                    test_socket.bind(('localhost', port_number))
+                    s.bind(('localhost', port_number))
                 except socket.error, e:
                     if e.errno in (errno.EADDRINUSE, errno.EALREADY):
                         self.fail('could not bind to port %d' % port_number)
@@ -163,7 +166,7 @@
                     pass
             finally:
                 port.stop_http_server()
-                test_socket.close()
+                s.close()
 
         # Test that calling start() twice fails.
         try:
@@ -257,9 +260,9 @@
 
         # Test that start() fails if a port isn't available.
         for port_number in self.WEBSOCKET_PORTS:
-            test_socket = socket.socket()
+            s = socket.socket()
             try:
-                test_socket.bind(('localhost', port_number))
+                s.bind(('localhost', port_number))
                 try:
                     port.start_websocket_server()
                     self.fail('should not have been able to start the server while bound to %d' % port_number)
@@ -267,7 +270,7 @@
                     pass
             finally:
                 port.stop_websocket_server()
-                test_socket.close()
+                s.close()
 
         # Test that calling start() twice fails.
         try:

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/websocket_server.py (88679 => 88680)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/websocket_server.py	2011-06-13 20:19:07 UTC (rev 88679)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/websocket_server.py	2011-06-13 20:20:05 UTC (rev 88680)
@@ -209,7 +209,9 @@
         url = "" + '://127.0.0.1:%d/' % self._port
         if not url_is_alive(url):
             if self._process.returncode == None:
-                self._executive.kill_process(self._process.pid)
+                # FIXME: We should use a non-static Executive for easier
+                # testing.
+                Executive().kill_process(self._process.pid)
             with codecs.open(output_log, "r", "utf-8") as fp:
                 for line in fp:
                     _log.error(line)
@@ -225,8 +227,8 @@
             with codecs.open(self._pidfile, "w", "ascii") as file:
                 file.write("%d" % self._process.pid)
 
-    def stop(self):
-        if not self.is_running():
+    def stop(self, force=False):
+        if not force and not self.is_running():
             return
 
         pid = None
@@ -241,7 +243,8 @@
                 'Failed to find %s server pid.' % self._server_name)
 
         _log.debug('Shutting down %s server %d.' % (self._server_name, pid))
-        self._executive.kill_process(pid)
+        # FIXME: We should use a non-static Executive for easier testing.
+        Executive().kill_process(pid)
 
         if self._process:
             # wait() is not threadsafe and can throw OSError due to:
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to