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