2010-02-10 Dirk Pranke <dpranke@chromium.org>
authoreric@webkit.org <eric@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 11 Feb 2010 01:50:45 +0000 (01:50 +0000)
committereric@webkit.org <eric@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 11 Feb 2010 01:50:45 +0000 (01:50 +0000)
        Reviewed by Eric Seidel.

        Fix various minor bugs keeping run-chromium-webkit-tests from actually
        working on the linux and win ports of Chromium.

        https://bugs.webkit.org/show_bug.cgi?id=34739

        * Scripts/webkitpy/layout_tests/layout_package/test_shell_thread.py:
        * Scripts/webkitpy/layout_tests/port/__init__.py:
        * Scripts/webkitpy/layout_tests/port/base.py:
        * Scripts/webkitpy/layout_tests/port/chromium.py:
        * Scripts/webkitpy/layout_tests/port/chromium_linux.py:
        * Scripts/webkitpy/layout_tests/port/chromium_win.py:
        * Scripts/webkitpy/layout_tests/port/http_server.py:
        * Scripts/webkitpy/layout_tests/port/websocket_server.py:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@54635 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKitTools/ChangeLog
WebKitTools/Scripts/webkitpy/layout_tests/layout_package/test_shell_thread.py
WebKitTools/Scripts/webkitpy/layout_tests/port/__init__.py
WebKitTools/Scripts/webkitpy/layout_tests/port/base.py
WebKitTools/Scripts/webkitpy/layout_tests/port/chromium.py
WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_linux.py
WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_win.py
WebKitTools/Scripts/webkitpy/layout_tests/port/http_server.py
WebKitTools/Scripts/webkitpy/layout_tests/port/websocket_server.py

index 286190a..c2609a7 100644 (file)
@@ -1,3 +1,21 @@
+2010-02-10  Dirk Pranke  <dpranke@chromium.org>
+
+        Reviewed by Eric Seidel.
+
+        Fix various minor bugs keeping run-chromium-webkit-tests from actually
+        working on the linux and win ports of Chromium.
+
+        https://bugs.webkit.org/show_bug.cgi?id=34739
+
+        * Scripts/webkitpy/layout_tests/layout_package/test_shell_thread.py:
+        * Scripts/webkitpy/layout_tests/port/__init__.py:
+        * Scripts/webkitpy/layout_tests/port/base.py:
+        * Scripts/webkitpy/layout_tests/port/chromium.py:
+        * Scripts/webkitpy/layout_tests/port/chromium_linux.py:
+        * Scripts/webkitpy/layout_tests/port/chromium_win.py:
+        * Scripts/webkitpy/layout_tests/port/http_server.py:
+        * Scripts/webkitpy/layout_tests/port/websocket_server.py:
+
 2010-02-10  Eric Seidel  <eric@webkit.org>
 
         Reviewed by David Levin.
index f0e5252..3452035 100644 (file)
@@ -86,7 +86,7 @@ def process_output(port, test_info, test_types, test_args, target, output_dir,
         filename = os.path.splitext(filename)[0] + "-stack.txt"
         port.maybe_make_directory(os.path.split(filename)[0])
         open(filename, "wb").write(error)
-    else:
+    elif error:
         logging.debug("Previous test output extra lines after dump:\n%s" %
             error)
 
index 4d8751d..3509675 100644 (file)
 """Port-specific entrypoints for the layout tests test infrastructure."""
 
 
+import sys
+
+
 def get(port_name=None, options=None):
     """Returns an object implementing the Port interface. If
     port_name is None, this routine attempts to guess at the most
     appropriate port on this platform."""
     port_to_use = port_name
     if port_to_use is None:
-        port_to_use = 'chromium-mac'
+        if sys.platform == 'win32':
+            port_to_use = 'chromium-win'
+        elif sys.platform == 'linux2':
+            port_to_use = 'chromium-linux'
+        elif sys.platform == 'darwin':
+            port_to_use = 'chromium-mac'
 
     if port_to_use == 'test':
         import test
@@ -50,8 +58,8 @@ def get(port_name=None, options=None):
     elif port_to_use.startswith('chromium-linux'):
         import chromium_linux
         return chromium_linux.ChromiumLinuxPort(port_name, options)
-    elif port_to_use.startwith('chromium-win'):
+    elif port_to_use.startswith('chromium-win'):
         import chromium_win
         return chromium_win.ChromiumWinPort(port_name, options)
 
-    raise NotImplementedError('unsupported port: %s' % port_name)
+    raise NotImplementedError('unsupported port: %s' % port_to_use)
index 4c1c666..ce06b44 100644 (file)
@@ -105,7 +105,7 @@ class Port(object):
                 raise e
         except ValueError:
             # work around a race condition in Python 2.4's implementation
-            # of subprocess.Popen
+            # of subprocess.Popen. See http://bugs.python.org/issue1199282 .
             pass
         return result
 
@@ -485,8 +485,13 @@ class Port(object):
             # the Popen raises a ValueError.
             # http://bugs.python.org/issue1236
             if _wdiff_available:
-                wdiff = subprocess.Popen(cmd,
-                    stdout=subprocess.PIPE).communicate()[0]
+                try:
+                    wdiff = subprocess.Popen(cmd,
+                        stdout=subprocess.PIPE).communicate()[0]
+                except ValueError, e:
+                    # Working around a race in Python 2.4's implementation
+                    # of Popen().
+                    wdiff = ''
                 wdiff = cgi.escape(wdiff)
                 wdiff = wdiff.replace('##WDIFF_DEL##', '<span class=del>')
                 wdiff = wdiff.replace('##WDIFF_ADD##', '<span class=add>')
index 64d1412..8fd5343 100644 (file)
@@ -47,9 +47,9 @@ class ChromiumLinuxPort(chromium.ChromiumPort):
 
     def baseline_search_path(self):
         return [self.baseline_path(),
-                self.chromium_baseline_path('chromium-win'),
-                self.webkit_baseline_path('win'),
-                self.webkit_baseline_path('mac')]
+                self._chromium_baseline_path('chromium-win'),
+                self._webkit_baseline_path('win'),
+                self._webkit_baseline_path('mac')]
 
     def check_sys_deps(self):
         # We have no platform-specific dependencies to check.
@@ -74,8 +74,13 @@ class ChromiumLinuxPort(chromium.ChromiumPort):
     #
 
     def _build_path(self, *comps):
-        return self.path_from_chromium_base('sconsbuild', self._options.target,
-                                            *comps)
+        base = self.path_from_chromium_base()
+        if os.path.exists(os.path.join(base, 'sconsbuild')):
+            return self.path_from_chromium_base('sconsbuild',
+                self._options.target, *comps)
+        else:
+            return self.path_from_chromium_base('out',
+                self._options.target, *comps)
 
     def _kill_process(self, pid):
         """Forcefully kill the process.
index f79932d..352916c 100644 (file)
@@ -33,6 +33,7 @@ import os
 import platform
 import signal
 import subprocess
+import sys
 
 import chromium
 
@@ -46,13 +47,14 @@ class ChromiumWinPort(chromium.ChromiumPort):
         chromium.ChromiumPort.__init__(self, port_name, options)
 
     def baseline_search_path(self):
+        dirs = []
         if self._name == 'chromium-win-xp':
-            dirs.append(self.baseline_path(self._name))
+            dirs.append(self._chromium_baseline_path(self._name))
         if self._name in ('chromium-win-xp', 'chromium-win-vista'):
-            dirs.append(self.baseline_path('chromium-win-vista'))
-        dirs.append(self.baseline_path('chromium-win'))
-        dirs.append(self.webkit_baseline_path('win'))
-        dirs.append(self.webkit_baseline_path('mac'))
+            dirs.append(self._chromium_baseline_path('chromium-win-vista'))
+        dirs.append(self._chromium_baseline_path('chromium-win'))
+        dirs.append(self._webkit_baseline_path('win'))
+        dirs.append(self._webkit_baseline_path('mac'))
         return dirs
 
     def check_sys_deps(self):
@@ -62,11 +64,15 @@ class ChromiumWinPort(chromium.ChromiumPort):
     def get_absolute_path(self, filename):
         """Return the absolute path in unix format for the given filename."""
         abspath = os.path.abspath(filename)
-        return path.replace('\\', '/')
+        return abspath.replace('\\', '/')
 
     def num_cores(self):
         return int(os.environ.get('NUMBER_OF_PROCESSORS', 1))
 
+    def relative_test_filename(self, filename):
+        path = filename[len(self.layout_tests_dir()) + 1:]
+        return path.replace('\\', '/')
+
     def test_platform_name(self):
         # We return 'win-xp', not 'chromium-win-xp' here, for convenience.
         return 'win' + self.version()
@@ -113,13 +119,13 @@ class ChromiumWinPort(chromium.ChromiumPort):
                             'cygwin-httpd.conf')
 
     def _path_to_lighttpd(self):
-        return self._lighttp_path('LightTPD.exe')
+        return self._lighttpd_path('LightTPD.exe')
 
     def _path_to_lighttpd_modules(self):
-        return self._lighttp_path('lib')
+        return self._lighttpd_path('lib')
 
     def _path_to_lighttpd_php(self):
-        return self._lighttp_path('php5', 'php-cgi.exe')
+        return self._lighttpd_path('php5', 'php-cgi.exe')
 
     def _path_to_driver(self):
         return self._build_path('test_shell.exe')
@@ -128,7 +134,7 @@ class ChromiumWinPort(chromium.ChromiumPort):
         return self._build_path('layout_test_helper.exe')
 
     def _path_to_image_diff(self):
-        return self._build_path('layout_test_helper.exe')
+        return self._build_path('image_diff.exe')
 
     def _path_to_wdiff(self):
         return self.path_from_chromium_base('third_party', 'cygwin', 'bin',
index b24b9c0..0315704 100755 (executable)
@@ -66,13 +66,13 @@ class Lighttpd(http_server_base.HttpServerBase):
             self._port = int(self._port)
 
         try:
-            _webkit_tests = os.path.join(self._port_obj.layout_tests_dir(),
-                 'http', 'tests')
-            _webkit_tests = os.path.join(self._port_obj.layout_tests_dir(),
-                 'fast', 'js', 'resources')
+            self._webkit_tests = os.path.join(
+                self._port_obj.layout_tests_dir(), 'http', 'tests')
+            self._js_test_resource = os.path.join(
+                self._port_obj.layout_tests_dir(), 'fast', 'js', 'resources')
         except:
-            _webkit_tests = None
-            _js_test_resource = None
+            self._webkit_tests = None
+            self._js_test_resource = None
 
         # Self generated certificate for SSL server (for client cert get
         # <base-path>\chrome\test\data\ssl\certs\root_ca_cert.crt)
@@ -80,14 +80,14 @@ class Lighttpd(http_server_base.HttpServerBase):
             os.path.dirname(os.path.abspath(__file__)), 'httpd2.pem')
 
         # One mapping where we can get to everything
-        VIRTUALCONFIG = []
+        self.VIRTUALCONFIG = []
 
-        if _webkit_tests:
-            VIRTUALCONFIG.extend(
+        if self._webkit_tests:
+            self.VIRTUALCONFIG.extend(
                # Three mappings (one with SSL) for LayoutTests http tests
-               [{'port': 8000, 'docroot': _webkit_tests},
-                {'port': 8080, 'docroot': _webkit_tests},
-                {'port': 8443, 'docroot': _webkit_tests,
+               [{'port': 8000, 'docroot': self._webkit_tests},
+                {'port': 8080, 'docroot': self._webkit_tests},
+                {'port': 8443, 'docroot': self._webkit_tests,
                  'sslcert': self._pem_file}])
 
     def is_running(self):
@@ -97,9 +97,8 @@ class Lighttpd(http_server_base.HttpServerBase):
         if self.is_running():
             raise 'Lighttpd already running'
 
-        base_conf_file = self._port_obj.path_from_base('third_party',
-            'WebKitTools', 'Scripts', 'webkitpy', 'layout_tests',
-            'port', 'lighttpd.conf')
+        base_conf_file = self._port_obj.path_from_webkit_base('WebKitTools',
+            'Scripts', 'webkitpy', 'layout_tests', 'port', 'lighttpd.conf')
         out_conf_file = os.path.join(self._output_dir, 'lighttpd.conf')
         time_str = time.strftime("%d%b%Y-%H%M%S")
         access_file_name = "access.log-" + time_str + ".txt"
@@ -174,8 +173,7 @@ class Lighttpd(http_server_base.HttpServerBase):
         module_path = self._port_obj._path_to_lighttpd_modules()
         start_cmd = [executable,
                      # Newly written config file
-                     '-f', self._port_obj._path_from_base(self._output_dir,
-                                                         'lighttpd.conf'),
+                     '-f', os.path.join(self._output_dir, 'lighttpd.conf'),
                      # Where it can find its module dynamic libraries
                      '-m', module_path]
 
@@ -197,12 +195,13 @@ class Lighttpd(http_server_base.HttpServerBase):
         env = os.environ
         if sys.platform in ('cygwin', 'win32'):
             env['PATH'] = '%s;%s' % (
-                port.path_from_base('third_party', 'cygwin', 'bin'),
+                self._port_obj.path_from_chromium_base('third_party',
+                                                       'cygwin', 'bin'),
                 env['PATH'])
 
         if sys.platform == 'win32' and self._register_cygwin:
-            setup_mount = port.path_from_base('third_party', 'cygwin',
-                                                    'setup_mount.bat')
+            setup_mount = port.path_from_chromium_base('third_party',
+                'cygwin', 'setup_mount.bat')
             subprocess.Popen(setup_mount).wait()
 
         logging.debug('Starting http server')
@@ -229,7 +228,7 @@ class Lighttpd(http_server_base.HttpServerBase):
         httpd_pid = None
         if self._process:
             httpd_pid = self._process.pid
-        port._shut_down_http_server(httpd_pid)
+        self._port_obj._shut_down_http_server(httpd_pid)
 
         if self._process:
             self._process.wait()
index 4274676..ba8a5e9 100644 (file)
@@ -179,12 +179,13 @@ class PyWebSocket(http_server.Lighttpd):
         env = os.environ
         if sys.platform in ('cygwin', 'win32'):
             env['PATH'] = '%s;%s' % (
-                self._port_obj._path_from_base('third_party', 'cygwin', 'bin'),
+                self._port_obj.path_from_chromium_base('third_party',
+                                                       'cygwin', 'bin'),
                 env['PATH'])
 
         if sys.platform == 'win32' and self._register_cygwin:
-            setup_mount = self._port_obj._path_from_base('third_party',
-                 'cygwin', 'setup_mount.bat')
+            setup_mount = self._port_obj.path_from_chromium_base(
+                'third_party', 'cygwin', 'setup_mount.bat')
             subprocess.Popen(setup_mount).wait()
 
         env['PYTHONPATH'] = (pywebsocket_base + os.path.pathsep +