Title: [120865] trunk/Tools
Revision
120865
Author
[email protected]
Date
2012-06-20 14:30:13 -0700 (Wed, 20 Jun 2012)

Log Message

nrwt outputs empty files for wdiff output if wdiff is not installed
https://bugs.webkit.org/show_bug.cgi?id=88709

Reviewed by Tony Chang.

Reviewed by Tony Chang.

Don't write -wdiff or -pretty.html files if wdiff or prettypatch
aren't available, and clean up the handling for them in the port
code.

* Scripts/webkitpy/run_webkit_tests_integrationtest.py:
(MainTest.test_output_diffs):
* Scripts/webkitpy/layout_tests/controllers/test_result_writer.py:
(TestResultWriter.create_text_diff_and_write_result):
* Scripts/webkitpy/layout_tests/port/base.py:
(Port.check_pretty_patch):
(Port.check_wdiff):
(Port._wdiff_missing_message):
* Scripts/webkitpy/layout_tests/port/chromium_linux.py:
(ChromiumLinuxPort.check_build):
(ChromiumLinuxPort._wdiff_missing_message):
* Scripts/webkitpy/layout_tests/port/chromium_mac.py:
(ChromiumMacPort.check_build):
(ChromiumMacPort):
(ChromiumMacPort._wdiff_missing_message):
* Scripts/webkitpy/layout_tests/port/chromium_mac_unittest.py:
(ChromiumMacPortTest):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (120864 => 120865)


--- trunk/Tools/ChangeLog	2012-06-20 21:25:08 UTC (rev 120864)
+++ trunk/Tools/ChangeLog	2012-06-20 21:30:13 UTC (rev 120865)
@@ -1,5 +1,36 @@
 2012-06-20  Dirk Pranke  <[email protected]>
 
+        nrwt outputs empty files for wdiff output if wdiff is not installed
+        https://bugs.webkit.org/show_bug.cgi?id=88709
+
+        Reviewed by Tony Chang.
+
+        Reviewed by Tony Chang.
+
+        Don't write -wdiff or -pretty.html files if wdiff or prettypatch
+        aren't available, and clean up the handling for them in the port
+        code.
+
+        * Scripts/webkitpy/run_webkit_tests_integrationtest.py:
+        (MainTest.test_output_diffs):
+        * Scripts/webkitpy/layout_tests/controllers/test_result_writer.py:
+        (TestResultWriter.create_text_diff_and_write_result):
+        * Scripts/webkitpy/layout_tests/port/base.py:
+        (Port.check_pretty_patch):
+        (Port.check_wdiff):
+        (Port._wdiff_missing_message):
+        * Scripts/webkitpy/layout_tests/port/chromium_linux.py:
+        (ChromiumLinuxPort.check_build):
+        (ChromiumLinuxPort._wdiff_missing_message):
+        * Scripts/webkitpy/layout_tests/port/chromium_mac.py:
+        (ChromiumMacPort.check_build):
+        (ChromiumMacPort):
+        (ChromiumMacPort._wdiff_missing_message):
+        * Scripts/webkitpy/layout_tests/port/chromium_mac_unittest.py:
+        (ChromiumMacPortTest):
+
+2012-06-20  Dirk Pranke  <[email protected]>
+
         nrwt: fix unit tests for ensuring svn revision is correct
         https://bugs.webkit.org/show_bug.cgi?id=89498
 

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/controllers/test_result_writer.py (120864 => 120865)


--- trunk/Tools/Scripts/webkitpy/layout_tests/controllers/test_result_writer.py	2012-06-20 21:25:08 UTC (rev 120864)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/controllers/test_result_writer.py	2012-06-20 21:30:13 UTC (rev 120865)
@@ -185,14 +185,16 @@
         fs.write_binary_file(diff_filename, diff)
 
         # Shell out to wdiff to get colored inline diffs.
-        wdiff = self._port.wdiff_text(expected_filename, actual_filename)
-        wdiff_filename = self.output_filename(self.FILENAME_SUFFIX_WDIFF)
-        fs.write_binary_file(wdiff_filename, wdiff)
+        if self._port.wdiff_available():
+            wdiff = self._port.wdiff_text(expected_filename, actual_filename)
+            wdiff_filename = self.output_filename(self.FILENAME_SUFFIX_WDIFF)
+            fs.write_binary_file(wdiff_filename, wdiff)
 
         # Use WebKit's PrettyPatch.rb to get an HTML diff.
-        pretty_patch = self._port.pretty_patch_text(diff_filename)
-        pretty_patch_filename = self.output_filename(self.FILENAME_SUFFIX_PRETTY_PATCH)
-        fs.write_binary_file(pretty_patch_filename, pretty_patch)
+        if self._port.pretty_patch_available():
+            pretty_patch = self._port.pretty_patch_text(diff_filename)
+            pretty_patch_filename = self.output_filename(self.FILENAME_SUFFIX_PRETTY_PATCH)
+            fs.write_binary_file(pretty_patch_filename, pretty_patch)
 
     def write_audio_files(self, actual_audio, expected_audio):
         self.write_output_files('.wav', actual_audio, expected_audio)

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/base.py (120864 => 120865)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/base.py	2012-06-20 21:25:08 UTC (rev 120864)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/base.py	2012-06-20 21:30:13 UTC (rev 120865)
@@ -208,14 +208,14 @@
         except OSError, e:
             if e.errno in [errno.ENOENT, errno.EACCES, errno.ECHILD]:
                 if logging:
-                    _log.error("Ruby is not installed; can't generate pretty patches.")
-                    _log.error('')
+                    _log.warning("Ruby is not installed; can't generate pretty patches.")
+                    _log.warning('')
                 return False
 
         if not self._filesystem.exists(self._pretty_patch_path):
             if logging:
-                _log.error("Unable to find %s; can't generate pretty patches." % self._pretty_patch_path)
-                _log.error('')
+                _log.warning("Unable to find %s; can't generate pretty patches." % self._pretty_patch_path)
+                _log.warning('')
             return False
 
         return True
@@ -229,11 +229,18 @@
             _ = self._executive.run_command([self._path_to_wdiff(), '--help'])
         except OSError:
             if logging:
-                _log.error("wdiff is not installed.")
+                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()

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium.py (120864 => 120865)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium.py	2012-06-20 21:25:08 UTC (rev 120864)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium.py	2012-06-20 21:30:13 UTC (rev 120865)
@@ -152,9 +152,9 @@
             result = self.check_image_diff(
                 'To override, invoke with --no-pixel-tests') and result
 
-        # It's okay if pretty patch isn't available, but we will at
-        # least log a message.
+        # It's okay if pretty patch and wdiff aren't available, but we will at least log messages.
         self._pretty_patch_available = self.check_pretty_patch()
+        self._wdiff_available = self.check_wdiff()
 
         return result
 

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_linux.py (120864 => 120865)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_linux.py	2012-06-20 21:25:08 UTC (rev 120864)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_linux.py	2012-06-20 21:30:13 UTC (rev 120865)
@@ -112,8 +112,6 @@
 
     def check_build(self, needs_http):
         result = chromium.ChromiumPort.check_build(self, needs_http)
-        result = self.check_wdiff() and result
-
         if not result:
             _log.error('For complete Linux build requirements, please see:')
             _log.error('')
@@ -145,13 +143,8 @@
             _log.error('')
         return result
 
-    def check_wdiff(self, logging=True):
-        result = self._check_file_exists(self._path_to_wdiff(), 'wdiff')
-        if not result and logging:
-            _log.error('    Please install using: "sudo apt-get install wdiff"')
-            _log.error('')
-        # FIXME: The ChromiumMac port always returns True.
-        return result
+    def _wdiff_missing_message(self):
+        return 'wdiff is not installed; please install using "sudo apt-get install wdiff"'
 
     def _path_to_apache(self):
         if self._is_redhat_based():

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_mac.py (120864 => 120865)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_mac.py	2012-06-20 21:25:08 UTC (rev 120864)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_mac.py	2012-06-20 21:30:13 UTC (rev 120865)
@@ -90,7 +90,6 @@
 
     def check_build(self, needs_http):
         result = chromium.ChromiumPort.check_build(self, needs_http)
-        result = self.check_wdiff() and result
         if not result:
             _log.error('For complete Mac build requirements, please see:')
             _log.error('')
@@ -105,18 +104,12 @@
     # PROTECTED METHODS
     #
 
-    def check_wdiff(self, logging=True):
-        try:
-            # We're ignoring the return and always returning True
-            self._executive.run_command([self._path_to_wdiff()], error_handler=self._executive.ignore_error)
-        except OSError:
-            if logging:
-                _log.warning('wdiff not found. Install using MacPorts or some other means')
-        return True
-
     def _lighttpd_path(self, *comps):
         return self.path_from_chromium_base('third_party', 'lighttpd', 'mac', *comps)
 
+    def _wdiff_missing_message(self):
+        return 'wdiff is not installed; please install from MacPorts or elsewhere'
+
     def _path_to_apache(self):
         return '/usr/sbin/httpd'
 

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_mac_unittest.py (120864 => 120865)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_mac_unittest.py	2012-06-20 21:25:08 UTC (rev 120864)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_mac_unittest.py	2012-06-20 21:30:13 UTC (rev 120865)
@@ -39,9 +39,6 @@
     port_name = 'chromium-mac'
     port_maker = chromium_mac.ChromiumMacPort
 
-    def test_check_wdiff(self):
-        self.assertTrue(self.make_port().check_wdiff())
-
     def assert_name(self, port_name, os_version_string, expected):
         port = self.make_port(os_version=os_version_string, port_name=port_name)
         self.assertEquals(expected, port.name())

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py (120864 => 120865)


--- trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py	2012-06-20 21:25:08 UTC (rev 120864)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py	2012-06-20 21:30:13 UTC (rev 120865)
@@ -885,7 +885,23 @@
         tests_run = get_tests_run(['http'], tests_included=True, flatten_batches=True)
         self.assertTrue('platform/test-snow-leopard/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.
+        host = MockHost()
+        res, out, err, _ = logging_run(['--pixel-tests', 'failures/unexpected/text-image-checksum.html'],
+                                       tests_included=True, record_results=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.assertEquals(full_results['has_wdiff'], False)
+        self.assertEquals(full_results['has_pretty_patch'], False)
+
+
 class EndToEndTest(unittest.TestCase):
     def parse_full_results(self, full_results_text):
         json_to_eval = full_results_text.replace("ADD_RESULTS(", "").replace(");", "")
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to