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

tkent at chromium.org tkent at chromium.org
Wed Dec 22 14:08:56 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 9cfaf9b7eb68b1f916301f06c2574d45dc2b1c92
Author: tkent at chromium.org <tkent at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Oct 5 04:21:10 2010 +0000

    2010-10-04  Tony Chang  <tony at chromium.org>
    
            Reviewed by Kent Tamura.
    
            [chromium] fix image diffing in NRWT
            https://bugs.webkit.org/show_bug.cgi?id=47128
    
            * Scripts/webkitpy/layout_tests/port/chromium.py: Flush data to the
                  temp file and check the image_diff error code more carefully
            * Scripts/webkitpy/layout_tests/port/chromium_unittest.py:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69066 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 632a6e2..5b662ae 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,14 @@
+2010-10-04  Tony Chang  <tony at chromium.org>
+
+        Reviewed by Kent Tamura.
+
+        [chromium] fix image diffing in NRWT
+        https://bugs.webkit.org/show_bug.cgi?id=47128
+
+        * Scripts/webkitpy/layout_tests/port/chromium.py: Flush data to the
+              temp file and check the image_diff error code more carefully
+        * Scripts/webkitpy/layout_tests/port/chromium_unittest.py:
+
 2010-10-04  Dirk Pranke  <dpranke at chromium.org>
 
         Reviewed by Adam Barth.
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium.py
index a72627a..d9a3e4c 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium.py
@@ -136,8 +136,10 @@ class ChromiumPort(base.Port):
         executable = self._path_to_image_diff()
         expected_tmpfile = tempfile.NamedTemporaryFile()
         expected_tmpfile.write(expected_contents)
+        expected_tmpfile.flush()
         actual_tmpfile = tempfile.NamedTemporaryFile()
         actual_tmpfile.write(actual_contents)
+        actual_tmpfile.flush()
         if diff_filename:
             cmd = [executable, '--diff', expected_tmpfile.name,
                    actual_tmpfile.name, diff_filename]
@@ -146,8 +148,14 @@ class ChromiumPort(base.Port):
 
         result = True
         try:
-            if self._executive.run_command(cmd, return_exit_code=True) == 0:
-                return False
+            exit_code = self._executive.run_command(cmd, return_exit_code=True)
+            if exit_code == 0:
+                # The images are the same.
+                result = False
+            elif exit_code != 1:
+                # Some other error occurred.
+                raise ValueError("image diff returned an exit code of " +
+                                 str(exit_code))
         except OSError, e:
             if e.errno == errno.ENOENT or e.errno == errno.EACCES:
                 _compare_available = False
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_unittest.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_unittest.py
index a4a9ea6..48e9585 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_unittest.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_unittest.py
@@ -156,5 +156,47 @@ DEFER LINUX WIN : fast/js/very-good.js = TIMEOUT PASS"""
         self.assertEquals(options.configuration, 'default')
         self.assertTrue(port.default_configuration_called)
 
+    def test_diff_image(self):
+        class TestPort(ChromiumPortTest.TestLinuxPort):
+            def _path_to_image_diff(self):
+                return "/path/to/image_diff"
+
+        class EmptyOptions:
+            use_drt = False
+
+        class MockExecute:
+            def __init__(self, result):
+                self._result = result
+
+            def run_command(self,
+                            args,
+                            cwd=None,
+                            input=None,
+                            error_handler=None,
+                            return_exit_code=False,
+                            return_stderr=True,
+                            decode_output=False):
+                return self._result
+
+        options = EmptyOptions()
+        port = ChromiumPortTest.TestLinuxPort(options)
+
+        # Images are different.
+        port._executive = MockExecute(0)
+        self.assertEquals(False, port.diff_image("EXPECTED", "ACTUAL"))
+
+        # Images are the same.
+        port._executive = MockExecute(1)
+        self.assertEquals(True, port.diff_image("EXPECTED", "ACTUAL"))
+
+        # There was some error running image_diff.
+        port._executive = MockExecute(2)
+        exception_raised = False
+        try:
+            port.diff_image("EXPECTED", "ACTUAL")
+        except ValueError, e:
+            exception_raised = True
+        self.assertTrue(exception_raised)
+
 if __name__ == '__main__':
     unittest.main()

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list