Title: [92558] trunk/Tools
- Revision
- 92558
- Author
- [email protected]
- Date
- 2011-08-06 14:07:42 -0700 (Sat, 06 Aug 2011)
Log Message
Add a small command to optimize baselines in bulk.
* Scripts/webkitpy/tool/commands/rebaseline.py:
Modified Paths
Diff
Modified: trunk/Tools/ChangeLog (92557 => 92558)
--- trunk/Tools/ChangeLog 2011-08-06 20:48:19 UTC (rev 92557)
+++ trunk/Tools/ChangeLog 2011-08-06 21:07:42 UTC (rev 92558)
@@ -1,3 +1,9 @@
+2011-08-06 Adam Barth <[email protected]>
+
+ Add a small command to optimize baselines in bulk.
+
+ * Scripts/webkitpy/tool/commands/rebaseline.py:
+
2011-08-05 Dimitri Glazkov <[email protected]>
Fix unit test breakage by plumbing convert_404_to_None in MockWeb.
Modified: trunk/Tools/Scripts/webkitpy/tool/commands/rebaseline.py (92557 => 92558)
--- trunk/Tools/Scripts/webkitpy/tool/commands/rebaseline.py 2011-08-06 20:48:19 UTC (rev 92557)
+++ trunk/Tools/Scripts/webkitpy/tool/commands/rebaseline.py 2011-08-06 21:07:42 UTC (rev 92558)
@@ -30,6 +30,7 @@
import re
import shutil
import urllib
+import fileinput
import webkitpy.common.config.urls as config_urls
from webkitpy.common.checkout.baselineoptimizer import BaselineOptimizer
@@ -56,6 +57,11 @@
return port
+# 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 RebaseliningOptions(object):
DEBUG_CONFIGURATION_REGEX = r"[d|D](ebu|b)g"
@@ -115,23 +121,34 @@
class OptimizeBaselines(AbstractDeclarativeCommand):
name = "optimize-baselines"
- help_text = "Reshuffles the baselines for a the given test to use as litte space on disk as possible."
+ help_text = "Reshuffles the baselines for the given test to use as litte space on disk as possible."
argument_names = "TEST_NAME"
- # FIXME: Should TestResultWriter know how to compute this string?
- def _baseline_name(self, test_name, suffix):
- return self._tool.filesystem.splitext(test_name)[0] + TestResultWriter.FILENAME_SUFFIX_EXPECTED + "." + suffix
+ def _optimize_baseline(self, test_name):
+ for suffix in _baseline_suffix_list:
+ baseline_name = _baseline_name(self._tool.filesystem, test_name, suffix)
+ if not self._baseline_optimizer.optimize(baseline_name):
+ print "Hueristics failed to optimize %s" % baseline_name
def execute(self, options, args, tool):
- baseline_optimizer = BaselineOptimizer(tool.scm(), tool.filesystem)
+ self._baseline_optimizer = BaselineOptimizer(tool.scm(), tool.filesystem)
+ self._optimize_baseline(args[0])
- test_name = args[0]
- for suffix in _baseline_suffix_list:
- baseline_name = self._baseline_name(test_name, suffix)
- if not baseline_optimizer.optimize(baseline_name):
- print "Hueristics failed to optimize %s" % baseline_name
+class BulkOptimizeBaselines(OptimizeBaselines):
+ name = "bulk-optimize-baselines"
+ help_text = """Reshuffles the baselines for tests to use as litte space on disk as possible.
+Please provide the list of tests (separated by new lines) via stdin."""
+ argument_names = None
+ def execute(self, options, args, tool):
+ self._baseline_optimizer = BaselineOptimizer(tool.scm(), tool.filesystem)
+ for test_name in fileinput.input(['-']):
+ test_name = test_name.strip()
+ print "Optimizing %s." % test_name
+ self._optimize_baseline(test_name)
+
+
class RebaselineExpectations(AbstractDeclarativeCommand):
name = "rebaseline-expectations"
help_text = "Rebaselines the tests indicated in test_expectations.txt."
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes