[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

dpranke at chromium.org dpranke at chromium.org
Wed Dec 22 15:45:53 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 02ec6a45ca57be655f43f383e65675ef1a5e30e3
Author: dpranke at chromium.org <dpranke at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Nov 11 23:51:00 2010 +0000

    2010-11-11  Dirk Pranke  <dpranke at chromium.org>
    
            Reviewed by Adam Roben.
    
            Fix NRWT to respect set-webkit-configuration again :(
    
            This change fixes a typo in config.py that was causing the wrong
            value to be read initially and us never actually looking into
            the filesystem to get the default configuration.
    
            * Scripts/webkitpy/layout_tests/port/config.py:
            * Scripts/webkitpy/layout_tests/port/config_standalone.py:
            * Scripts/webkitpy/layout_tests/port/config_unittest.py:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@71858 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 977265d..7c8c5da 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,17 @@
+2010-11-11  Dirk Pranke  <dpranke at chromium.org>
+
+        Reviewed by Adam Roben.
+
+        Fix NRWT to respect set-webkit-configuration again :(
+
+        This change fixes a typo in config.py that was causing the wrong
+        value to be read initially and us never actually looking into
+        the filesystem to get the default configuration.
+        
+        * Scripts/webkitpy/layout_tests/port/config.py:
+        * Scripts/webkitpy/layout_tests/port/config_standalone.py:
+        * Scripts/webkitpy/layout_tests/port/config_unittest.py:
+
 2010-11-11  Eric Seidel  <eric at webkit.org>
 
         Reviewed by Adam Barth.
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/port/config.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/config.py
index 4a0de96..1d7f4fe 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/port/config.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/config.py
@@ -40,16 +40,20 @@ from webkitpy.common.system import logutils
 _log = logutils.get_logger(__file__)
 
 #
-# This is used to record if we've already hit the filesystem to look
+# FIXME: This is used to record if we've already hit the filesystem to look
 # for a default configuration. We cache this to speed up the unit tests,
-# but this can be reset with clear_cached_configuration().
+# but this can be reset with clear_cached_configuration(). This should be
+# replaced with us consistently using MockConfigs() for tests that don't
+# hit the filesystem at all and provide a reliable value.
 #
-_determined_configuration = None
+_have_determined_configuration = False
+_configuration = "Release"
 
 
 def clear_cached_configuration():
-    global _determined_configuration
-    _determined_configuration = -1
+    global _have_determined_configuration, _configuration
+    _have_determined_configuration = False
+    _configuration = "Release"
 
 
 class Config(object):
@@ -137,8 +141,11 @@ class Config(object):
 
     def _determine_configuration(self):
         # This mirrors the logic in webkitdirs.pm:determineConfiguration().
-        global _determined_configuration
-        if _determined_configuration == -1:
+        #
+        # FIXME: See the comment at the top of the file regarding unit tests
+        # and our use of global mutable static variables.
+        global _have_determined_configuration, _configuration
+        if not _have_determined_configuration:
             contents = self._read_configuration()
             if not contents:
                 contents = "Release"
@@ -146,8 +153,9 @@ class Config(object):
                 contents = "Release"
             if contents == "Development":
                 contents = "Debug"
-            _determined_configuration = contents
-        return _determined_configuration
+            _configuration = contents
+            _have_determined_configuration = True
+        return _configuration
 
     def _read_configuration(self):
         configuration_path = self._filesystem.join(self.build_directory(None),
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/port/config_standalone.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/config_standalone.py
new file mode 100644
index 0000000..1fc81db
--- /dev/null
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/config_standalone.py
@@ -0,0 +1,62 @@
+# Copyright (C) 2010 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.
+
+"""FIXME: This script is used by
+config_unittest.test_default_configuration__standalone() to read the
+default configuration to work around any possible caching / reset bugs. See
+https://bugs.webkit.org/show_bug?id=49360 for the motivation. We can remove
+this test when we remove the global configuration cache in config.py."""
+
+import os
+import unittest
+
+from webkitpy.common.system import executive
+from webkitpy.common.system import executive_mock
+from webkitpy.common.system import filesystem
+from webkitpy.common.system import filesystem_mock
+
+import sys
+import config
+
+
+def main(argv=None):
+    if not argv:
+        argv = sys.argv
+
+    if len(argv) == 3 and argv[1] == '--mock':
+        e = executive_mock.MockExecutive2(output='foo')
+        fs = filesystem_mock.MockFileSystem({'foo/Configuration': argv[2]})
+    else:
+        e = executive.Executive()
+        fs = filesystem.FileSystem()
+
+    c = config.Config(e, fs)
+    print c.default_configuration()
+
+if __name__ == '__main__':
+    main()
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/port/config_unittest.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/config_unittest.py
index ed5ab8b..f5e2d3a 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/port/config_unittest.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/config_unittest.py
@@ -27,6 +27,7 @@
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 import os
+import sys
 import unittest
 
 from webkitpy.common.system import executive
@@ -48,7 +49,7 @@ class ConfigTest(unittest.TestCase):
 
     def assert_configuration(self, contents, expected):
         # This tests that a configuration file containing
-        # _contents_ endsd up being interpreted as _expected_.
+        # _contents_ ends up being interpreted as _expected_.
         c = self.make_config('foo', {'foo/Configuration': contents})
         self.assertEqual(c.default_configuration(), expected)
 
@@ -119,6 +120,25 @@ class ConfigTest(unittest.TestCase):
         self.assert_configuration('Unknown', 'Unknown')
         oc.restore_output()
 
+    def test_default_configuration__standalone(self):
+        # FIXME: This test runs a standalone python script to test
+        # reading the default configuration to work around any possible
+        # caching / reset bugs. See https://bugs.webkit.org/show_bug?id=49360
+        # for the motivation. We can remove this test when we remove the
+        # global configuration cache in config.py.
+        e = executive.Executive()
+        fs = filesystem.FileSystem()
+        c = config.Config(e, fs)
+        script = c.path_from_webkit_base('WebKitTools', 'Scripts',
+            'webkitpy', 'layout_tests', 'port', 'config_standalone.py')
+
+        # Note: don't use 'Release' here, since that's the normal default.
+        expected = 'Debug'
+
+        args = [sys.executable, script, '--mock', expected]
+        actual = e.run_command(args).rstrip()
+        self.assertEqual(actual, expected)
+
     def test_path_from_webkit_base(self):
         # FIXME: We use a real filesystem here. Should this move to a
         # mocked one?

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list