Changeset 92153 in webkit
- Timestamp:
- Aug 1, 2011 5:07:14 PM (13 years ago)
- Location:
- trunk/Tools
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r92147 r92153 1 2011-08-01 Adam Barth <abarth@webkit.org> 2 3 webkit-patch needs to be able to "optimize" the storage of baselines on disk 4 https://bugs.webkit.org/show_bug.cgi?id=65418 5 6 Reviewed by Dimitri Glazkov. 7 8 If we're not careful when rebaselining tests, we can end up with lots 9 of duplicate expected results files in the tree. This patch adds a 10 webkit-patch command that optimizes the storage of expected results on 11 disk. 12 13 This command is similar to deduplicate-tests, except that it can move 14 test results around rather than just remove duplicate results. 15 16 Unfortunately, this problem is very tricky because the baseline search 17 structure is a hypergraph. This patch include a huerstic optimizer 18 that appears to work on a bunch of examples I've tried. We'll likely 19 need to refine it as gain experience. 20 21 * Scripts/webkitpy/common/system/filesystem.py: 22 * Scripts/webkitpy/tool/commands/rebaseline.py: 23 1 24 2011-08-01 Dimitri Glazkov <dglazkov@chromium.org> 2 25 -
trunk/Tools/Scripts/webkitpy/common/system/filesystem.py
r90702 r92153 35 35 import exceptions 36 36 import glob 37 import hashlib 37 38 import os 38 39 import shutil … … 223 224 with codecs.open(path, 'w', 'utf8') as f: 224 225 f.write(contents) 226 227 def sha1(self, path): 228 contents = self.read_binary_file(path) 229 return hashlib.sha1(contents).hexdigest() 225 230 226 231 def relpath(self, path, start='.'): -
trunk/Tools/Scripts/webkitpy/common/system/filesystem_mock.py
r91210 r92153 28 28 29 29 import errno 30 import hashlib 30 31 import os 31 32 import re … … 285 286 return self.write_binary_file(path, contents.encode('utf-8')) 286 287 288 def sha1(self, path): 289 contents = self.read_binary_file(path) 290 return hashlib.sha1(contents).hexdigest() 291 287 292 def relpath(self, path, start='.'): 288 293 return ospath.relpath(path, start, self.abspath, self.sep) -
trunk/Tools/Scripts/webkitpy/layout_tests/port/base.py
r91877 r92153 542 542 return self.path_from_webkit_base('LayoutTests') 543 543 544 def webkit_base(self): 545 return self._filesystem.abspath(self.path_from_webkit_base('.')) 546 544 547 def skipped_layout_tests(self): 545 548 return [] -
trunk/Tools/Scripts/webkitpy/tool/commands/rebaseline.py
r92061 r92153 33 33 34 34 import webkitpy.common.config.urls as config_urls 35 from webkitpy.common.checkout.baselineoptimizer import BaselineOptimizer 35 36 from webkitpy.common.net.buildbot import BuildBot 36 37 from webkitpy.common.net.layouttestresults import LayoutTestResults 37 38 from webkitpy.common.system.user import User 39 from webkitpy.layout_tests.layout_package.test_result_writer import TestResultWriter 38 40 from webkitpy.layout_tests.models import test_failures 39 41 from webkitpy.layout_tests.port import factory … … 129 131 130 132 133 class OptimizeBaselines(AbstractDeclarativeCommand): 134 name = "optimize-baselines" 135 help_text = "Reshuffles the baselines for a the given test to use as litte space on disk as possible." 136 argument_names = "TEST_NAME" 137 138 # FIXME: Should TestResultWriter know how to compute this string? 139 def _baseline_name(self, test_name, suffix): 140 return self._tool.filesystem.splitext(test_name)[0] + TestResultWriter.FILENAME_SUFFIX_EXPECTED + suffix 141 142 def execute(self, options, args, tool): 143 baseline_optimizer = BaselineOptimizer(tool.scm(), tool.filesystem) 144 145 test_name = args[0] 146 for suffix in ['.png', '.txt']: 147 baseline_name = self._baseline_name(test_name, suffix) 148 if not baseline_optimizer.optimize(baseline_name): 149 print "Hueristics failed to optimize %s" % baseline_name 150 151 131 152 class Rebaseline(AbstractDeclarativeCommand): 132 153 name = "rebaseline"
Note: See TracChangeset
for help on using the changeset viewer.