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

commit-queue at webkit.org commit-queue at webkit.org
Wed Dec 22 13:26:33 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit c940cd426b42dd883765bcb16c9a11a540193af9
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Sep 15 17:05:56 2010 +0000

    2010-09-15  Mihai Parparita  <mihaip at chromium.org>
    
            Reviewed by Tony Chang.
    
            NRWT fails with UnicodeDecodeError on editing/selection/mixed-editability-10.html
            https://bugs.webkit.org/show_bug.cgi?id=45791
    
            Force filenames to be raw bytes before running difflib.unified_diff.
    
            * Scripts/webkitpy/layout_tests/port/base.py:
            * Scripts/webkitpy/layout_tests/port/base_unittest.py:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@67560 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 31d3722..cacd7a3 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,15 @@
+2010-09-15  Mihai Parparita  <mihaip at chromium.org>
+
+        Reviewed by Tony Chang.
+
+        NRWT fails with UnicodeDecodeError on editing/selection/mixed-editability-10.html
+        https://bugs.webkit.org/show_bug.cgi?id=45791
+
+        Force filenames to be raw bytes before running difflib.unified_diff.
+
+        * Scripts/webkitpy/layout_tests/port/base.py:
+        * Scripts/webkitpy/layout_tests/port/base_unittest.py:
+
 2010-09-15  Simon Hausmann  <simon.hausmann at nokia.com>
 
         Reviewed by Tor Arne Vestbø.
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/port/base.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/base.py
index 9125f9e..c21c889 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/port/base.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/base.py
@@ -152,6 +152,16 @@ class Port(object):
 
         While this is a generic routine, we include it in the Port
         interface so that it can be overriden for testing purposes."""
+
+        # The filenames show up in the diff output, make sure they're
+        # raw bytes and not unicode, so that they don't trigger join()
+        # trying to decode the input.
+        def to_raw_bytes(str):
+            if isinstance(str, unicode):
+                return str.encode('utf-8')
+            return str
+        expected_filename = to_raw_bytes(expected_filename)
+        actual_filename = to_raw_bytes(actual_filename)
         diff = difflib.unified_diff(expected_text.splitlines(True),
                                     actual_text.splitlines(True),
                                     expected_filename,
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/port/base_unittest.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/base_unittest.py
index 3926838..407b906 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/port/base_unittest.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/base_unittest.py
@@ -163,6 +163,33 @@ class PortTest(unittest.TestCase):
         self.assertFalse(base._wdiff_available)
         base._wdiff_available = True
 
+    def test_diff_text(self):
+        port = base.Port()
+        # Make sure that we don't run into decoding exceptions when the
+        # filenames are unicode, with regular or malformed input (expected or
+        # actual input is always raw bytes, not unicode).
+        port.diff_text('exp', 'act', 'exp.txt', 'act.txt')
+        port.diff_text('exp', 'act', u'exp.txt', 'act.txt')
+        port.diff_text('exp', 'act', u'a\xac\u1234\u20ac\U00008000', 'act.txt')
+
+        port.diff_text('exp' + chr(255), 'act', 'exp.txt', 'act.txt')
+        port.diff_text('exp' + chr(255), 'act', u'exp.txt', 'act.txt')
+
+        # Though expected and actual files should always be read in with no
+        # encoding (and be stored as str objects), test unicode inputs just to
+        # be safe.
+        port.diff_text(u'exp', 'act', 'exp.txt', 'act.txt')
+        port.diff_text(
+            u'a\xac\u1234\u20ac\U00008000', 'act', 'exp.txt', 'act.txt')
+
+        # And make sure we actually get diff output.
+        diff = port.diff_text('foo', 'bar', 'exp.txt', 'act.txt')
+        self.assertTrue('foo' in diff)
+        self.assertTrue('bar' in diff)
+        self.assertTrue('exp.txt' in diff)
+        self.assertTrue('act.txt' in diff)
+        self.assertFalse('nosuchthing' in diff)
+
     def test_default_configuration_notfound(self):
         port = UnitTestPort()
         self.assertEqual(port.default_configuration(), "Release")

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list