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

Fixed a cygwin path problem in the chromium port of diff_image;
Also made the return values of the diff_image function more consistent.

Patch by Shawn Singh <shawnsingh@chromium.org> on 2011-08-18
Reviewed by Dirk Pranke.

* Scripts/webkitpy/layout_tests/port/chromium.py:

git-svn-id: svn://svn.chromium.org/blink/trunk@93345 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 45e769b0
2011-08-18 Shawn Singh <shawnsingh@chromium.org>
https://bugs.webkit.org/show_bug.cgi?id=47240
Fixed a cygwin path problem in the chromium port of diff_image;
Also made the return values of the diff_image function more consistent.
Reviewed by Dirk Pranke.
* Scripts/webkitpy/layout_tests/port/chromium.py:
2011-08-17 Alejandro G. Castro <alex@igalia.com> 2011-08-17 Alejandro G. Castro <alex@igalia.com>
[GTK] Fix compilation problems with deprecations in gtk+ [GTK] Fix compilation problems with deprecations in gtk+
...@@ -162,10 +162,14 @@ class ChromiumPort(Port): ...@@ -162,10 +162,14 @@ class ChromiumPort(Port):
def diff_image(self, expected_contents, actual_contents): def diff_image(self, expected_contents, actual_contents):
# FIXME: need unit tests for this. # FIXME: need unit tests for this.
# If only one of them exists, return that one.
if not actual_contents and not expected_contents: if not actual_contents and not expected_contents:
return False return None
if not actual_contents or not expected_contents: if not actual_contents:
return True return expected_contents
if not expected_contents:
return actual_contents
tempdir = self._filesystem.mkdtemp() tempdir = self._filesystem.mkdtemp()
...@@ -177,8 +181,12 @@ class ChromiumPort(Port): ...@@ -177,8 +181,12 @@ class ChromiumPort(Port):
diff_filename = self._filesystem.join(str(tempdir), "diff.png") diff_filename = self._filesystem.join(str(tempdir), "diff.png")
native_expected_filename = self._convert_path(expected_filename)
native_actual_filename = self._convert_path(actual_filename)
native_diff_filename = self._convert_path(diff_filename)
executable = self._path_to_image_diff() executable = self._path_to_image_diff()
comand = [executable, '--diff', expected_filename, actual_filename, diff_filename] comand = [executable, '--diff', native_actual_filename, native_expected_filename, native_diff_filename]
result = None result = None
try: try:
...@@ -188,11 +196,10 @@ class ChromiumPort(Port): ...@@ -188,11 +196,10 @@ class ChromiumPort(Port):
result = None result = None
elif exit_code != 1: elif exit_code != 1:
_log.error("image diff returned an exit code of %s" % exit_code) _log.error("image diff returned an exit code of %s" % exit_code)
# Returning False here causes the script to think that we # Returning None here causes the script to think that we
# successfully created the diff even though we didn't. If # successfully created the diff even though we didn't.
# we return True, we think that the images match but the hashes # FIXME: Consider raising an exception here, so that the error
# don't match. # is not accidentally overlooked while the test passes.
# FIXME: Figure out why image_diff returns other values.
result = None result = None
except OSError, e: except OSError, e:
if e.errno == errno.ENOENT or e.errno == errno.EACCES: if e.errno == errno.ENOENT or e.errno == errno.EACCES:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment