Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(181)

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline.py

Issue 2153973002: Reland of In rebaseline, include build number information with "test_prefix_list" dicts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix spelling baseilnes -> baselines Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_from_try_jobs.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2010 Google Inc. All rights reserved. 1 # Copyright (c) 2010 Google Inc. All rights reserved.
2 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer 10 # copyright notice, this list of conditions and the following disclaimer
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 from webkitpy.common.system.executive import ScriptError 42 from webkitpy.common.system.executive import ScriptError
43 from webkitpy.layout_tests.controllers.test_result_writer import baseline_name 43 from webkitpy.layout_tests.controllers.test_result_writer import baseline_name
44 from webkitpy.layout_tests.models.test_expectations import TestExpectations, BAS ELINE_SUFFIX_LIST, SKIP 44 from webkitpy.layout_tests.models.test_expectations import TestExpectations, BAS ELINE_SUFFIX_LIST, SKIP
45 from webkitpy.layout_tests.port import factory 45 from webkitpy.layout_tests.port import factory
46 from webkitpy.tool.commands.command import Command 46 from webkitpy.tool.commands.command import Command
47 47
48 48
49 _log = logging.getLogger(__name__) 49 _log = logging.getLogger(__name__)
50 50
51 51
52 class Build(object):
53 """Represents a combination of builder and build number.
54
55 If build number is None, this represents the latest build
56 for a given builder.
57
58 TODO(qyearsley): Move this somewhere else; note it's very similar to TryJob,
59 and it seems like it might belong in the buildbot module.
60 TODO(qyearsley): Make this a subclass of namedtuple so that __hash__,
61 __eq__ and __cmp__ don't need to be explicitly added.
62 """
63 def __init__(self, builder_name, build_number=None):
64 self.builder_name = builder_name
65 self.build_number = build_number
66
67 # Having __hash__ and __eq__ allow instances of this class to be used
68 # as keys in dictionaries.
69 def __hash__(self):
70 return hash((self.builder_name, self.build_number))
71
72 def __eq__(self, other):
73 return (self.builder_name, self.build_number) == (other.builder_name, ot her.build_number)
74
75 def __cmp__(self, other):
76 return cmp((self.builder_name, self.build_number), (other.builder_name, other.build_number))
77
78
52 class AbstractRebaseliningCommand(Command): 79 class AbstractRebaseliningCommand(Command):
53 """Base class for rebaseline-related commands.""" 80 """Base class for rebaseline-related commands."""
54 # Not overriding execute() - pylint: disable=abstract-method 81 # Not overriding execute() - pylint: disable=abstract-method
55 82
56 no_optimize_option = optparse.make_option('--no-optimize', dest='optimize', action='store_false', default=True, 83 no_optimize_option = optparse.make_option('--no-optimize', dest='optimize', action='store_false', default=True,
57 help=('Do not optimize/de-dup the expectations after rebaselining (default is to de-dup automatically). ' 84 help=('Do not optimize/de-dup the expectations after rebaselining (default is to de-dup automatically). '
58 'You can use "webkit-patch o ptimize-baselines" to optimize separately.')) 85 'You can use "webkit-patch o ptimize-baselines" to optimize separately.'))
59 86
60 platform_options = factory.platform_options(use_globs=True) 87 platform_options = factory.platform_options(use_globs=True)
61 88
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 307
281 308
282 class AbstractParallelRebaselineCommand(AbstractRebaseliningCommand): 309 class AbstractParallelRebaselineCommand(AbstractRebaseliningCommand):
283 """Base class for rebaseline commands that do some tasks in parallel.""" 310 """Base class for rebaseline commands that do some tasks in parallel."""
284 # Not overriding execute() - pylint: disable=abstract-method 311 # Not overriding execute() - pylint: disable=abstract-method
285 312
286 def __init__(self, options=None): 313 def __init__(self, options=None):
287 super(AbstractParallelRebaselineCommand, self).__init__(options=options) 314 super(AbstractParallelRebaselineCommand, self).__init__(options=options)
288 315
289 @memoized 316 @memoized
290 def builder_data(self): 317 def build_data(self):
291 builder_to_results = {} 318 """Returns a map of Build objects to LayoutTestResult objects.
319
320 The Build objects are the latest builds for the release builders,
321 and LayoutTestResult objects for results fetched from archived layout
322 test results.
323 """
324 build_to_results = {}
292 for builder_name in self._release_builders(): 325 for builder_name in self._release_builders():
293 builder = self._tool.buildbot.builder_with_name(builder_name) 326 builder = self._tool.buildbot.builder_with_name(builder_name)
294 builder_results = builder.latest_layout_test_results() 327 builder_results = builder.latest_layout_test_results()
295 if builder_results: 328 if builder_results:
296 builder_to_results[builder_name] = builder_results 329 build_to_results[Build(builder_name)] = builder_results
297 else: 330 else:
298 raise Exception("No result for builder %s." % builder_name) 331 raise Exception("No result for builder %s." % builder_name)
299 return builder_to_results 332 return build_to_results
300 333
301 # The release builders cycle much faster than the debug ones and cover all t he platforms. 334 # The release builders cycle much faster than the debug ones and cover all t he platforms.
302 def _release_builders(self): 335 def _release_builders(self):
303 release_builders = [] 336 release_builders = []
304 for builder_name in self._tool.builders.all_continuous_builder_names(): 337 for builder_name in self._tool.builders.all_continuous_builder_names():
305 if 'ASAN' in builder_name: 338 if 'ASAN' in builder_name:
306 continue 339 continue
307 port = self._tool.port_factory.get_from_builder_name(builder_name) 340 port = self._tool.port_factory.get_from_builder_name(builder_name)
308 if port.test_configuration().build_type == 'release': 341 if port.test_configuration().build_type == 'release':
309 release_builders.append(builder_name) 342 release_builders.append(builder_name)
310 return release_builders 343 return release_builders
311 344
312 def _run_webkit_patch(self, args, verbose): 345 def _run_webkit_patch(self, args, verbose):
313 try: 346 try:
314 verbose_args = ['--verbose'] if verbose else [] 347 verbose_args = ['--verbose'] if verbose else []
315 stderr = self._tool.executive.run_command([self._tool.path()] + verb ose_args + 348 stderr = self._tool.executive.run_command([self._tool.path()] + verb ose_args +
316 args, cwd=self._tool.scm() .checkout_root, return_stderr=True) 349 args, cwd=self._tool.scm() .checkout_root, return_stderr=True)
317 for line in stderr.splitlines(): 350 for line in stderr.splitlines():
318 _log.warning(line) 351 _log.warning(line)
319 except ScriptError: 352 except ScriptError:
320 traceback.print_exc(file=sys.stderr) 353 traceback.print_exc(file=sys.stderr)
321 354
322 def _builders_to_fetch_from(self, builders_to_check): 355 def _builders_to_fetch_from(self, builders_to_check):
323 """Returns the subset of builders that will cover all of the baseline se arch paths 356 """Returns the subset of builders that will cover all of the baseline
324 used in the input list. 357 search paths used in the input list.
325 358
326 In particular, if the input list contains both Release and Debug 359 In particular, if the input list contains both Release and Debug
327 versions of a configuration, we *only* return the Release version 360 versions of a configuration, we *only* return the Release version
328 (since we don't save debug versions of baselines). 361 (since we don't save debug versions of baselines).
329 362
330 Args: 363 Args:
331 builders_to_check: List of builder names. 364 builders_to_check: List of builder names.
332 """ 365 """
333 release_builders = set() 366 release_builders = set()
334 debug_builders = set() 367 debug_builders = set()
335 builders_to_fallback_paths = {} 368 builders_to_fallback_paths = {}
336 for builder in builders_to_check: 369 for builder in builders_to_check:
337 port = self._tool.port_factory.get_from_builder_name(builder) 370 port = self._tool.port_factory.get_from_builder_name(builder)
338 if port.test_configuration().build_type == 'release': 371 if port.test_configuration().build_type == 'release':
339 release_builders.add(builder) 372 release_builders.add(builder)
340 else: 373 else:
341 debug_builders.add(builder) 374 debug_builders.add(builder)
342 for builder in list(release_builders) + list(debug_builders): 375 for builder in list(release_builders) + list(debug_builders):
343 port = self._tool.port_factory.get_from_builder_name(builder) 376 port = self._tool.port_factory.get_from_builder_name(builder)
344 fallback_path = port.baseline_search_path() 377 fallback_path = port.baseline_search_path()
345 if fallback_path not in builders_to_fallback_paths.values(): 378 if fallback_path not in builders_to_fallback_paths.values():
346 builders_to_fallback_paths[builder] = fallback_path 379 builders_to_fallback_paths[builder] = fallback_path
347 return builders_to_fallback_paths.keys() 380 return builders_to_fallback_paths.keys()
348 381
382 @staticmethod
383 def _builder_names(builds):
384 # TODO(qyearsley): If test_prefix_list dicts are converted to instances
385 # of some class, then this could be replaced with a method on that clas s.
386 return [b.builder_name for b in builds]
387
349 def _rebaseline_commands(self, test_prefix_list, options, skip_checking_actu al_results=False): 388 def _rebaseline_commands(self, test_prefix_list, options, skip_checking_actu al_results=False):
350 path_to_webkit_patch = self._tool.path() 389 path_to_webkit_patch = self._tool.path()
351 cwd = self._tool.scm().checkout_root 390 cwd = self._tool.scm().checkout_root
352 copy_baseline_commands = [] 391 copy_baseline_commands = []
353 rebaseline_commands = [] 392 rebaseline_commands = []
354 lines_to_remove = {} 393 lines_to_remove = {}
355 port = self._tool.port_factory.get() 394 port = self._tool.port_factory.get()
356 395
357 for test_prefix in test_prefix_list: 396 for test_prefix in test_prefix_list:
358 for test in port.tests([test_prefix]): 397 for test in port.tests([test_prefix]):
359 for builder in self._builders_to_fetch_from(test_prefix_list[tes t_prefix]): 398 builders_to_fetch_from = self._builders_to_fetch_from(self._buil der_names(test_prefix_list[test_prefix]))
399 for build in sorted(test_prefix_list[test_prefix]):
360 # TODO(qyearsley): Remove the parameter skip_checking_actual _results 400 # TODO(qyearsley): Remove the parameter skip_checking_actual _results
361 # and instead refactor the existing code so that this is not necessary. 401 # and instead refactor the existing code so that this is not necessary.
402 builder, build_number = build.builder_name, build.build_numb er
403
404 if builder not in builders_to_fetch_from:
405 break
362 if skip_checking_actual_results: 406 if skip_checking_actual_results:
363 actual_failures_suffixes = test_prefix_list[test_prefix] [builder] 407 actual_failures_suffixes = test_prefix_list[test_prefix] [build]
364 else: 408 else:
365 actual_failures_suffixes = self._suffixes_for_actual_fai lures( 409 actual_failures_suffixes = self._suffixes_for_actual_fai lures(
366 test, builder, test_prefix_list[test_prefix][builder ]) 410 test, build, test_prefix_list[test_prefix][build])
367 if not actual_failures_suffixes: 411 if not actual_failures_suffixes:
368 # If we're not going to rebaseline the test because it's passing on this 412 # If we're not going to rebaseline the test because it's passing on this
369 # builder, we still want to remove the line from TestExp ectations. 413 # builder, we still want to remove the line from TestExp ectations.
370 if test not in lines_to_remove: 414 if test not in lines_to_remove:
371 lines_to_remove[test] = [] 415 lines_to_remove[test] = []
372 lines_to_remove[test].append(builder) 416 lines_to_remove[test].append(builder)
373 continue 417 continue
374 418
375 suffixes = ','.join(actual_failures_suffixes) 419 suffixes = ','.join(actual_failures_suffixes)
376 cmd_line = ['--suffixes', suffixes, '--builder', builder, '- -test', test] 420 cmd_line = ['--suffixes', suffixes, '--builder', builder, '- -test', test]
421 if build_number:
422 cmd_line.extend(['--build-number', build_number])
377 if options.results_directory: 423 if options.results_directory:
378 cmd_line.extend(['--results-directory', options.results_ directory]) 424 cmd_line.extend(['--results-directory', options.results_ directory])
379 if options.verbose: 425 if options.verbose:
380 cmd_line.append('--verbose') 426 cmd_line.append('--verbose')
381 copy_baseline_commands.append( 427 copy_baseline_commands.append(
382 tuple([[self._tool.executable, path_to_webkit_patch, 'co py-existing-baselines-internal'] + cmd_line, cwd])) 428 tuple([[self._tool.executable, path_to_webkit_patch, 'co py-existing-baselines-internal'] + cmd_line, cwd]))
383 rebaseline_commands.append( 429 rebaseline_commands.append(
384 tuple([[self._tool.executable, path_to_webkit_patch, 're baseline-test-internal'] + cmd_line, cwd])) 430 tuple([[self._tool.executable, path_to_webkit_patch, 're baseline-test-internal'] + cmd_line, cwd]))
385 return copy_baseline_commands, rebaseline_commands, lines_to_remove 431 return copy_baseline_commands, rebaseline_commands, lines_to_remove
386 432
(...skipping 24 matching lines...) Expand all
411 457
412 if not file_added: 458 if not file_added:
413 _log.debug('Could not add file based off output "%s"' % output) 459 _log.debug('Could not add file based off output "%s"' % output)
414 460
415 return list(files_to_add), list(files_to_delete), lines_to_remove 461 return list(files_to_add), list(files_to_delete), lines_to_remove
416 462
417 def _optimize_baselines(self, test_prefix_list, verbose=False): 463 def _optimize_baselines(self, test_prefix_list, verbose=False):
418 optimize_commands = [] 464 optimize_commands = []
419 for test in test_prefix_list: 465 for test in test_prefix_list:
420 all_suffixes = set() 466 all_suffixes = set()
421 for builder in self._builders_to_fetch_from(test_prefix_list[test]): 467 builders_to_fetch_from = self._builders_to_fetch_from(self._builder_ names(test_prefix_list[test]))
422 all_suffixes.update(self._suffixes_for_actual_failures(test, bui lder, test_prefix_list[test][builder])) 468 for build in sorted(test_prefix_list[test]):
469 if build.builder_name not in builders_to_fetch_from:
470 break
471 all_suffixes.update(self._suffixes_for_actual_failures(test, bui ld, test_prefix_list[test][build]))
423 472
424 # No need to optimize baselines for a test with no failures. 473 # No need to optimize baselines for a test with no failures.
425 if not all_suffixes: 474 if not all_suffixes:
426 continue 475 continue
427 476
428 # FIXME: We should propagate the platform options as well. 477 # FIXME: We should propagate the platform options as well.
429 cmd_line = ['--no-modify-scm', '--suffixes', ','.join(all_suffixes), test] 478 cmd_line = ['--no-modify-scm', '--suffixes', ','.join(all_suffixes), test]
430 if verbose: 479 if verbose:
431 cmd_line.append('--verbose') 480 cmd_line.append('--verbose')
432 481
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 if files_to_add: 544 if files_to_add:
496 self._tool.scm().add_list(files_to_add) 545 self._tool.scm().add_list(files_to_add)
497 return lines_to_remove 546 return lines_to_remove
498 547
499 def _rebaseline(self, options, test_prefix_list, skip_checking_actual_result s=False): 548 def _rebaseline(self, options, test_prefix_list, skip_checking_actual_result s=False):
500 """Downloads new baselines in parallel, then updates expectations files 549 """Downloads new baselines in parallel, then updates expectations files
501 and optimizes baselines. 550 and optimizes baselines.
502 551
503 Args: 552 Args:
504 options: An object with the options passed to the current command. 553 options: An object with the options passed to the current command.
505 test_prefix_list: A map of test names to builder names to baseline 554 test_prefix_list: A map of test names to Build objects to file suffi xes
506 suffixes to rebaseline. For example: 555 for new baselines. For example:
507 { 556 {
508 "some/test.html": {"builder-1": ["txt"], "builder-2": ["txt" ]}, 557 "some/test.html": {Build("builder-1", 412): ["txt"], Build(" builder-2", 100): ["txt"]},
509 "some/other.html": {"builder-1": ["txt"]} 558 "some/other.html": {Build("builder-1", 412): ["txt"]}
510 } 559 }
511 This would mean that new text baselines should be downloaded for 560 This would mean that new text baselines should be downloaded for
512 "some/test.html" on both builder-1 and builder-2, and new text 561 "some/test.html" on both builder-1 (build 412) and builder-2
513 baselines should be downloaded for "some/other.html" but only 562 (build 100), and new text baselines should be downloaded for
514 from builder-1. 563 "some/other.html" but only from builder-1.
564 TODO(qyearsley): Replace test_prefix_list everywhere with some
565 sort of class that contains the same data.
515 skip_checking_actual_results: If True, then the lists of suffixes 566 skip_checking_actual_results: If True, then the lists of suffixes
516 to rebaseline from |test_prefix_list| will be used directly; 567 to rebaseline from |test_prefix_list| will be used directly;
517 if False, then the list of suffixes will filtered to include 568 if False, then the list of suffixes will filtered to include
518 suffixes with mismatches in actual results. 569 suffixes with mismatches in actual results.
519 """ 570 """
520 for test, builders_to_check in sorted(test_prefix_list.items()): 571 for test, builds_to_check in sorted(test_prefix_list.items()):
521 _log.info("Rebaselining %s" % test) 572 _log.info("Rebaselining %s" % test)
522 for builder, suffixes in sorted(builders_to_check.items()): 573 for build, suffixes in sorted(builds_to_check.items()):
523 _log.debug(" %s: %s" % (builder, ",".join(suffixes))) 574 _log.debug(" %s: %s" % (build, ",".join(suffixes)))
524 575
525 copy_baseline_commands, rebaseline_commands, extra_lines_to_remove = sel f._rebaseline_commands( 576 copy_baseline_commands, rebaseline_commands, extra_lines_to_remove = sel f._rebaseline_commands(
526 test_prefix_list, options, skip_checking_actual_results) 577 test_prefix_list, options, skip_checking_actual_results)
527 lines_to_remove = {} 578 lines_to_remove = {}
528 579
529 self._run_in_parallel_and_update_scm(copy_baseline_commands) 580 self._run_in_parallel_and_update_scm(copy_baseline_commands)
530 lines_to_remove = self._run_in_parallel_and_update_scm(rebaseline_comman ds) 581 lines_to_remove = self._run_in_parallel_and_update_scm(rebaseline_comman ds)
531 582
532 for test in extra_lines_to_remove: 583 for test in extra_lines_to_remove:
533 if test in lines_to_remove: 584 if test in lines_to_remove:
534 lines_to_remove[test] = lines_to_remove[test] + extra_lines_to_r emove[test] 585 lines_to_remove[test] = lines_to_remove[test] + extra_lines_to_r emove[test]
535 else: 586 else:
536 lines_to_remove[test] = extra_lines_to_remove[test] 587 lines_to_remove[test] = extra_lines_to_remove[test]
537 588
538 if lines_to_remove: 589 if lines_to_remove:
539 self._update_expectations_files(lines_to_remove) 590 self._update_expectations_files(lines_to_remove)
540 591
541 if options.optimize: 592 if options.optimize:
542 # TODO(wkorman): Consider changing temporary branch to base off of H EAD rather than 593 # TODO(wkorman): Consider changing temporary branch to base off of H EAD rather than
543 # origin/master to ensure we run baseline optimization processes wit h the same code as 594 # origin/master to ensure we run baseline optimization processes wit h the same code as
544 # auto-rebaseline itself. 595 # auto-rebaseline itself.
545 self._run_in_parallel_and_update_scm(self._optimize_baselines(test_p refix_list, options.verbose)) 596 self._run_in_parallel_and_update_scm(self._optimize_baselines(test_p refix_list, options.verbose))
546 597
547 def _suffixes_for_actual_failures(self, test, builder_name, existing_suffixe s): 598 def _suffixes_for_actual_failures(self, test, build, existing_suffixes):
548 if builder_name not in self.builder_data(): 599 """Gets the baseline suffixes for actual mismatch failures in some resul ts.
600
601 Args:
602 test: A full test path string.
603 build: A Build object.
604 existing_suffixes: A collection of all suffixes to consider.
605
606 Returns:
607 A set of file suffix strings.
608 """
609 if build not in self.build_data():
549 return set() 610 return set()
550 test_result = self.builder_data()[builder_name].result_for_test(test) 611 test_result = self.build_data()[build].result_for_test(test)
551 if not test_result: 612 if not test_result:
552 return set() 613 return set()
553 return set(existing_suffixes) & TestExpectations.suffixes_for_test_resul t(test_result) 614 return set(existing_suffixes) & TestExpectations.suffixes_for_test_resul t(test_result)
554 615
555 616
556 class RebaselineJson(AbstractParallelRebaselineCommand): 617 class RebaselineJson(AbstractParallelRebaselineCommand):
557 name = "rebaseline-json" 618 name = "rebaseline-json"
558 help_text = "Rebaseline based off JSON passed to stdin. Intended to only be called from other scripts." 619 help_text = "Rebaseline based off JSON passed to stdin. Intended to only be called from other scripts."
559 620
560 def __init__(self,): 621 def __init__(self,):
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 return 654 return
594 tests = self._tests_to_rebaseline(self._tool.port_factory.get(port_name) ).items() 655 tests = self._tests_to_rebaseline(self._tool.port_factory.get(port_name) ).items()
595 656
596 if tests: 657 if tests:
597 _log.info("Retrieving results for %s from %s." % (port_name, builder _name)) 658 _log.info("Retrieving results for %s from %s." % (port_name, builder _name))
598 659
599 for test_name, suffixes in tests: 660 for test_name, suffixes in tests:
600 _log.info(" %s (%s)" % (test_name, ','.join(suffixes))) 661 _log.info(" %s (%s)" % (test_name, ','.join(suffixes)))
601 if test_name not in self._test_prefix_list: 662 if test_name not in self._test_prefix_list:
602 self._test_prefix_list[test_name] = {} 663 self._test_prefix_list[test_name] = {}
603 self._test_prefix_list[test_name][builder_name] = suffixes 664 self._test_prefix_list[test_name][Build(builder_name)] = suffixes
604 665
605 def execute(self, options, args, tool): 666 def execute(self, options, args, tool):
606 options.results_directory = None 667 options.results_directory = None
607 self._test_prefix_list = {} 668 self._test_prefix_list = {}
608 port_names = tool.port_factory.all_port_names(options.platform) 669 port_names = tool.port_factory.all_port_names(options.platform)
609 for port_name in port_names: 670 for port_name in port_names:
610 self._add_tests_to_rebaseline_for_port(port_name) 671 self._add_tests_to_rebaseline_for_port(port_name)
611 if not self._test_prefix_list: 672 if not self._test_prefix_list:
612 _log.warning("Did not find any tests marked Rebaseline.") 673 _log.warning("Did not find any tests marked Rebaseline.")
613 return 674 return
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 else: 712 else:
652 builders_to_check = self._builders_to_pull_from() 713 builders_to_check = self._builders_to_pull_from()
653 714
654 test_prefix_list = {} 715 test_prefix_list = {}
655 suffixes_to_update = options.suffixes.split(",") 716 suffixes_to_update = options.suffixes.split(",")
656 717
657 for builder in builders_to_check: 718 for builder in builders_to_check:
658 for test in args: 719 for test in args:
659 if test not in test_prefix_list: 720 if test not in test_prefix_list:
660 test_prefix_list[test] = {} 721 test_prefix_list[test] = {}
661 test_prefix_list[test][builder.name()] = suffixes_to_update 722 build = Build(builder.name())
723 test_prefix_list[test][build] = suffixes_to_update
662 724
663 if options.verbose: 725 if options.verbose:
664 _log.debug("rebaseline-json: " + str(test_prefix_list)) 726 _log.debug("rebaseline-json: " + str(test_prefix_list))
665 727
666 self._rebaseline(options, test_prefix_list) 728 self._rebaseline(options, test_prefix_list)
667 729
668 730
669 class AutoRebaseline(AbstractParallelRebaselineCommand): 731 class AutoRebaseline(AbstractParallelRebaselineCommand):
670 name = "auto-rebaseline" 732 name = "auto-rebaseline"
671 help_text = "Rebaselines any NeedsRebaseline lines in TestExpectations that have cycled through all the bots." 733 help_text = "Rebaselines any NeedsRebaseline lines in TestExpectations that have cycled through all the bots."
(...skipping 26 matching lines...) Expand all
698 @ 760 @
699 [^@>]+ # Domain terminated by @ or >, some lines have an ad ditional @ fragment after the email. 761 [^@>]+ # Domain terminated by @ or >, some lines have an ad ditional @ fragment after the email.
700 ) 762 )
701 .*?([^ ]*) # Test file name 763 .*?([^ ]*) # Test file name
702 \ \[ # Single space followed by opening [ for expectation specifier 764 \ \[ # Single space followed by opening [ for expectation specifier
703 [^[]*$ # Prevents matching previous [ for version specifier s instead of expectation specifiers 765 [^[]*$ # Prevents matching previous [ for version specifier s instead of expectation specifiers
704 """, re.VERBOSE) 766 """, re.VERBOSE)
705 767
706 def bot_revision_data(self, scm): 768 def bot_revision_data(self, scm):
707 revisions = [] 769 revisions = []
708 for result in self.builder_data().values(): 770 for result in self.build_data().values():
709 if result.run_was_interrupted(): 771 if result.run_was_interrupted():
710 _log.error("Can't rebaseline because the latest run on %s exited early." % result.builder_name()) 772 _log.error("Can't rebaseline because the latest run on %s exited early." % result.builder_name())
711 return [] 773 return []
712 revisions.append({ 774 revisions.append({
713 "builder": result.builder_name(), 775 "builder": result.builder_name(),
714 "revision": result.chromium_revision(scm), 776 "revision": result.chromium_revision(scm),
715 }) 777 })
716 return revisions 778 return revisions
717 779
718 def _strip_comments(self, line): 780 def _strip_comments(self, line):
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 port = self._tool.port_factory.get(port_name) 860 port = self._tool.port_factory.get(port_name)
799 expectations = TestExpectations(port, include_overrides=True) 861 expectations = TestExpectations(port, include_overrides=True)
800 for test in expectations.get_needs_rebaseline_failures(): 862 for test in expectations.get_needs_rebaseline_failures():
801 if test not in tests: 863 if test not in tests:
802 continue 864 continue
803 865
804 if test not in test_prefix_list: 866 if test not in test_prefix_list:
805 lines_to_remove[test] = [] 867 lines_to_remove[test] = []
806 test_prefix_list[test] = {} 868 test_prefix_list[test] = {}
807 lines_to_remove[test].append(builder_name) 869 lines_to_remove[test].append(builder_name)
808 test_prefix_list[test][builder_name] = BASELINE_SUFFIX_LIST 870 test_prefix_list[test][Build(builder_name)] = BASELINE_SUFFIX_LI ST
809 871
810 return test_prefix_list, lines_to_remove 872 return test_prefix_list, lines_to_remove
811 873
812 def _run_git_cl_command(self, options, command): 874 def _run_git_cl_command(self, options, command):
813 subprocess_command = ['git', 'cl'] + command 875 subprocess_command = ['git', 'cl'] + command
814 if options.verbose: 876 if options.verbose:
815 subprocess_command.append('--verbose') 877 subprocess_command.append('--verbose')
816 if options.auth_refresh_token_json: 878 if options.auth_refresh_token_json:
817 subprocess_command.append('--auth-refresh-token-json') 879 subprocess_command.append('--auth-refresh-token-json')
818 subprocess_command.append(options.auth_refresh_token_json) 880 subprocess_command.append(options.auth_refresh_token_json)
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
925 issue_already_closed = tool.executive.run_command( 987 issue_already_closed = tool.executive.run_command(
926 ['git', 'config', 'branch.%s.rietveldissue' % rebaseline _branch_name], 988 ['git', 'config', 'branch.%s.rietveldissue' % rebaseline _branch_name],
927 return_exit_code=True) 989 return_exit_code=True)
928 if not issue_already_closed: 990 if not issue_already_closed:
929 self._run_git_cl_command(options, ['set_close']) 991 self._run_git_cl_command(options, ['set_close'])
930 992
931 tool.scm().ensure_cleanly_tracking_remote_master() 993 tool.scm().ensure_cleanly_tracking_remote_master()
932 if old_branch_name_or_ref: 994 if old_branch_name_or_ref:
933 tool.scm().checkout_branch(old_branch_name_or_ref) 995 tool.scm().checkout_branch(old_branch_name_or_ref)
934 tool.scm().delete_branch(rebaseline_branch_name) 996 tool.scm().delete_branch(rebaseline_branch_name)
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_from_try_jobs.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698