Title: [113801] trunk/Tools
Revision
113801
Author
dpra...@chromium.org
Date
2012-04-10 18:30:24 -0700 (Tue, 10 Apr 2012)

Log Message

webkitpy: refactor handling of --platform and related options
https://bugs.webkit.org/show_bug.cgi?id=83525

Reviewed by Adam Barth.

This change moves to centralize handling of --platform, --debug,
--gtk, and other similar flags into a central place next to the
code that actually uses those flags in PortFactory to get the
right Port object.

* Scripts/webkitpy/layout_tests/port/__init__.py:
* Scripts/webkitpy/layout_tests/port/factory.py:
(port_options):
* Scripts/webkitpy/layout_tests/run_webkit_tests.py:
(parse_args):
* Scripts/webkitpy/tool/commands/queries.py:
(PrintBaselines.__init__):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (113800 => 113801)


--- trunk/Tools/ChangeLog	2012-04-11 01:24:07 UTC (rev 113800)
+++ trunk/Tools/ChangeLog	2012-04-11 01:30:24 UTC (rev 113801)
@@ -1,3 +1,23 @@
+2012-04-10  Dirk Pranke  <dpra...@chromium.org>
+
+        webkitpy: refactor handling of --platform and related options
+        https://bugs.webkit.org/show_bug.cgi?id=83525
+
+        Reviewed by Adam Barth.
+
+        This change moves to centralize handling of --platform, --debug,
+        --gtk, and other similar flags into a central place next to the
+        code that actually uses those flags in PortFactory to get the
+        right Port object.
+
+        * Scripts/webkitpy/layout_tests/port/__init__.py:
+        * Scripts/webkitpy/layout_tests/port/factory.py:
+        (port_options):
+        * Scripts/webkitpy/layout_tests/run_webkit_tests.py:
+        (parse_args):
+        * Scripts/webkitpy/tool/commands/queries.py:
+        (PrintBaselines.__init__):
+
 2012-04-10  Ojan Vafai  <o...@chromium.org>
 
         Add a chromeless view to the individual tests view

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/__init__.py (113800 => 113801)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/__init__.py	2012-04-11 01:24:07 UTC (rev 113800)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/__init__.py	2012-04-11 01:30:24 UTC (rev 113801)
@@ -33,3 +33,4 @@
 
 from base import Port  # It's possible we don't need to export this virtual baseclass outside the module.
 from driver import Driver, DriverInput, DriverOutput
+from factory import port_options

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/factory.py (113800 => 113801)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/factory.py	2012-04-11 01:24:07 UTC (rev 113800)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/factory.py	2012-04-11 01:30:24 UTC (rev 113801)
@@ -29,11 +29,33 @@
 
 """Factory method to retrieve the appropriate port implementation."""
 
+import optparse
 import re
 
 from webkitpy.layout_tests.port import builders
 
 
+def port_options(**help_strings):
+    return [
+        optparse.make_option("-t", "--target", dest="configuration",
+            help="(DEPRECATED)"),
+        # FIXME: --help should display which configuration is default.
+        optparse.make_option('--debug', action='', const='Debug', dest="configuration",
+            help='Set the configuration to Debug'),
+        optparse.make_option('--release', action='', const='Release', dest="configuration",
+            help='Set the configuration to Release'),
+        optparse.make_option('--platform', action='',
+            help=help_strings.get('platform', 'Platform/Port being tested (e.g., "mac-lion")')),
+        optparse.make_option("--chromium", action="" const='chromium', dest='platform',
+            help='Alias for --platform=chromium'),
+        optparse.make_option('--efl', action='', const='efl', dest="platform",
+            help='Alias for --platform=efl'),
+        optparse.make_option('--gtk', action='', const='gtk', dest="platform",
+            help='Alias for --platform=gtk'),
+        optparse.make_option('--qt', action='', const='qt', dest="platform",
+            help='Alias for --platform=qt')]
+
+
 class BuilderOptions(object):
     def __init__(self, builder_name):
         self.configuration = "Debug" if re.search(r"[d|D](ebu|b)g", builder_name) else "Release"

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py (113800 => 113801)


--- trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py	2012-04-11 01:24:07 UTC (rev 113800)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py	2012-04-11 01:30:24 UTC (rev 113801)
@@ -39,6 +39,7 @@
 from webkitpy.common.host import Host
 from webkitpy.layout_tests.controllers.manager import Manager, WorkerException
 from webkitpy.layout_tests.models import test_expectations
+from webkitpy.layout_tests.port import port_options
 from webkitpy.layout_tests.views import printing
 
 
@@ -191,27 +192,7 @@
 
     option_group_definitions = []
 
-    # FIXME: All of these options should be stored closer to the code which
-    # FIXME: actually uses them. configuration_options should move
-    # FIXME: to WebKitPort and be shared across all scripts.
-    option_group_definitions.append(("Configuration Options", [
-        optparse.make_option("-t", "--target", dest="configuration",
-                             help="(DEPRECATED)"),
-        # FIXME: --help should display which configuration is default.
-        optparse.make_option('--debug', action='', const='Debug',
-                             dest="configuration",
-                             help='Set the configuration to Debug'),
-        optparse.make_option('--release', action='',
-                             const='Release', dest="configuration",
-                             help='Set the configuration to Release'),
-        # old-run-webkit-tests also accepts -c, --configuration CONFIGURATION.
-        optparse.make_option("--platform", help="Override port/platform being tested (i.e. chromium-mac)"),
-        optparse.make_option("--chromium", action="" const='chromium', dest='platform', help='Alias for --platform=chromium'),
-        optparse.make_option('--efl', action='', const='efl', dest="platform", help='Alias for --platform=efl'),
-        optparse.make_option('--gtk', action='', const='gtk', dest="platform", help='Alias for --platform=gtk'),
-        optparse.make_option('--qt', action='', const='qt', dest="platform", help='Alias for --platform=qt'),
-    ]))
-
+    option_group_definitions.append(("Configuration options", port_options()))
     option_group_definitions.append(("Printing Options", printing.print_options()))
 
     # FIXME: These options should move onto the ChromiumPort.

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


--- trunk/Tools/Scripts/webkitpy/tool/commands/queries.py	2012-04-11 01:24:07 UTC (rev 113800)
+++ trunk/Tools/Scripts/webkitpy/tool/commands/queries.py	2012-04-11 01:30:24 UTC (rev 113801)
@@ -44,7 +44,7 @@
 from webkitpy.tool.grammar import pluralize
 from webkitpy.tool.multicommandtool import AbstractDeclarativeCommand
 from webkitpy.common.system.deprecated_logging import log
-from webkitpy.layout_tests import port
+from webkitpy.layout_tests.port import port_options
 
 
 class SuggestReviewers(AbstractDeclarativeCommand):
@@ -407,15 +407,13 @@
 
     def __init__(self):
         options = [
-            make_option('-p', '--platform', action='',
-                        help='platform/port(s) to display expectations for. Use glob-style wildcards for multiple ports (note that that will imply --csv)'),
             make_option('--all', action='', default=False,
                         help='display the baselines for *all* tests'),
             make_option('--csv', action='', default=False,
                         help='Print a CSV-style report that includes the port name, test_name, test platform, baseline type, baseline location, and baseline platform'),
             make_option('--include-virtual-tests', action='',
                         help='Include virtual tests'),
-        ]
+        ] + port_options(platform='port/platform to use. Use glob-style wildcards for multiple ports (implies --csv)')
         AbstractDeclarativeCommand.__init__(self, options=options)
         self._platform_regexp = re.compile('platform/([^\/]+)/(.+)')
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to