[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
mihaip at chromium.org
mihaip at chromium.org
Wed Dec 22 14:50:47 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 8321d8f90c1b0e46cc82800a41c84302e9997af7
Author: mihaip at chromium.org <mihaip at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Oct 22 00:04:39 2010 +0000
2010-10-21 Mihai Parparita <mihaip at chromium.org>
Reviewed by Ojan Vafai.
Add support for --tolerance in NRWT
https://bugs.webkit.org/show_bug.cgi?id=47959
Add support for the --tolerance flag in NRWT. The Port.diff_image
signature shouldn't need a tolerance parameter (it's not set per test),
just have ports that use it (currently only WebKitPort) read it from
the options object.
* Scripts/webkitpy/layout_tests/port/chromium.py:
* Scripts/webkitpy/layout_tests/port/port_testcase.py:
* Scripts/webkitpy/layout_tests/port/test.py:
* Scripts/webkitpy/layout_tests/port/webkit.py:
* Scripts/webkitpy/layout_tests/run_webkit_tests.py:
* Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@70277 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 18809d6..3ed969e 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,22 @@
+2010-10-21 Mihai Parparita <mihaip at chromium.org>
+
+ Reviewed by Ojan Vafai.
+
+ Add support for --tolerance in NRWT
+ https://bugs.webkit.org/show_bug.cgi?id=47959
+
+ Add support for the --tolerance flag in NRWT. The Port.diff_image
+ signature shouldn't need a tolerance parameter (it's not set per test),
+ just have ports that use it (currently only WebKitPort) read it from
+ the options object.
+
+ * Scripts/webkitpy/layout_tests/port/chromium.py:
+ * Scripts/webkitpy/layout_tests/port/port_testcase.py:
+ * Scripts/webkitpy/layout_tests/port/test.py:
+ * Scripts/webkitpy/layout_tests/port/webkit.py:
+ * Scripts/webkitpy/layout_tests/run_webkit_tests.py:
+ * Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py:
+
2010-10-21 Eric Seidel <eric at webkit.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 4d17b51..42ea11d 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium.py
@@ -135,7 +135,7 @@ class ChromiumPort(base.Port):
override_step, logging)
def diff_image(self, expected_contents, actual_contents,
- diff_filename=None, tolerance=0):
+ diff_filename=None):
executable = self._path_to_image_diff()
tempdir = tempfile.mkdtemp()
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/port/port_testcase.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/port_testcase.py
index 04ada50..300dbc6 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/port/port_testcase.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/port_testcase.py
@@ -35,7 +35,8 @@ import unittest
from webkitpy.tool import mocktool
mock_options = mocktool.MockOptions(results_directory='layout-test-results',
use_apache=True,
- configuration='Release')
+ configuration='Release',
+ tolerance=None)
class PortTestCase(unittest.TestCase):
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/port/test.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/test.py
index 3691c5a..ff4086c 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/port/test.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/test.py
@@ -137,7 +137,7 @@ class TestPort(base.Port):
return True
def diff_image(self, expected_contents, actual_contents,
- diff_filename=None, tolerance=0):
+ diff_filename=None):
diffed = actual_contents != expected_contents
if diffed and diff_filename:
with codecs.open(diff_filename, "w", "utf-8") as diff_fh:
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/port/webkit.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/webkit.py
index c940f1e..24d31a7 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/port/webkit.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/webkit.py
@@ -122,22 +122,25 @@ class WebKitPort(base.Port):
return True
def diff_image(self, expected_contents, actual_contents,
- diff_filename=None, tolerance=0.1):
+ diff_filename=None):
"""Return True if the two files are different. Also write a delta
image of the two images into |diff_filename| if it is not None."""
- # FIXME: either expose the tolerance argument as a command-line
- # parameter, or make it go away and always use exact matches.
-
# Handle the case where the test didn't actually generate an image.
if not actual_contents:
return True
- sp = self._diff_image_request(expected_contents, actual_contents,
- tolerance)
+ sp = self._diff_image_request(expected_contents, actual_contents)
return self._diff_image_reply(sp, diff_filename)
- def _diff_image_request(self, expected_contents, actual_contents, tolerance):
+ def _diff_image_request(self, expected_contents, actual_contents):
+ # FIXME: use self.get_option('tolerance') and
+ # self.set_option_default('tolerance', 0.1) once that behaves correctly
+ # with default values.
+ if self._options.tolerance is not None:
+ tolerance = self._options.tolerance
+ else:
+ tolerance = 0.1
command = [self._path_to_image_diff(), '--tolerance', str(tolerance)]
sp = server_process.ServerProcess(self, 'ImageDiff', command)
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/run_webkit_tests.py b/WebKitTools/Scripts/webkitpy/layout_tests/run_webkit_tests.py
index dc8a1f4..8963d1c 100755
--- a/WebKitTools/Scripts/webkitpy/layout_tests/run_webkit_tests.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/run_webkit_tests.py
@@ -1562,8 +1562,9 @@ def parse_args(args=None):
dest="pixel_tests", help="Enable pixel-to-pixel PNG comparisons"),
optparse.make_option("--no-pixel-tests", action="store_false",
dest="pixel_tests", help="Disable pixel-to-pixel PNG comparisons"),
- # old-run-webkit-tests allows a specific tolerance: --tolerance t
- # Ignore image differences less than this percentage (default: 0.1)
+ optparse.make_option("--tolerance",
+ help="Ignore image differences less than this percentage (some "
+ "ports may ignore this option)", type="float"),
optparse.make_option("--results-directory",
default="layout-test-results",
help="Output results directory source dir, relative to Debug or "
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py b/WebKitTools/Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py
index a716cec..0f09ffa 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py
@@ -48,6 +48,7 @@ from webkitpy.common.system import user
from webkitpy.layout_tests import port
from webkitpy.layout_tests import run_webkit_tests
from webkitpy.layout_tests.layout_package import dump_render_tree_thread
+from webkitpy.layout_tests.port.test import TestPort
from webkitpy.thirdparty.mock import Mock
@@ -260,6 +261,31 @@ class MainTest(unittest.TestCase):
tests_included=True)
self.assertEqual(user.url, '/tmp/foo/results.html')
+ def test_tolerance(self):
+ class ImageDiffTestPort(TestPort):
+ def diff_image(self, expected_contents, actual_contents,
+ diff_filename=None):
+ self.tolerance_used_for_diff_image = self._options.tolerance
+ return True
+
+ def get_port_for_run(args):
+ options, parsed_args = run_webkit_tests.parse_args(args)
+ test_port = ImageDiffTestPort(options=options, user=MockUser())
+ passing_run(args=args, port_obj=test_port, tests_included=True)
+ return test_port
+
+ base_args = ['--pixel-tests', 'failures/expected/*']
+
+ # If we pass in an explicit tolerance argument, then that will be used.
+ test_port = get_port_for_run(base_args + ['--tolerance', '.1'])
+ self.assertEqual(0.1, test_port.tolerance_used_for_diff_image)
+ test_port = get_port_for_run(base_args + ['--tolerance', '0'])
+ self.assertEqual(0, test_port.tolerance_used_for_diff_image)
+
+ # Otherwise the port's default tolerance behavior (including ignoring it)
+ # should be used.
+ test_port = get_port_for_run(base_args)
+ self.assertEqual(None, test_port.tolerance_used_for_diff_image)
def _mocked_open(original_open, file_list):
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list