Title: [98819] trunk/Tools
Revision
98819
Author
[email protected]
Date
2011-10-29 15:06:50 -0700 (Sat, 29 Oct 2011)

Log Message

new-run-webkit-tests is locale dependent
https://bugs.webkit.org/show_bug.cgi?id=68691

Reviewed by Adam Barth.

Make NRWT use a clean environment just like ORWT did.
I've manually validated that NRWT now copies over
the same environment variables that ORWT did.
This new code is exercised by existing setup_environ_for_server tests.

* Scripts/webkitpy/layout_tests/port/base.py:
* Scripts/webkitpy/layout_tests/port/efl.py:
* Scripts/webkitpy/layout_tests/port/mac.py:
* Scripts/webkitpy/layout_tests/port/qt.py:
* Scripts/webkitpy/layout_tests/port/webkit.py:
* Scripts/webkitpy/layout_tests/port/win.py:

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (98818 => 98819)


--- trunk/Tools/ChangeLog	2011-10-29 22:04:11 UTC (rev 98818)
+++ trunk/Tools/ChangeLog	2011-10-29 22:06:50 UTC (rev 98819)
@@ -1,5 +1,24 @@
 2011-10-29  Eric Seidel  <[email protected]>
 
+        new-run-webkit-tests is locale dependent
+        https://bugs.webkit.org/show_bug.cgi?id=68691
+
+        Reviewed by Adam Barth.
+
+        Make NRWT use a clean environment just like ORWT did.
+        I've manually validated that NRWT now copies over
+        the same environment variables that ORWT did.
+        This new code is exercised by existing setup_environ_for_server tests.
+
+        * Scripts/webkitpy/layout_tests/port/base.py:
+        * Scripts/webkitpy/layout_tests/port/efl.py:
+        * Scripts/webkitpy/layout_tests/port/mac.py:
+        * Scripts/webkitpy/layout_tests/port/qt.py:
+        * Scripts/webkitpy/layout_tests/port/webkit.py:
+        * Scripts/webkitpy/layout_tests/port/win.py:
+
+2011-10-29  Eric Seidel  <[email protected]>
+
         new-run-webkit-tests: MASTER BUG: Switch all webkit.org bots over
         https://bugs.webkit.org/show_bug.cgi?id=34984
 

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/base.py (98818 => 98819)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/base.py	2011-10-29 22:04:11 UTC (rev 98818)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/base.py	2011-10-29 22:06:50 UTC (rev 98819)
@@ -648,14 +648,44 @@
         """Perform port-specific work at the beginning of a test run."""
         pass
 
+    # FIXME: os.environ access should be moved to onto a common/system class to be more easily mockable.
+    def _value_or_default_from_environ(self, name, default=None):
+        if name in os.environ:
+            return os.environ[name]
+        return default
+
+    def _copy_value_from_environ_if_set(self, clean_env, name):
+        if name in os.environ:
+            clean_env[name] = os.environ[name]
+
     def setup_environ_for_server(self, server_name=None):
-        """Perform port-specific work at the beginning of a server launch.
+        # We intentionally copy only a subset of os.environ when
+        # launching subprocesses to ensure consistent test results.
+        clean_env = {}
+        variables_to_copy = [
+            # For Linux:
+            'XAUTHORITY',
+            'HOME',
+            'LANG',
+            'LD_LIBRARY_PATH',
+            'DBUS_SESSION_BUS_ADDRESS',
 
-        Returns:
-           Operating-system's environment.
-        """
-        return os.environ.copy()
+            # Darwin:
+            'DYLD_LIBRARY_PATH',
+            'HOME',
 
+            # CYGWIN:
+            'HOMEDRIVE',
+            'HOMEPATH',
+            '_NT_SYMBOL_PATH',
+        ]
+        for variable in variables_to_copy:
+            self._copy_value_from_environ_if_set(clean_env, variable)
+
+        # For Linux:
+        clean_env['DISPLAY'] = self._value_or_default_from_environ('DISPLAY', ':1')
+        return clean_env
+
     def show_results_html_file(self, results_filename):
         """This routine should display the HTML file pointed at by
         results_filename in a users' browser."""

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/efl.py (98818 => 98819)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/efl.py	2011-10-29 22:04:11 UTC (rev 98818)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/efl.py	2011-10-29 22:06:50 UTC (rev 98819)
@@ -47,9 +47,6 @@
     def _port_flag_for_scripts(self):
         return "--efl"
 
-    def setup_environ_for_server(self, server_name=None):
-        return webkit.WebKitPort.setup_environ_for_server(self, server_name)
-
     def _generate_all_test_configurations(self):
         return [TestConfiguration(version=self._version, architecture='x86', build_type=build_type, graphics_type='cpu') for build_type in self.ALL_BUILD_TYPES]
 
@@ -59,16 +56,17 @@
     def _path_to_image_diff(self):
         return self._build_path('Programs', 'ImageDiff')
 
+    # FIXME: I doubt EFL wants to override this method.
     def check_build(self, needs_http):
         return self._check_driver()
 
     def _path_to_webcore_library(self):
         static_path = self._build_path('WebCore', 'libwebcore_efl.a')
         dyn_path = self._build_path('WebCore', 'libwebcore_efl.so')
-
         return static_path if self._filesystem.exists(static_path) else dyn_path
 
     def _runtime_feature_list(self):
+        # FIXME: EFL should detect runtime features like other webkit ports do.
         return None
 
     def show_results_html_file(self, results_filename):

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/mac.py (98818 => 98819)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/mac.py	2011-10-29 22:04:11 UTC (rev 98818)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/mac.py	2011-10-29 22:06:50 UTC (rev 98819)
@@ -102,6 +102,7 @@
                 env['MallocStackLogging'] = '1'
             if self.get_option('guard_malloc'):
                 env['DYLD_INSERT_LIBRARIES'] = '/usr/lib/libgmalloc.dylib'
+        env['XML_CATALOG_FILES'] = ''  # work around missing /etc/catalog <rdar://problem/4292995>
         return env
 
     # Belongs on a Platform object.

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/qt.py (98818 => 98819)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/qt.py	2011-10-29 22:04:11 UTC (rev 98818)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/qt.py	2011-10-29 22:06:50 UTC (rev 98819)
@@ -141,8 +141,9 @@
         return None
 
     def setup_environ_for_server(self, server_name=None):
-        env = WebKitPort.setup_environ_for_server(self, server_name)
-        env['QTWEBKIT_PLUGIN_PATH'] = self._build_path('lib/plugins')
+        clean_env = WebKitPort.setup_environ_for_server(self, server_name)
+        clean_env['QTWEBKIT_PLUGIN_PATH'] = self._build_path('lib/plugins')
+        self._copy_value_from_environment(clean_env, 'QT_DRT_WEBVIEW_MODE')
         return env
 
     # FIXME: We should find a way to share this implmentation with Gtk,

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/webkit.py (98818 => 98819)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/webkit.py	2011-10-29 22:04:11 UTC (rev 98818)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/webkit.py	2011-10-29 22:06:50 UTC (rev 98819)
@@ -220,6 +220,11 @@
 
         return (output_image, diff_percent)
 
+    def setup_environ_for_server(self, server_name=None):
+        clean_env = super(WebKitPort, self).setup_environ_for_server(server_name)
+        self._copy_value_from_environ_if_set(clean_env, 'WEBKIT_TESTFONTS')
+        return clean_env
+
     def default_results_directory(self):
         # Results are store relative to the built products to make it easy
         # to have multiple copies of webkit checked out and built.

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/win.py (98818 => 98819)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/win.py	2011-10-29 22:04:11 UTC (rev 98818)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/win.py	2011-10-29 22:06:50 UTC (rev 98819)
@@ -102,6 +102,10 @@
         fallback_names.extend(['mac-lion', 'mac'])
         return map(self._webkit_baseline_path, fallback_names)
 
+    # This port may need to override setup_environ_for_server
+    # to match behavior of setPathForRunningWebKitApp from ORWT.
+    # $env->{PATH} = join(':', productDir(), dirname(installedSafariPath()), appleApplicationSupportPath(), $env->{PATH} || "");
+
     # FIXME: webkitperl/httpd.pm installs /usr/lib/apache/libphp4.dll on cycwin automatically
     # as part of running old-run-webkit-tests.  That's bad design, but we may need some similar hack.
     # We might use setup_environ_for_server for such a hack (or modify apache_http_server.py).
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to