Diff
Modified: trunk/Tools/ChangeLog (161880 => 161881)
--- trunk/Tools/ChangeLog 2014-01-13 16:40:16 UTC (rev 161880)
+++ trunk/Tools/ChangeLog 2014-01-13 16:47:54 UTC (rev 161881)
@@ -1,3 +1,33 @@
+2014-01-13 Daniel Batyai <[email protected]>
+
+ Remove wdiff
+ https://bugs.webkit.org/show_bug.cgi?id=124766
+
+ Reviewed by Ryosuke Niwa.
+
+ * Scripts/webkitpy/common/net/resultsjsonparser_unittest.py:
+ (ResultsJSONParserTest):
+ * Scripts/webkitpy/layout_tests/controllers/test_result_writer.py:
+ (TestResultWriter):
+ (TestResultWriter.create_text_diff_and_write_result):
+ * Scripts/webkitpy/layout_tests/models/test_run_results.py:
+ (summarize_results):
+ * Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py:
+ (RunTest.test_output_diffs):
+ * Scripts/webkitpy/port/base.py:
+ (Port.__init__):
+ (Port.driver_stop_timeout):
+ (Port.check_image_diff):
+ (Port.repository_paths):
+ (Port._path_to_lighttpd_php):
+ * Scripts/webkitpy/port/base_unittest.py:
+ (PortTest.test_default_child_processes):
+ (PortTest.test_pretty_patch_script_error):
+ * Scripts/webkitpy/port/port_testcase.py:
+ (PortTestCase.test_diff_image_crashed):
+ * Scripts/webkitpy/port/test.py:
+ (TestPort.operating_system):
+
2014-01-13 Martin Robinson <[email protected]>
Build fix for the GTK+ CMake port
Modified: trunk/Tools/Scripts/webkitpy/common/net/resultsjsonparser_unittest.py (161880 => 161881)
--- trunk/Tools/Scripts/webkitpy/common/net/resultsjsonparser_unittest.py 2014-01-13 16:40:16 UTC (rev 161880)
+++ trunk/Tools/Scripts/webkitpy/common/net/resultsjsonparser_unittest.py 2014-01-13 16:47:54 UTC (rev 161881)
@@ -80,8 +80,7 @@
"has_pretty_patch": false,
"fixable": 1220,
"num_flaky": 0,
- "uses_expectations_file": true,
- "has_wdiff": false
+ "uses_expectations_file": true
});"""
def test_basic(self):
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/controllers/test_result_writer.py (161880 => 161881)
--- trunk/Tools/Scripts/webkitpy/layout_tests/controllers/test_result_writer.py 2014-01-13 16:40:16 UTC (rev 161880)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/controllers/test_result_writer.py 2014-01-13 16:47:54 UTC (rev 161881)
@@ -57,7 +57,6 @@
FILENAME_SUFFIX_STDERR = "-stderr"
FILENAME_SUFFIX_CRASH_LOG = "-crash-log"
FILENAME_SUFFIX_SAMPLE = "-sample"
- FILENAME_SUFFIX_WDIFF = "-wdiff.html"
FILENAME_SUFFIX_PRETTY_PATCH = "-pretty-diff.html"
FILENAME_SUFFIX_IMAGE_DIFF = "-diff.png"
FILENAME_SUFFIX_IMAGE_DIFFS_HTML = "-diffs.html"
@@ -153,12 +152,6 @@
diff_filename = self.output_filename(self.FILENAME_SUFFIX_DIFF + file_type)
self._write_binary_file(diff_filename, diff)
- # Shell out to wdiff to get colored inline diffs.
- if self._port.wdiff_available():
- wdiff = self._port.wdiff_text(expected_filename, actual_filename)
- wdiff_filename = self.output_filename(self.FILENAME_SUFFIX_WDIFF)
- self._write_binary_file(wdiff_filename, wdiff)
-
# Use WebKit's PrettyPatch.rb to get an HTML diff.
if self._port.pretty_patch.pretty_patch_available():
pretty_patch = self._port.pretty_patch.pretty_patch_text(diff_filename)
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/models/test_run_results.py (161880 => 161881)
--- trunk/Tools/Scripts/webkitpy/layout_tests/models/test_run_results.py 2014-01-13 16:40:16 UTC (rev 161880)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/models/test_run_results.py 2014-01-13 16:47:54 UTC (rev 161881)
@@ -249,7 +249,6 @@
results['uses_expectations_file'] = port_obj.uses_test_expectations_file()
results['interrupted'] = initial_results.interrupted # Does results.html have enough information to compute this itself? (by checking total number of results vs. total number of tests?)
results['layout_tests_dir'] = port_obj.layout_tests_dir()
- results['has_wdiff'] = port_obj.wdiff_available()
results['has_pretty_patch'] = port_obj.pretty_patch.pretty_patch_available()
results['pixel_tests_enabled'] = port_obj.get_option('pixel_tests')
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py (161880 => 161881)
--- trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py 2014-01-13 16:40:16 UTC (rev 161880)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py 2014-01-13 16:47:54 UTC (rev 161881)
@@ -794,18 +794,15 @@
self.assertFalse('platform/test-win-win7/http/test.html' in tests_run)
def test_output_diffs(self):
- # Test to ensure that we don't generate -wdiff.html or -pretty.html if wdiff and PrettyPatch
- # aren't available.
+ # Test to ensure that we don't generate -pretty.html if PrettyPatch isn't available.
host = MockHost()
_, err, _ = logging_run(['--pixel-tests', 'failures/unexpected/text-image-checksum.html'], tests_included=True, host=host)
written_files = host.filesystem.written_files
self.assertTrue(any(path.endswith('-diff.txt') for path in written_files.keys()))
- self.assertFalse(any(path.endswith('-wdiff.html') for path in written_files.keys()))
self.assertFalse(any(path.endswith('-pretty-diff.html') for path in written_files.keys()))
full_results_text = host.filesystem.read_text_file('/tmp/layout-test-results/full_results.json')
full_results = json.loads(full_results_text.replace("ADD_RESULTS(", "").replace(");", ""))
- self.assertEqual(full_results['has_wdiff'], False)
self.assertEqual(full_results['has_pretty_patch'], False)
def test_unsupported_platform(self):
Modified: trunk/Tools/Scripts/webkitpy/port/base.py (161880 => 161881)
--- trunk/Tools/Scripts/webkitpy/port/base.py 2014-01-13 16:40:16 UTC (rev 161880)
+++ trunk/Tools/Scripts/webkitpy/port/base.py 2014-01-13 16:47:54 UTC (rev 161881)
@@ -126,21 +126,6 @@
self._server_process_constructor = server_process.ServerProcess # overridable for testing
self._http_lock = None # FIXME: Why does this live on the port object?
- # Python's Popen has a bug that causes any pipes opened to a
- # process that can't be executed to be leaked. Since this
- # code is specifically designed to tolerate exec failures
- # to gracefully handle cases where wdiff is not installed,
- # the bug results in a massive file descriptor leak. As a
- # workaround, if an exec failure is ever experienced for
- # wdiff, assume it's not available. This will leak one
- # file descriptor but that's better than leaking each time
- # wdiff would be run.
- #
- # http://mail.python.org/pipermail/python-list/
- # 2008-August/505753.html
- # http://bugs.python.org/issue3210
- self._wdiff_available = None
-
if not hasattr(options, 'configuration') or not options.configuration:
self.set_option_default('configuration', self.default_configuration())
self._test_configuration = None
@@ -171,11 +156,6 @@
# well (for things like ASAN, Valgrind, etc.)
return 3.0 * float(self.get_option('time_out_ms', '0')) / self.default_timeout_ms()
- def wdiff_available(self):
- if self._wdiff_available is None:
- self._wdiff_available = self.check_wdiff(logging=False)
- return self._wdiff_available
-
def should_retry_crashes(self):
return False
@@ -274,27 +254,6 @@
return False
return True
- def check_wdiff(self, logging=True):
- if not self._path_to_wdiff():
- # Don't need to log here since this is the port choosing not to use wdiff.
- return False
-
- try:
- _ = self._executive.run_command([self._path_to_wdiff(), '--help'])
- except OSError:
- if logging:
- message = self._wdiff_missing_message()
- if message:
- for line in message.splitlines():
- _log.warning(' ' + line)
- _log.warning('')
- return False
-
- return True
-
- def _wdiff_missing_message(self):
- return 'wdiff is not installed; please install it to generate word-by-word diffs.'
-
def check_httpd(self):
if self._uses_apache():
httpd_path = self._path_to_apache()
@@ -1075,62 +1034,7 @@
repository_paths += [(self._options.additional_repository_name, self._options.additional_repository_path)]
return repository_paths
- _WDIFF_DEL = '##WDIFF_DEL##'
- _WDIFF_ADD = '##WDIFF_ADD##'
- _WDIFF_END = '##WDIFF_END##'
- def _format_wdiff_output_as_html(self, wdiff):
- wdiff = cgi.escape(wdiff)
- wdiff = wdiff.replace(self._WDIFF_DEL, "<span class=del>")
- wdiff = wdiff.replace(self._WDIFF_ADD, "<span class=add>")
- wdiff = wdiff.replace(self._WDIFF_END, "</span>")
- html = "<head><style>.del { background: #faa; } "
- html += ".add { background: #afa; }</style></head>"
- html += "<pre>%s</pre>" % wdiff
- return html
-
- def _wdiff_command(self, actual_filename, expected_filename):
- executable = self._path_to_wdiff()
- return [executable,
- "--start-delete=%s" % self._WDIFF_DEL,
- "--end-delete=%s" % self._WDIFF_END,
- "--start-insert=%s" % self._WDIFF_ADD,
- "--end-insert=%s" % self._WDIFF_END,
- actual_filename,
- expected_filename]
-
- @staticmethod
- def _handle_wdiff_error(script_error):
- # Exit 1 means the files differed, any other exit code is an error.
- if script_error.exit_code != 1:
- raise script_error
-
- def _run_wdiff(self, actual_filename, expected_filename):
- """Runs wdiff and may throw exceptions.
- This is mostly a hook for unit testing."""
- # Diffs are treated as binary as they may include multiple files
- # with conflicting encodings. Thus we do not decode the output.
- command = self._wdiff_command(actual_filename, expected_filename)
- wdiff = self._executive.run_command(command, decode_output=False,
- error_handler=self._handle_wdiff_error)
- return self._format_wdiff_output_as_html(wdiff)
-
- def wdiff_text(self, actual_filename, expected_filename):
- """Returns a string of HTML indicating the word-level diff of the
- contents of the two filenames. Returns an empty string if word-level
- diffing isn't available."""
- if not self.wdiff_available():
- return ""
- try:
- # It's possible to raise a ScriptError we pass wdiff invalid paths.
- return self._run_wdiff(actual_filename, expected_filename)
- except OSError, e:
- if e.errno in [errno.ENOENT, errno.EACCES, errno.ECHILD]:
- # Silently ignore cases where wdiff is missing.
- self._wdiff_available = False
- return ""
- raise
-
def default_configuration(self):
return self._config.default_configuration()
@@ -1263,16 +1167,6 @@
This is needed only by ports that use the http_server.py module."""
raise NotImplementedError('Port._path_to_lighttpd_php')
- @memoized
- def _path_to_wdiff(self):
- """Returns the full path to the wdiff binary, or None if it is not available.
-
- This is likely used only by wdiff_text()"""
- for path in ("/usr/bin/wdiff", "/usr/bin/dwdiff"):
- if self._filesystem.exists(path):
- return path
- return None
-
def _webkit_baseline_path(self, platform):
"""Return the full path to the top of the baseline tree for a
given platform."""
Modified: trunk/Tools/Scripts/webkitpy/port/base_unittest.py (161880 => 161881)
--- trunk/Tools/Scripts/webkitpy/port/base_unittest.py 2014-01-13 16:40:16 UTC (rev 161880)
+++ trunk/Tools/Scripts/webkitpy/port/base_unittest.py 2014-01-13 16:47:54 UTC (rev 161881)
@@ -59,27 +59,6 @@
port = self.make_port()
self.assertIsNotNone(port.default_child_processes())
- def test_format_wdiff_output_as_html(self):
- output = "OUTPUT %s %s %s" % (Port._WDIFF_DEL, Port._WDIFF_ADD, Port._WDIFF_END)
- html = self.make_port()._format_wdiff_output_as_html(output)
- expected_html = "<head><style>.del { background: #faa; } .add { background: #afa; }</style></head><pre>OUTPUT <span class=del> <span class=add> </span></pre>"
- self.assertEqual(html, expected_html)
-
- def test_wdiff_command(self):
- port = self.make_port()
- port._path_to_wdiff = lambda: "/path/to/wdiff"
- command = port._wdiff_command("/actual/path", "/expected/path")
- expected_command = [
- "/path/to/wdiff",
- "--start-delete=##WDIFF_DEL##",
- "--end-delete=##WDIFF_END##",
- "--start-insert=##WDIFF_ADD##",
- "--end-insert=##WDIFF_END##",
- "/actual/path",
- "/expected/path",
- ]
- self.assertEqual(command, expected_command)
-
def _file_with_contents(self, contents, encoding="utf-8"):
new_file = tempfile.NamedTemporaryFile()
new_file.write(contents.encode(encoding))
@@ -109,56 +88,7 @@
self.assertEqual(port.pretty_patch.pretty_patch_text("patch.txt"),
port.pretty_patch.pretty_patch_error_html)
- def integration_test_run_wdiff(self):
- executive = Executive()
- # This may fail on some systems. We could ask the port
- # object for the wdiff path, but since we don't know what
- # port object to use, this is sufficient for now.
- try:
- wdiff_path = executive.run_command(["which", "wdiff"]).rstrip()
- except Exception, e:
- wdiff_path = None
- port = self.make_port(executive=executive)
- port._path_to_wdiff = lambda: wdiff_path
-
- if wdiff_path:
- # "with tempfile.NamedTemporaryFile() as actual" does not seem to work in Python 2.5
- actual = self._file_with_contents(u"foo")
- expected = self._file_with_contents(u"bar")
- wdiff = port._run_wdiff(actual.name, expected.name)
- expected_wdiff = "<head><style>.del { background: #faa; } .add { background: #afa; }</style></head><pre><span class=del>foo</span><span class=add>bar</span></pre>"
- self.assertEqual(wdiff, expected_wdiff)
- # Running the full wdiff_text method should give the same result.
- port._wdiff_available = True # In case it's somehow already disabled.
- wdiff = port.wdiff_text(actual.name, expected.name)
- self.assertEqual(wdiff, expected_wdiff)
- # wdiff should still be available after running wdiff_text with a valid diff.
- self.assertTrue(port._wdiff_available)
- actual.close()
- expected.close()
-
- # Bogus paths should raise a script error.
- self.assertRaises(ScriptError, port._run_wdiff, "/does/not/exist", "/does/not/exist2")
- self.assertRaises(ScriptError, port.wdiff_text, "/does/not/exist", "/does/not/exist2")
- # wdiff will still be available after running wdiff_text with invalid paths.
- self.assertTrue(port._wdiff_available)
-
- # If wdiff does not exist _run_wdiff should throw an OSError.
- port._path_to_wdiff = lambda: "/invalid/path/to/wdiff"
- self.assertRaises(OSError, port._run_wdiff, "foo", "bar")
-
- # wdiff_text should not throw an error if wdiff does not exist.
- self.assertEqual(port.wdiff_text("foo", "bar"), "")
- # However wdiff should not be available after running wdiff_text if wdiff is missing.
- self.assertFalse(port._wdiff_available)
-
- def test_wdiff_text(self):
- port = self.make_port()
- port.wdiff_available = lambda: True
- port._run_wdiff = lambda a, b: 'PASS'
- self.assertEqual('PASS', port.wdiff_text(None, None))
-
def test_diff_text(self):
port = self.make_port()
# Make sure that we don't run into decoding exceptions when the
Modified: trunk/Tools/Scripts/webkitpy/port/port_testcase.py (161880 => 161881)
--- trunk/Tools/Scripts/webkitpy/port/port_testcase.py 2014-01-13 16:40:16 UTC (rev 161880)
+++ trunk/Tools/Scripts/webkitpy/port/port_testcase.py 2014-01-13 16:47:54 UTC (rev 161881)
@@ -291,10 +291,6 @@
self.assertEqual(port.diff_image('foo', 'bar'), ('', 0, 'ImageDiff crashed\n'))
port.clean_up_test_run()
- def test_check_wdiff(self):
- port = self.make_port()
- port.check_wdiff()
-
def integration_test_websocket_server__normal(self):
port = self.make_port()
self.assert_servers_are_down('localhost', self.WEBSOCKET_PORTS)
Modified: trunk/Tools/Scripts/webkitpy/port/test.py (161880 => 161881)
--- trunk/Tools/Scripts/webkitpy/port/test.py 2014-01-13 16:40:16 UTC (rev 161880)
+++ trunk/Tools/Scripts/webkitpy/port/test.py 2014-01-13 16:47:54 UTC (rev 161881)
@@ -451,9 +451,6 @@
def operating_system(self):
return self._operating_system
- def _path_to_wdiff(self):
- return None
-
def default_results_directory(self):
return '/tmp/layout-test-results'