Title: [120851] trunk/Tools
Revision
120851
Author
[email protected]
Date
2012-06-20 12:47:23 -0700 (Wed, 20 Jun 2012)

Log Message

tweak output of webkit-patch print-{baselines,expectations}
https://bugs.webkit.org/show_bug.cgi?id=89588

Reviewed by Tony Chang.

Minor tweaks to the output to make it more readable, including
turning off csv by default for print-baselines with multiple ports.

* Scripts/webkitpy/layout_tests/port/test.py:
(TestPort):
* Scripts/webkitpy/tool/commands/queries.py:
(PrintExpectations.execute):
(PrintBaselines.execute):
* Scripts/webkitpy/tool/commands/queries_unittest.py:
(PrintExpectationsTest.run_test):
(PrintExpectationsTest.test_multiple):
(PrintBaselinesTest.setUp):
(PrintBaselinesTest.test_multiple):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (120850 => 120851)


--- trunk/Tools/ChangeLog	2012-06-20 19:33:02 UTC (rev 120850)
+++ trunk/Tools/ChangeLog	2012-06-20 19:47:23 UTC (rev 120851)
@@ -1,3 +1,24 @@
+2012-06-20  Dirk Pranke  <[email protected]>
+
+        tweak output of webkit-patch print-{baselines,expectations}
+        https://bugs.webkit.org/show_bug.cgi?id=89588
+
+        Reviewed by Tony Chang.
+
+        Minor tweaks to the output to make it more readable, including
+        turning off csv by default for print-baselines with multiple ports.
+
+        * Scripts/webkitpy/layout_tests/port/test.py:
+        (TestPort):
+        * Scripts/webkitpy/tool/commands/queries.py:
+        (PrintExpectations.execute):
+        (PrintBaselines.execute):
+        * Scripts/webkitpy/tool/commands/queries_unittest.py:
+        (PrintExpectationsTest.run_test):
+        (PrintExpectationsTest.test_multiple):
+        (PrintBaselinesTest.setUp):
+        (PrintBaselinesTest.test_multiple):
+
 2012-06-18  Dirk Pranke  <[email protected]>
 
         new-run-webkit-tests should spin-up enough httpd processes to avoid timeouts

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/test.py (120850 => 120851)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/test.py	2012-06-20 19:33:02 UTC (rev 120850)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/test.py	2012-06-20 19:47:23 UTC (rev 120851)
@@ -320,9 +320,9 @@
 
     """Test implementation of the Port interface."""
     ALL_BASELINE_VARIANTS = (
+        'test-linux-x86_64',
         'test-mac-snowleopard', 'test-mac-leopard',
-        'test-win-win7', 'test-win-vista', 'test-win-xp',
-        'test-linux-x86_64',
+        'test-win-vista', 'test-win-win7', 'test-win-xp',
     )
 
     @classmethod

Modified: trunk/Tools/Scripts/webkitpy/tool/commands/queries.py (120850 => 120851)


--- trunk/Tools/Scripts/webkitpy/tool/commands/queries.py	2012-06-20 19:33:02 UTC (rev 120850)
+++ trunk/Tools/Scripts/webkitpy/tool/commands/queries.py	2012-06-20 19:47:23 UTC (rev 120851)
@@ -406,7 +406,6 @@
             print "You must either specify one or more test paths or --all."
             return
 
-        default_port = tool.port_factory.get(options=options)
         if options.platform:
             port_names = fnmatch.filter(tool.port_factory.all_port_names(), options.platform)
             if not port_names:
@@ -416,7 +415,10 @@
                 else:
                     print "No port names match '%s'" % options.platform
                     return
+            else:
+                default_port = tool.port_factory.get(port_names[0])
         else:
+            default_port = tool.port_factory.get(options=options)
             port_names = [default_port.name()]
 
         serializer = TestExpectationSerializer()
@@ -425,6 +427,8 @@
             model = self._model(options, port_name, tests)
             tests_to_print = self._filter_tests(options, model, tests)
             lines = [model.get_expectation_line(test) for test in sorted(tests_to_print)]
+            if port_name != port_names[0]:
+                print
             print '\n'.join(self._format_lines(options, port_name, serializer, lines))
 
     def _filter_tests(self, options, model, tests):
@@ -489,19 +493,17 @@
         else:
             port_names = [default_port.name()]
 
-        if len(port_names) > 1:
-            options.csv = True
-
         if options.include_virtual_tests:
             tests = sorted(default_port.tests(args))
         else:
             # FIXME: make real_tests() a public method.
             tests = sorted(default_port._real_tests(args))
 
-        if not options.csv:
-            print "// For %s" % port_names[0]
-
         for port_name in port_names:
+            if port_name != port_names[0]:
+                print
+            if not options.csv:
+                print "// For %s" % port_name
             port = tool.port_factory.get(port_name)
             for test_name in tests:
                 self._print_baselines(options, port_name, test_name, port.expected_baselines_by_extension(test_name))

Modified: trunk/Tools/Scripts/webkitpy/tool/commands/queries_unittest.py (120850 => 120851)


--- trunk/Tools/Scripts/webkitpy/tool/commands/queries_unittest.py	2012-06-20 19:33:02 UTC (rev 120850)
+++ trunk/Tools/Scripts/webkitpy/tool/commands/queries_unittest.py	2012-06-20 19:47:23 UTC (rev 120851)
@@ -32,6 +32,7 @@
 from webkitpy.common.net.bugzilla import Bugzilla
 from webkitpy.common.system.outputcapture import OutputCapture
 from webkitpy.thirdparty.mock import Mock
+from webkitpy.layout_tests.port.test import TestPort
 from webkitpy.tool.commands.commandtest import CommandsTest
 from webkitpy.tool.commands.queries import *
 from webkitpy.tool.mocktool import MockTool, MockOptions
@@ -107,10 +108,11 @@
 
 
 class PrintExpectationsTest(unittest.TestCase):
-    def run_test(self, tests, expected_stdout, **args):
-        options = MockOptions(all=False, csv=False, full=False, platform='test-win-xp',
+    def run_test(self, tests, expected_stdout, platform='test-win-xp', **args):
+        options = MockOptions(all=False, csv=False, full=False, platform=platform,
                               include_keyword=[], exclude_keyword=[]).update(**args)
         tool = MockTool()
+        tool.port_factory.all_port_names = lambda: TestPort.ALL_BASELINE_VARIANTS
         command = PrintExpectations()
         command.bind_to_tool(tool)
 
@@ -128,6 +130,21 @@
                        'failures/expected/image.html = IMAGE\n'
                        'failures/expected/text.html = TEXT\n'))
 
+    def test_multiple(self):
+        self.run_test(['failures/expected/text.html', 'failures/expected/image.html'],
+                      ('// For test-win-vista\n'
+                       'failures/expected/image.html = IMAGE\n'
+                       'failures/expected/text.html = TEXT\n'
+                       '\n'
+                       '// For test-win-win7\n'
+                       'failures/expected/image.html = IMAGE\n'
+                       'failures/expected/text.html = TEXT\n'
+                       '\n'
+                       '// For test-win-xp\n'
+                       'failures/expected/image.html = IMAGE\n'
+                       'failures/expected/text.html = TEXT\n'),
+                       platform='test-win-*')
+
     def test_full(self):
         self.run_test(['failures/expected/text.html', 'failures/expected/image.html'],
                       ('// For test-win-xp\n'
@@ -160,7 +177,7 @@
         self.tool = MockTool()
         self.test_port = self.tool.port_factory.get('test-win-xp')
         self.tool.port_factory.get = lambda port_name=None: self.test_port
-        self.tool.port_factory.all_port_names = lambda: ['test-win-xp']
+        self.tool.port_factory.all_port_names = lambda: TestPort.ALL_BASELINE_VARIANTS
 
     def tearDown(self):
         if self.oc:
@@ -186,6 +203,25 @@
                            'passes/text-expected.png\n'
                            'passes/text-expected.txt\n'))
 
+    def test_multiple(self):
+        command = PrintBaselines()
+        command.bind_to_tool(self.tool)
+        self.capture_output()
+        command.execute(MockOptions(all=False, include_virtual_tests=False, csv=False, platform='test-win-*'), ['passes/text.html'], self.tool)
+        stdout, _, _ = self.restore_output()
+        self.assertEquals(stdout,
+                          ('// For test-win-vista\n'
+                           'passes/text-expected.png\n'
+                           'passes/text-expected.txt\n'
+                           '\n'
+                           '// For test-win-win7\n'
+                           'passes/text-expected.png\n'
+                           'passes/text-expected.txt\n'
+                           '\n'
+                           '// For test-win-xp\n'
+                           'passes/text-expected.png\n'
+                           'passes/text-expected.txt\n'))
+
     def test_csv(self):
         command = PrintBaselines()
         command.bind_to_tool(self.tool)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to