Title: [133559] trunk/Tools
Revision
133559
Author
[email protected]
Date
2012-11-05 22:06:05 -0800 (Mon, 05 Nov 2012)

Log Message

webkit-patch rebaseline*: fix handling of local file urls
https://bugs.webkit.org/show_bug.cgi?id=101296

Reviewed by Ojan Vafai.

When using --results-directory, we need to make sure we're converting
paths to file:/// urls for urllib to work correctly. Also, this
patch reworks the unit tests to get better coverage (of the execute()
command) and reduce copy/pasting of mock options.

* Scripts/webkitpy/tool/commands/rebaseline.py:
(RebaselineTest._rebaseline_test_and_update_expectations):
(RebaselineTest.execute):
* Scripts/webkitpy/tool/commands/rebaseline_unittest.py:
(TestRebaselineTest.setUp):
(test_rebaseline_updates_expectations_file):
(test_rebaseline_does_not_include_overrides):
(test_rebaseline_test_with_results_directory):
(test_rebaseline_test_internal_with_move_overwritten_baselines_to):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (133558 => 133559)


--- trunk/Tools/ChangeLog	2012-11-06 05:52:30 UTC (rev 133558)
+++ trunk/Tools/ChangeLog	2012-11-06 06:06:05 UTC (rev 133559)
@@ -1,3 +1,25 @@
+2012-11-05  Dirk Pranke  <[email protected]>
+
+        webkit-patch rebaseline*: fix handling of local file urls
+        https://bugs.webkit.org/show_bug.cgi?id=101296
+
+        Reviewed by Ojan Vafai.
+
+        When using --results-directory, we need to make sure we're converting
+        paths to file:/// urls for urllib to work correctly. Also, this
+        patch reworks the unit tests to get better coverage (of the execute()
+        command) and reduce copy/pasting of mock options.
+
+        * Scripts/webkitpy/tool/commands/rebaseline.py:
+        (RebaselineTest._rebaseline_test_and_update_expectations):
+        (RebaselineTest.execute):
+        * Scripts/webkitpy/tool/commands/rebaseline_unittest.py:
+        (TestRebaselineTest.setUp):
+        (test_rebaseline_updates_expectations_file):
+        (test_rebaseline_does_not_include_overrides):
+        (test_rebaseline_test_with_results_directory):
+        (test_rebaseline_test_internal_with_move_overwritten_baselines_to):
+
 2012-11-05  Kenneth Russell  <[email protected]>
 
         Added secondary email address and IRC nick.

Modified: trunk/Tools/Scripts/webkitpy/tool/commands/rebaseline.py (133558 => 133559)


--- trunk/Tools/Scripts/webkitpy/tool/commands/rebaseline.py	2012-11-06 05:52:30 UTC (rev 133558)
+++ trunk/Tools/Scripts/webkitpy/tool/commands/rebaseline.py	2012-11-06 06:06:05 UTC (rev 133559)
@@ -182,15 +182,18 @@
         _log.debug("Retrieving %s." % source_baseline)
         self._save_baseline(self._tool.web.get_binary(source_baseline, convert_404_to_None=True), target_baseline)
 
-    def _rebaseline_test_and_update_expectations(self, builder_name, test_name, platforms_to_move_existing_baselines_to, results_url):
+    def _rebaseline_test_and_update_expectations(self, options):
+        if options.results_directory:
+            results_url = 'file://' + options.results_directory
+        else:
+            results_url = self._results_url(options.builder)
+        self._baseline_suffix_list = options.suffixes.split(',')
         for suffix in self._baseline_suffix_list:
-            self._rebaseline_test(builder_name, test_name, platforms_to_move_existing_baselines_to, suffix, results_url)
-        self._update_expectations_file(builder_name, test_name)
+            self._rebaseline_test(options.builder, options.test, options.move_overwritten_baselines_to, suffix, results_url)
+        self._update_expectations_file(options.builder, options.test)
 
     def execute(self, options, args, tool):
-        self._baseline_suffix_list = options.suffixes.split(',')
-        results_url = options.results_directory or self._results_url(options.builder)
-        self._rebaseline_test_and_update_expectations(options.builder, options.test, options.move_overwritten_baselines_to, results_url)
+        self._rebaseline_test_and_update_expectations(options)
         print json.dumps(self._scm_changes)
 
 

Modified: trunk/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py (133558 => 133559)


--- trunk/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py	2012-11-06 05:52:30 UTC (rev 133558)
+++ trunk/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py	2012-11-06 06:06:05 UTC (rev 133559)
@@ -76,6 +76,11 @@
 class TestRebaselineTest(_BaseTestCase):
     command_constructor = RebaselineTest  # AKA webkit-patch rebaseline-test-internal
 
+    def setUp(self):
+        super(TestRebaselineTest, self).setUp()
+        self.options = MockOptions(builder="WebKit Mac10.7", test="userscripts/another-test.html", suffixes="txt",
+                                   move_overwritten_baselines_to=None, results_directory=None)
+
     def test_baseline_directory(self):
         command = self.command
         self.assertEqual(command._baseline_directory("Apple Win XP Debug (Tests)"), "/mock-checkout/LayoutTests/platform/win-xp")
@@ -97,7 +102,8 @@
         self._write("fast/css/large-list-of-rules-crash.html", "Dummy test contents")
         self._write("userscripts/another-test.html", "Dummy test contents")
 
-        self.command._rebaseline_test_and_update_expectations("WebKit Mac10.7", "userscripts/another-test.html", None, self.WEB_PREFIX)
+        self.options.suffixes = "png,wav,txt"
+        self.command._rebaseline_test_and_update_expectations(self.options)
 
         self.assertEquals(self.tool.web.urls_fetched,
             [self.WEB_PREFIX + '/userscripts/another-test-actual.png',
@@ -112,7 +118,8 @@
         self._write(self.lion_expectations_path, "Bug(x) [ Mac ] userscripts/another-test.html [ ImageOnlyFailure ]\nbug(z) [ Linux ] userscripts/another-test.html [ ImageOnlyFailure ]\n")
         self._write("userscripts/another-test.html", "Dummy test contents")
 
-        self.command._rebaseline_test_and_update_expectations("WebKit Mac10.7", "userscripts/another-test.html", None, self.WEB_PREFIX)
+        self.options.suffixes = 'png,wav,txt'
+        self.command._rebaseline_test_and_update_expectations(self.options)
 
         self.assertEquals(self.tool.web.urls_fetched,
             [self.WEB_PREFIX + '/userscripts/another-test-actual.png',
@@ -126,7 +133,8 @@
         self._write(self.lion_port.path_from_chromium_base('skia', 'skia_test_expectations.txt'), "Bug(y) [ Mac ] other-test.html [ Failure ]\n")
         self._write("userscripts/another-test.html", "Dummy test contents")
 
-        self.command._rebaseline_test_and_update_expectations("WebKit Mac10.7", "userscripts/another-test.html", None, self.WEB_PREFIX)
+        self.options.suffixes = 'png,wav,txt'
+        self.command._rebaseline_test_and_update_expectations(self.options)
 
         self.assertEquals(self.tool.web.urls_fetched,
             [self.WEB_PREFIX + '/userscripts/another-test-actual.png',
@@ -141,8 +149,10 @@
         self.assertEquals(self.tool.web.urls_fetched, [self.WEB_PREFIX + '/userscripts/another-test-actual.txt'])
 
     def test_rebaseline_test_with_results_directory(self):
-        self.command._rebaseline_test("WebKit Linux", "userscripts/another-test.html", None, "txt", '/tmp')
-        self.assertEquals(self.tool.web.urls_fetched, ['/tmp/userscripts/another-test-actual.txt'])
+        self._write(self.lion_expectations_path, "Bug(x) [ Mac ] userscripts/another-test.html [ ImageOnlyFailure ]\nbug(z) [ Linux ] userscripts/another-test.html [ ImageOnlyFailure ]\n")
+        self.options.results_directory = '/tmp'
+        self.command._rebaseline_test_and_update_expectations(self.options)
+        self.assertEquals(self.tool.web.urls_fetched, ['file:///tmp/userscripts/another-test-actual.txt'])
 
     def test_rebaseline_test_and_print_scm_changes(self):
         self.command._print_scm_changes = True
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to