Changeset 70277 in webkit
- Timestamp:
- Oct 21, 2010 5:04:39 PM (14 years ago)
- Location:
- trunk/WebKitTools
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKitTools/ChangeLog
r70274 r70277 1 2010-10-21 Mihai Parparita <mihaip@chromium.org> 2 3 Reviewed by Ojan Vafai. 4 5 Add support for --tolerance in NRWT 6 https://bugs.webkit.org/show_bug.cgi?id=47959 7 8 Add support for the --tolerance flag in NRWT. The Port.diff_image 9 signature shouldn't need a tolerance parameter (it's not set per test), 10 just have ports that use it (currently only WebKitPort) read it from 11 the options object. 12 13 * Scripts/webkitpy/layout_tests/port/chromium.py: 14 * Scripts/webkitpy/layout_tests/port/port_testcase.py: 15 * Scripts/webkitpy/layout_tests/port/test.py: 16 * Scripts/webkitpy/layout_tests/port/webkit.py: 17 * Scripts/webkitpy/layout_tests/run_webkit_tests.py: 18 * Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py: 19 1 20 2010-10-21 Eric Seidel <eric@webkit.org> 2 21 -
trunk/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium.py
r70013 r70277 136 136 137 137 def diff_image(self, expected_contents, actual_contents, 138 diff_filename=None , tolerance=0):138 diff_filename=None): 139 139 executable = self._path_to_image_diff() 140 140 -
trunk/WebKitTools/Scripts/webkitpy/layout_tests/port/port_testcase.py
r70013 r70277 36 36 mock_options = mocktool.MockOptions(results_directory='layout-test-results', 37 37 use_apache=True, 38 configuration='Release') 38 configuration='Release', 39 tolerance=None) 39 40 40 41 -
trunk/WebKitTools/Scripts/webkitpy/layout_tests/port/test.py
r70013 r70277 138 138 139 139 def diff_image(self, expected_contents, actual_contents, 140 diff_filename=None , tolerance=0):140 diff_filename=None): 141 141 diffed = actual_contents != expected_contents 142 142 if diffed and diff_filename: -
trunk/WebKitTools/Scripts/webkitpy/layout_tests/port/webkit.py
r70013 r70277 123 123 124 124 def diff_image(self, expected_contents, actual_contents, 125 diff_filename=None , tolerance=0.1):125 diff_filename=None): 126 126 """Return True if the two files are different. Also write a delta 127 127 image of the two images into |diff_filename| if it is not None.""" 128 129 # FIXME: either expose the tolerance argument as a command-line130 # parameter, or make it go away and always use exact matches.131 128 132 129 # Handle the case where the test didn't actually generate an image. … … 134 131 return True 135 132 136 sp = self._diff_image_request(expected_contents, actual_contents, 137 tolerance) 133 sp = self._diff_image_request(expected_contents, actual_contents) 138 134 return self._diff_image_reply(sp, diff_filename) 139 135 140 def _diff_image_request(self, expected_contents, actual_contents, tolerance): 136 def _diff_image_request(self, expected_contents, actual_contents): 137 # FIXME: use self.get_option('tolerance') and 138 # self.set_option_default('tolerance', 0.1) once that behaves correctly 139 # with default values. 140 if self._options.tolerance is not None: 141 tolerance = self._options.tolerance 142 else: 143 tolerance = 0.1 141 144 command = [self._path_to_image_diff(), '--tolerance', str(tolerance)] 142 145 sp = server_process.ServerProcess(self, 'ImageDiff', command) -
trunk/WebKitTools/Scripts/webkitpy/layout_tests/run_webkit_tests.py
r70217 r70277 1563 1563 optparse.make_option("--no-pixel-tests", action="store_false", 1564 1564 dest="pixel_tests", help="Disable pixel-to-pixel PNG comparisons"), 1565 # old-run-webkit-tests allows a specific tolerance: --tolerance t 1566 # Ignore image differences less than this percentage (default: 0.1) 1565 optparse.make_option("--tolerance", 1566 help="Ignore image differences less than this percentage (some " 1567 "ports may ignore this option)", type="float"), 1567 1568 optparse.make_option("--results-directory", 1568 1569 default="layout-test-results", -
trunk/WebKitTools/Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py
r70024 r70277 49 49 from webkitpy.layout_tests import run_webkit_tests 50 50 from webkitpy.layout_tests.layout_package import dump_render_tree_thread 51 from webkitpy.layout_tests.port.test import TestPort 51 52 52 53 from webkitpy.thirdparty.mock import Mock … … 261 262 self.assertEqual(user.url, '/tmp/foo/results.html') 262 263 264 def test_tolerance(self): 265 class ImageDiffTestPort(TestPort): 266 def diff_image(self, expected_contents, actual_contents, 267 diff_filename=None): 268 self.tolerance_used_for_diff_image = self._options.tolerance 269 return True 270 271 def get_port_for_run(args): 272 options, parsed_args = run_webkit_tests.parse_args(args) 273 test_port = ImageDiffTestPort(options=options, user=MockUser()) 274 passing_run(args=args, port_obj=test_port, tests_included=True) 275 return test_port 276 277 base_args = ['--pixel-tests', 'failures/expected/*'] 278 279 # If we pass in an explicit tolerance argument, then that will be used. 280 test_port = get_port_for_run(base_args + ['--tolerance', '.1']) 281 self.assertEqual(0.1, test_port.tolerance_used_for_diff_image) 282 test_port = get_port_for_run(base_args + ['--tolerance', '0']) 283 self.assertEqual(0, test_port.tolerance_used_for_diff_image) 284 285 # Otherwise the port's default tolerance behavior (including ignoring it) 286 # should be used. 287 test_port = get_port_for_run(base_args) 288 self.assertEqual(None, test_port.tolerance_used_for_diff_image) 263 289 264 290
Note: See TracChangeset
for help on using the changeset viewer.