Title: [109831] trunk/Tools
Revision
109831
Author
[email protected]
Date
2012-03-05 18:04:22 -0800 (Mon, 05 Mar 2012)

Log Message

There should be a way to disable optimizer in webkit-patch rebaseline-expectations
https://bugs.webkit.org/show_bug.cgi?id=69590

Reviewed by Ryosuke Niwa.

Adds a --no-optimize flag to webkit-patch rebaseline-expectations
to skip the 'optimize-expectations' step.

* Scripts/webkitpy/tool/commands/rebaseline.py:
(RebaselineExpectations.__init__):
(RebaselineExpectations.execute):
* Scripts/webkitpy/tool/commands/rebaseline_unittest.py:

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (109830 => 109831)


--- trunk/Tools/ChangeLog	2012-03-06 01:56:28 UTC (rev 109830)
+++ trunk/Tools/ChangeLog	2012-03-06 02:04:22 UTC (rev 109831)
@@ -1,3 +1,18 @@
+2012-03-05  Dirk Pranke  <[email protected]>
+
+        There should be a way to disable optimizer in webkit-patch rebaseline-expectations
+        https://bugs.webkit.org/show_bug.cgi?id=69590
+
+        Reviewed by Ryosuke Niwa.
+
+        Adds a --no-optimize flag to webkit-patch rebaseline-expectations
+        to skip the 'optimize-expectations' step.
+
+        * Scripts/webkitpy/tool/commands/rebaseline.py:
+        (RebaselineExpectations.__init__):
+        (RebaselineExpectations.execute):
+        * Scripts/webkitpy/tool/commands/rebaseline_unittest.py:
+
 2012-03-05  Kent Tamura  <[email protected]>
 
         [Chromium] Add new popup type: PagePopup

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


--- trunk/Tools/Scripts/webkitpy/tool/commands/rebaseline.py	2012-03-06 01:56:28 UTC (rev 109830)
+++ trunk/Tools/Scripts/webkitpy/tool/commands/rebaseline.py	2012-03-06 02:04:22 UTC (rev 109831)
@@ -26,6 +26,7 @@
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
+import optparse
 import os.path
 import re
 import shutil
@@ -150,6 +151,15 @@
     name = "rebaseline-expectations"
     help_text = "Rebaselines the tests indicated in test_expectations.txt."
 
+    def __init__(self):
+        options = [
+            optparse.make_option('--no-optimize', dest='optimize', action='', default=True,
+                help=('Do not optimize/de-dup the expectations after rebaselining '
+                      '(default is to de-dup automatically). '
+                      'You can use "webkit-patch optimize-baselines" to optimize separately.')),
+        ]
+        AbstractDeclarativeCommand.__init__(self, options=options)
+
     def _run_webkit_patch(self, args):
         try:
             self._tool.executive.run_command([self._tool.path()] + args, cwd=self._tool.scm().checkout_root)
@@ -192,6 +202,8 @@
             self._rebaseline_port(port_name)
         for port_name in tool.port_factory.all_port_names():
             self._update_expectations_file(port_name)
+        if not options.optimize:
+            return
         for test_name in self._touched_test_names:
             print "Optimizing baselines for %s." % test_name
             self._run_webkit_patch(['optimize-baselines', test_name])

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


--- trunk/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py	2012-03-06 01:56:28 UTC (rev 109830)
+++ trunk/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py	2012-03-06 02:04:22 UTC (rev 109831)
@@ -31,7 +31,7 @@
 from webkitpy.common.system.outputcapture import OutputCapture
 from webkitpy.thirdparty.mock import Mock
 from webkitpy.tool.commands.rebaseline import *
-from webkitpy.tool.mocktool import MockTool
+from webkitpy.tool.mocktool import MockTool, MockOptions
 from webkitpy.common.system.executive_mock import MockExecutive
 
 
@@ -84,9 +84,8 @@
 Retrieving results for chromium-win-xp from Webkit Win.
     userscripts/another-test.html
     userscripts/images.svg
-Optimizing baselines for userscripts/another-test.html.
-Optimizing baselines for userscripts/images.svg.
 """
+
         expected_stderr = """MOCK run_command: ['echo', 'rebaseline-test', 'Webkit Linux 32', 'userscripts/another-test.html'], cwd=/mock-checkout
 MOCK run_command: ['echo', 'rebaseline-test', 'Webkit Linux 32', 'userscripts/images.svg'], cwd=/mock-checkout
 MOCK run_command: ['echo', 'rebaseline-test', 'Webkit Linux', 'userscripts/another-test.html'], cwd=/mock-checkout
@@ -101,8 +100,17 @@
 MOCK run_command: ['echo', 'rebaseline-test', 'Webkit Win7', 'userscripts/images.svg'], cwd=/mock-checkout
 MOCK run_command: ['echo', 'rebaseline-test', 'Webkit Win', 'userscripts/another-test.html'], cwd=/mock-checkout
 MOCK run_command: ['echo', 'rebaseline-test', 'Webkit Win', 'userscripts/images.svg'], cwd=/mock-checkout
-MOCK run_command: ['echo', 'optimize-baselines', 'userscripts/another-test.html'], cwd=/mock-checkout
-MOCK run_command: ['echo', 'optimize-baselines', 'userscripts/images.svg'], cwd=/mock-checkout
 """
+
         command._tests_to_rebaseline = lambda port: [] if not port.name().find('-gpu-') == -1 else ['userscripts/another-test.html', 'userscripts/images.svg']
-        OutputCapture().assert_outputs(self, command.execute, [None, [], tool], expected_stdout=expected_stdout, expected_stderr=expected_stderr)
+        OutputCapture().assert_outputs(self, command.execute, [MockOptions(optimize=False), [], tool], expected_stdout=expected_stdout, expected_stderr=expected_stderr)
+
+        expected_stdout_with_optimize = expected_stdout + (
+            "Optimizing baselines for userscripts/another-test.html.\n"
+            "Optimizing baselines for userscripts/images.svg.\n")
+        expected_stderr_with_optimize = expected_stderr + (
+            "MOCK run_command: ['echo', 'optimize-baselines', 'userscripts/another-test.html'], cwd=/mock-checkout\n"
+            "MOCK run_command: ['echo', 'optimize-baselines', 'userscripts/images.svg'], cwd=/mock-checkout\n")
+
+        command._tests_to_rebaseline = lambda port: [] if not port.name().find('-gpu-') == -1 else ['userscripts/another-test.html', 'userscripts/images.svg']
+        OutputCapture().assert_outputs(self, command.execute, [MockOptions(optimize=True), [], tool], expected_stdout=expected_stdout_with_optimize, expected_stderr=expected_stderr_with_optimize)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to