Diff
Modified: trunk/Tools/ChangeLog (133050 => 133051)
--- trunk/Tools/ChangeLog 2012-10-31 18:28:37 UTC (rev 133050)
+++ trunk/Tools/ChangeLog 2012-10-31 18:32:19 UTC (rev 133051)
@@ -1,3 +1,36 @@
+2012-10-31 Dirk Pranke <[email protected]>
+
+ webkitpy: refactor common command line arguments for --platform, rebaseline commands
+ https://bugs.webkit.org/show_bug.cgi?id=100800
+
+ Reviewed by Ojan Vafai.
+
+ This change shuffles around how we share command-line options
+ between NRWT and the various webkit-patch rebaselining commands.
+
+ There are no functional changes in this patch but it should make
+ things clearer and will be useful in a couple of upcoming patches.
+
+ * Scripts/webkitpy/layout_tests/port/__init__.py:
+ * Scripts/webkitpy/layout_tests/port/factory.py:
+ (platform_options):
+ (configuration_options):
+ * Scripts/webkitpy/layout_tests/run_webkit_tests.py:
+ (parse_args):
+ * Scripts/webkitpy/tool/commands/queries.py:
+ (PrintExpectations.__init__):
+ (PrintBaselines.__init__):
+ * Scripts/webkitpy/tool/commands/rebaseline.py:
+ (AbstractRebaseliningCommand):
+ (AbstractRebaseliningCommand.__init__):
+ (RebaselineTest.__init__):
+ (OptimizeBaselines.__init__):
+ (AnalyzeBaselines.__init__):
+ (AbstractParallelRebaselineCommand):
+ (RebaselineJson.__init__):
+ (RebaselineExpectations.__init__):
+ (Rebaseline.__init__):
+
2012-10-31 Thiago Marcos P. Santos <[email protected]>
[NRWT] Xvfb driver is leaking application cache files
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/__init__.py (133050 => 133051)
--- trunk/Tools/Scripts/webkitpy/layout_tests/port/__init__.py 2012-10-31 18:28:37 UTC (rev 133050)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/__init__.py 2012-10-31 18:32:19 UTC (rev 133051)
@@ -33,4 +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
+from factory import platform_options, configuration_options
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/factory.py (133050 => 133051)
--- trunk/Tools/Scripts/webkitpy/layout_tests/port/factory.py 2012-10-31 18:28:37 UTC (rev 133050)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/factory.py 2012-10-31 18:32:19 UTC (rev 133051)
@@ -35,15 +35,8 @@
from webkitpy.layout_tests.port import builders
-def port_options(**help_strings):
+def platform_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',
@@ -56,10 +49,23 @@
help='Alias for --platform=gtk'),
optparse.make_option('--qt', action='', const='qt', dest="platform",
help='Alias for --platform=qt'),
+ ]
+
+
+def configuration_options():
+ 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('--32-bit', action='', const='x86', default=None, dest="architecture",
- help='use 32-bit binaries by default (x86 instead of x86_64)')]
+ help='use 32-bit binaries by default (x86 instead of x86_64)'),
+ ]
+
def _builder_options(builder_name):
configuration = "Debug" if re.search(r"[d|D](ebu|b)g", builder_name) else "Release"
is_webkit2 = builder_name.find("WK2") != -1
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py (133050 => 133051)
--- trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py 2012-10-31 18:28:37 UTC (rev 133050)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py 2012-10-31 18:32:19 UTC (rev 133051)
@@ -41,7 +41,7 @@
from webkitpy.common.system import stack_utils
from webkitpy.layout_tests.controllers.manager import Manager, WorkerException, TestRunInterruptedException
from webkitpy.layout_tests.models import test_expectations
-from webkitpy.layout_tests.port import port_options
+from webkitpy.layout_tests.port import configuration_options, platform_options
from webkitpy.layout_tests.views import printing
@@ -201,7 +201,8 @@
option_group_definitions = []
- option_group_definitions.append(("Configuration options", port_options()))
+ option_group_definitions.append(("Platform options", platform_options()))
+ option_group_definitions.append(("Configuration options", configuration_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 (133050 => 133051)
--- trunk/Tools/Scripts/webkitpy/tool/commands/queries.py 2012-10-31 18:28:37 UTC (rev 133050)
+++ trunk/Tools/Scripts/webkitpy/tool/commands/queries.py 2012-10-31 18:32:19 UTC (rev 133051)
@@ -47,7 +47,7 @@
from webkitpy.tool.multicommandtool import AbstractDeclarativeCommand
from webkitpy.common.system.deprecated_logging import log
from webkitpy.layout_tests.models.test_expectations import TestExpectations
-from webkitpy.layout_tests.port import port_options
+from webkitpy.layout_tests.port import platform_options, configuration_options
class SuggestReviewers(AbstractDeclarativeCommand):
@@ -440,7 +440,7 @@
help='Print a CSV-style report that includes the port name, modifiers, tests, and expectations'),
make_option('-f', '--full', action='', default=False,
help='Print a full TestExpectations-style line for every match'),
- ] + port_options(platform='port/platform to use. Use glob-style wildcards for multiple ports (implies --csv)')
+ ] + platform_options(platform='port/platform to use. Use glob-style wildcards for multiple ports (implies --csv)') + configuration_options()
AbstractDeclarativeCommand.__init__(self, options=options)
self._expectation_models = {}
@@ -519,7 +519,7 @@
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)')
+ ] + platform_options(platform='port/platform to use. Use glob-style wildcards for multiple ports (implies --csv)') + configuration_options()
AbstractDeclarativeCommand.__init__(self, options=options)
self._platform_regexp = re.compile('platform/([^\/]+)/(.+)')
Modified: trunk/Tools/Scripts/webkitpy/tool/commands/rebaseline.py (133050 => 133051)
--- trunk/Tools/Scripts/webkitpy/tool/commands/rebaseline.py 2012-10-31 18:28:37 UTC (rev 133050)
+++ trunk/Tools/Scripts/webkitpy/tool/commands/rebaseline.py 2012-10-31 18:32:19 UTC (rev 133051)
@@ -46,24 +46,29 @@
from webkitpy.layout_tests.models.test_configuration import TestConfiguration
from webkitpy.layout_tests.models.test_expectations import TestExpectations, BASELINE_SUFFIX_LIST
from webkitpy.layout_tests.port import builders
+from webkitpy.layout_tests.port import factory
from webkitpy.tool.grammar import pluralize
from webkitpy.tool.multicommandtool import AbstractDeclarativeCommand
_log = logging.getLogger(__name__)
+
# FIXME: Should TestResultWriter know how to compute this string?
def _baseline_name(fs, test_name, suffix):
return fs.splitext(test_name)[0] + TestResultWriter.FILENAME_SUFFIX_EXPECTED + "." + suffix
class AbstractRebaseliningCommand(AbstractDeclarativeCommand):
+ no_optimize_option = 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.'))
+
+ suffixes_option = optparse.make_option("--suffixes", default=','.join(BASELINE_SUFFIX_LIST), action=""
+ help="Comma-separated-list of file types to rebaseline")
+
def __init__(self, options=None):
- options = options or []
- options.extend([
- optparse.make_option('--suffixes', default=','.join(BASELINE_SUFFIX_LIST), action='',
- help='file types to rebaseline')])
- AbstractDeclarativeCommand.__init__(self, options=options)
+ super(AbstractRebaseliningCommand, self).__init__(options=options)
self._baseline_suffix_list = BASELINE_SUFFIX_LIST
@@ -72,13 +77,14 @@
help_text = "Rebaseline a single test from a buildbot. Only intended for use by other webkit-patch commands."
def __init__(self):
- options = [
+ super(RebaselineTest, self).__init__(options=[
+ self.no_optimize_option,
+ self.suffixes_option,
optparse.make_option("--builder", help="Builder to pull new baselines from"),
optparse.make_option("--move-overwritten-baselines-to", action="" default=[],
help="Platform to move existing baselines to before rebaselining. This is for bringing up new ports."),
optparse.make_option("--test", help="Test to rebaseline"),
- ]
- AbstractRebaseliningCommand.__init__(self, options=options)
+ ])
self._scm_changes = {'add': []}
def _results_url(self, builder_name):
@@ -182,6 +188,9 @@
help_text = "Reshuffles the baselines for the given tests to use as litte space on disk as possible."
argument_names = "TEST_NAMES"
+ def __init__(self):
+ return super(OptimizeBaselines, self).__init__(options=[self.suffixes_option])
+
def _optimize_baseline(self, test_name):
for suffix in self._baseline_suffix_list:
baseline_name = _baseline_name(self._tool.filesystem, test_name, suffix)
@@ -203,6 +212,9 @@
help_text = "Analyzes the baselines for the given tests and prints results that are identical."
argument_names = "TEST_NAMES"
+ def __init__(self):
+ return super(AnalyzeBaselines, self).__init__(options=[self.suffixes_option])
+
def _print(self, baseline_name, directories_by_result):
for result, directories in directories_by_result.items():
if len(directories) <= 1:
@@ -225,15 +237,7 @@
self._analyze_baseline(test_name)
-class AbstractParallelRebaselineCommand(AbstractDeclarativeCommand):
- def __init__(self, options=None):
- options = options or []
- options.extend([
- 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)
+class AbstractParallelRebaselineCommand(AbstractRebaseliningCommand):
def _run_webkit_patch(self, args, verbose):
try:
@@ -334,6 +338,9 @@
name = "rebaseline-json"
help_text = "Rebaseline based off JSON passed to stdin. Intended to only be called from other scripts."
+ def __init__(self):
+ return super(RebaselineJson, self).__init__(options=[self.no_optimize_option])
+
def execute(self, options, args, tool):
self._rebaseline(options, json.loads(sys.stdin.read()))
@@ -342,6 +349,9 @@
name = "rebaseline-expectations"
help_text = "Rebaselines the tests indicated in TestExpectations."
+ def __init__(self):
+ return super(RebaselineExpectations, self).__init__(options=[self.no_optimize_option])
+
def _update_expectations_files(self, port_name):
port = self._tool.port_factory.get(port_name)
@@ -392,11 +402,12 @@
argument_names = "[TEST_NAMES]"
def __init__(self):
- options = [
+ super(Rebaseline, self).__init__(options=[
+ self.no_optimize_option,
+ # FIXME: should we support the platform options in addition to (or instead of) --builders?
+ self.suffixes_option,
optparse.make_option("--builders", default=None, action="" help="Comma-separated-list of builders to pull new baselines from (can also be provided multiple times)"),
- optparse.make_option("--suffixes", default=BASELINE_SUFFIX_LIST, action="" help="Comma-separated-list of file types to rebaseline (can also be provided multiple times)"),
- ]
- AbstractParallelRebaselineCommand.__init__(self, options=options)
+ ])
def _builders_to_pull_from(self):
chromium_buildbot_builder_names = []