Changeset 159595 in webkit
- Timestamp:
- Nov 20, 2013 4:54:05 PM (10 years ago)
- Location:
- trunk/Tools
- Files:
-
- 2 deleted
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r159586 r159595 1 2013-11-20 Jozsef Berta <jberta@inf.u-szeged.hu> 2 3 Delete baseline optimizer 4 https://bugs.webkit.org/show_bug.cgi?id=122333 5 6 Reviewed by Ryosuke Niwa. 7 8 * Scripts/webkitpy/common/checkout/baselineoptimizer.py: Removed. 9 * Scripts/webkitpy/common/checkout/baselineoptimizer_unittest.py: Removed. 10 * Scripts/webkitpy/tool/commands/rebaseline.py: 11 (RebaselineTest.execute): 12 (AbstractParallelRebaselineCommand._files_to_add): 13 (AbstractParallelRebaselineCommand._rebaseline): 14 * Scripts/webkitpy/tool/commands/rebaseline_unittest.py: 15 (TestRebaselineJson.test_rebaseline_all): 16 (TestRebaselineJson.test_rebaseline_debug): 17 (TestRebaselineExpectations.disabled_test_overrides_are_included_correctly): 18 1 19 2013-11-20 Anders Carlsson <andersca@apple.com> 2 20 -
trunk/Tools/Scripts/webkitpy/tool/commands/rebaseline.py
r148502 r159595 32 32 import sys 33 33 34 from webkitpy.common.checkout.baselineoptimizer import BaselineOptimizer35 34 from webkitpy.common.system.executive import ScriptError 36 35 from webkitpy.layout_tests.controllers.test_result_writer import TestResultWriter … … 196 195 self._rebaseline_test_and_update_expectations(options) 197 196 print json.dumps(self._scm_changes) 198 199 200 class OptimizeBaselines(AbstractRebaseliningCommand):201 name = "optimize-baselines"202 help_text = "Reshuffles the baselines for the given tests to use as litte space on disk as possible."203 argument_names = "TEST_NAMES"204 205 def __init__(self):206 super(OptimizeBaselines, self).__init__(options=[self.suffixes_option] + self.platform_options)207 208 def _optimize_baseline(self, optimizer, test_name):209 for suffix in self._baseline_suffix_list:210 baseline_name = _baseline_name(self._tool.filesystem, test_name, suffix)211 if not optimizer.optimize(baseline_name):212 print "Heuristics failed to optimize %s" % baseline_name213 214 def execute(self, options, args, tool):215 self._baseline_suffix_list = options.suffixes.split(',')216 port_names = tool.port_factory.all_port_names(options.platform)217 if not port_names:218 print "No port names match '%s'" % options.platform219 return220 221 optimizer = BaselineOptimizer(tool, port_names)222 port = tool.port_factory.get(port_names[0])223 for test_name in port.tests(args):224 _log.info("Optimizing %s" % test_name)225 self._optimize_baseline(optimizer, test_name)226 227 228 class AnalyzeBaselines(AbstractRebaseliningCommand):229 name = "analyze-baselines"230 help_text = "Analyzes the baselines for the given tests and prints results that are identical."231 argument_names = "TEST_NAMES"232 233 def __init__(self):234 super(AnalyzeBaselines, self).__init__(options=[235 self.suffixes_option,236 optparse.make_option('--missing', action='store_true', default=False, help='show missing baselines as well'),237 ] + self.platform_options)238 self._optimizer_class = BaselineOptimizer # overridable for testing239 self._baseline_optimizer = None240 self._port = None241 242 def _write(self, msg):243 print msg244 245 def _analyze_baseline(self, options, test_name):246 for suffix in self._baseline_suffix_list:247 baseline_name = _baseline_name(self._tool.filesystem, test_name, suffix)248 results_by_directory = self._baseline_optimizer.read_results_by_directory(baseline_name)249 if results_by_directory:250 self._write("%s:" % baseline_name)251 self._baseline_optimizer.write_by_directory(results_by_directory, self._write, " ")252 elif options.missing:253 self._write("%s: (no baselines found)" % baseline_name)254 255 def execute(self, options, args, tool):256 self._baseline_suffix_list = options.suffixes.split(',')257 port_names = tool.port_factory.all_port_names(options.platform)258 if not port_names:259 print "No port names match '%s'" % options.platform260 return261 262 self._baseline_optimizer = self._optimizer_class(tool, port_names)263 self._port = tool.port_factory.get(port_names[0])264 for test_name in self._port.tests(args):265 self._analyze_baseline(options, test_name)266 197 267 198 … … 337 268 return list(files_to_add) 338 269 339 def _optimize_baselines(self, test_list, verbose=False):340 # We don't run this in parallel because modifying the SCM in parallel is unreliable.341 for test in test_list:342 all_suffixes = set()343 for builder in self._builders_to_fetch_from(test_list[test]):344 all_suffixes.update(test_list[test][builder])345 # FIXME: We should propagate the platform options as well.346 self._run_webkit_patch(['optimize-baselines', '--suffixes', ','.join(all_suffixes), test], verbose)347 348 270 def _rebaseline(self, options, test_list): 349 271 for test, builders_to_check in sorted(test_list.items()): … … 363 285 if files_to_add: 364 286 self._tool.scm().add_list(list(files_to_add)) 365 366 if options.optimize:367 self._optimize_baselines(test_list, options.verbose)368 287 369 288 -
trunk/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py
r159182 r159595 31 31 32 32 from webkitpy.common.system.outputcapture import OutputCapture 33 from webkitpy.common.checkout.baselineoptimizer import BaselineOptimizer34 33 from webkitpy.common.net.buildbot.buildbot_mock import MockBuilder 35 34 from webkitpy.common.system.executive_mock import MockExecutive2 … … 249 248 self.command._rebaseline(options, {"user-scripts/another-test.html": {"MOCK builder": ["txt", "png"]}}) 250 249 251 # Note that we have one run_in_parallel() call followed by a run_command()252 self.assertEqual(self.tool.executive.calls,253 [[['echo', 'rebaseline-test-internal', '--suffixes', 'txt,png', '--builder', 'MOCK builder', '--test', 'user-scripts/another-test.html', '--verbose']],254 ['echo', '--verbose', 'optimize-baselines', '--suffixes', 'txt,png', 'user-scripts/another-test.html']])255 256 250 def test_rebaseline_debug(self): 257 251 options = MockOptions(optimize=True, verbose=True, move_overwritten_baselines=False, results_directory=None) 258 252 self.command._rebaseline(options, {"user-scripts/another-test.html": {"MOCK builder (Debug)": ["txt", "png"]}}) 259 260 # Note that we have one run_in_parallel() call followed by a run_command()261 self.assertEqual(self.tool.executive.calls,262 [[['echo', 'rebaseline-test-internal', '--suffixes', 'txt,png', '--builder', 'MOCK builder (Debug)', '--test', 'user-scripts/another-test.html', '--verbose']],263 ['echo', '--verbose', 'optimize-baselines', '--suffixes', 'txt,png', 'user-scripts/another-test.html']])264 265 def test_move_overwritten(self):266 options = MockOptions(optimize=True, verbose=True, move_overwritten_baselines=True, results_directory=None)267 self.command._rebaseline(options, {"user-scripts/another-test.html": {"MOCK builder": ["txt", "png"]}})268 269 # Note that we have one run_in_parallel() call followed by a run_command()270 self.assertEqual(self.tool.executive.calls,271 [[['echo', 'rebaseline-test-internal', '--suffixes', 'txt,png', '--builder', 'MOCK builder', '--test', 'user-scripts/another-test.html', '--move-overwritten-baselines-to', 'test-mac-leopard', '--verbose']],272 ['echo', '--verbose', 'optimize-baselines', '--suffixes', 'txt,png', 'user-scripts/another-test.html']])273 253 274 254 def test_no_optimize(self): … … 368 348 self.assertDictEqual(self.command._tests_to_rebaseline(self.lion_port), {'userscripts/another-test.html': set(['png', 'txt', 'wav'])}) 369 349 self.assertEqual(self._read(self.lion_expectations_path), '') 370 371 372 class _FakeOptimizer(BaselineOptimizer):373 def read_results_by_directory(self, baseline_name):374 if baseline_name.endswith('txt'):375 return {'LayoutTests/passes/text.html': '123456',376 'LayoutTests/platform/test-mac-leopard/passes/text.html': 'abcdef'}377 return {}378 379 380 class TestAnalyzeBaselines(_BaseTestCase):381 command_constructor = AnalyzeBaselines382 383 def setUp(self):384 super(TestAnalyzeBaselines, self).setUp()385 self.port = self.tool.port_factory.get('test')386 self.tool.port_factory.get = (lambda port_name=None, options=None: self.port)387 self.lines = []388 self.command._optimizer_class = _FakeOptimizer389 self.command._write = (lambda msg: self.lines.append(msg)) # pylint bug warning about unnecessary lambda? pylint: disable=W0108390 391 def test_default(self):392 self.command.execute(MockOptions(suffixes='txt', missing=False, platform=None), ['passes/text.html'], self.tool)393 self.assertEqual(self.lines,394 ['passes/text-expected.txt:',395 ' (generic): 123456',396 ' test-mac-leopard: abcdef'])397 398 def test_missing_baselines(self):399 self.command.execute(MockOptions(suffixes='png,txt', missing=True, platform=None), ['passes/text.html'], self.tool)400 self.assertEqual(self.lines,401 ['passes/text-expected.png: (no baselines found)',402 'passes/text-expected.txt:',403 ' (generic): 123456',404 ' test-mac-leopard: abcdef'])
Note: See TracChangeset
for help on using the changeset viewer.