Changeset 91072 in webkit
- Timestamp:
- Jul 15, 2011 8:55:26 AM (13 years ago)
- Location:
- trunk/Tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r91071 r91072 1 2011-07-15 Dimitri Glazkov <dglazkov@chromium.org> 2 3 Plumb the use of TestExpectationLine deeper, clean up. 4 https://bugs.webkit.org/show_bug.cgi?id=64559 5 6 Instead of carrying various bits of TestExpectationLine, plumb it down to its consumers, 7 also cleaning up names and remove an unused TestExpectations._get_options_list member. 8 9 Reviewed by Adam Barth. 10 11 * Scripts/webkitpy/layout_tests/models/test_expectations.py: 12 1 13 2011-07-15 Dimitri Glazkov <dglazkov@chromium.org> 2 14 -
trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py
r91071 r91072 310 310 return self._test_to_expectations[test] 311 311 312 def add_tests(self, tests, expectations, test_list_path, lineno, 313 modifiers, num_matches, options, overrides_allowed): 312 def add_tests(self, lineno, expectation, tests, parsed_expectations, parsed_modifiers, num_matches, overrides_allowed): 314 313 """Returns a list of errors, encountered while matching modifiers.""" 315 314 # FIXME: Shouldn't return anything, this is a temporary layering volation. 316 315 errors = [] 317 316 for test in tests: 318 if self._already_seen_better_match(test, test_list_path, num_matches, lineno, overrides_allowed, errors):317 if self._already_seen_better_match(test, expectation.name, num_matches, lineno, overrides_allowed, errors): 319 318 continue 320 319 321 self._clear_expectations_for_test(test, test_list_path)322 self._test_list_paths[test] = (self._port.normalize_test_name( test_list_path), num_matches, lineno)323 self.add_test(test, modifiers, expectations, options, overrides_allowed)320 self._clear_expectations_for_test(test, expectation.name) 321 self._test_list_paths[test] = (self._port.normalize_test_name(expectation.name), num_matches, lineno) 322 self.add_test(test, parsed_modifiers, parsed_expectations, expectation.modifiers, overrides_allowed) 324 323 325 324 return errors … … 691 690 for expectation in expectation_list: 692 691 lineno += 1 693 test_list_path = expectation.name694 options = expectation.modifiers695 692 expectations = expectation.expectations 696 693 … … 698 695 self._add_error(lineno, error, expectation.comment) 699 696 700 if not expectation s:697 if not expectation.expectations: 701 698 continue 702 699 703 self._add_to_all_expectations(test_list_path, 704 " ".join(options).upper(), 705 " ".join(expectations).upper()) 706 707 num_matches = self._check_options(matcher, options, lineno, 708 test_list_path) 700 self._add_to_all_expectations(expectation.name, 701 " ".join(expectation.modifiers).upper(), 702 " ".join(expectation.expectations).upper()) 703 704 num_matches = self._check_options(matcher, lineno, expectation) 709 705 if num_matches == ModifierMatcher.NO_MATCH: 710 706 continue 711 707 712 expectations = self._parse_expectations(expectations, lineno, 713 test_list_path) 714 715 self._check_options_against_expectations(options, expectations, 716 lineno, test_list_path) 717 718 if self._check_path_does_not_exist(lineno, test_list_path): 708 self._check_options_against_expectations(lineno, expectation) 709 710 if self._check_path_does_not_exist(lineno, expectation): 719 711 continue 720 712 721 713 if not self._full_test_list: 722 tests = [ test_list_path]714 tests = [expectation.name] 723 715 else: 724 tests = self._expand_tests(test_list_path) 725 726 modifiers = [o for o in options if o in self.MODIFIERS] 716 tests = self._expand_tests(expectation.name) 717 718 parsed_modifiers = [modifier for modifier in expectation.modifiers if modifier in self.MODIFIERS] 719 parsed_expectations = self._parse_expectations(lineno, expectation) 720 727 721 # FIXME: Eliminate this awful error plumbing 728 modifier_errors = self._model.add_tests( tests, expectations, test_list_path, lineno, modifiers, num_matches, options, overrides_allowed)722 modifier_errors = self._model.add_tests(lineno, expectation, tests, parsed_expectations, parsed_modifiers, num_matches, overrides_allowed) 729 723 for (message, source) in modifier_errors: 730 724 self._add_error(lineno, message, source) 731 725 732 733 # FIXME: Remove, no longer used anywhere? 734 def _get_options_list(self, listString): 735 return [part.strip().lower() for part in listString.strip().split(' ')] 736 737 def _parse_expectations(self, expectations, lineno, test_list_path): 726 def _parse_expectations(self, lineno, expectation_line): 738 727 result = set() 739 for part in expectation s:728 for part in expectation_line.expectations: 740 729 expectation = TestExpectations.expectation_from_string(part) 741 730 if expectation is None: # Careful, PASS is currently 0. 742 self._add_error(lineno, 'Unsupported expectation: %s' % part, test_list_path)731 self._add_error(lineno, 'Unsupported expectation: %s' % part, expectation_line.name) 743 732 continue 744 733 result.add(expectation) 745 734 return result 746 735 747 def _check_options(self, matcher, options, lineno, test_list_path): 748 match_result = self._check_syntax(matcher, options, lineno, 749 test_list_path) 750 self._check_semantics(options, lineno, test_list_path) 736 def _check_options(self, matcher, lineno, expectation): 737 match_result = self._check_syntax(matcher, lineno, expectation) 738 self._check_semantics(lineno, expectation) 751 739 return match_result.num_matches 752 740 753 def _check_syntax(self, matcher, options, lineno, test_list_path):754 match_result = matcher.match( options)741 def _check_syntax(self, matcher, lineno, expectation): 742 match_result = matcher.match(expectation.modifiers) 755 743 for error in match_result.errors: 756 self._add_error(lineno, error, test_list_path)744 self._add_error(lineno, error, expectation.name) 757 745 for warning in match_result.warnings: 758 self._log_non_fatal_error(lineno, warning, test_list_path)746 self._log_non_fatal_error(lineno, warning, expectation.name) 759 747 return match_result 760 748 761 def _check_semantics(self, options, lineno, test_list_path):762 has_wontfix = 'wontfix' in options749 def _check_semantics(self, lineno, expectation): 750 has_wontfix = 'wontfix' in expectation.modifiers 763 751 has_bug = False 764 for opt in options:752 for opt in expectation.modifiers: 765 753 if opt.startswith('bug'): 766 754 has_bug = True … … 769 757 'BUG\d+ is not allowed, must be one of ' 770 758 'BUGCR\d+, BUGWK\d+, BUGV8_\d+, ' 771 'or a non-numeric bug identifier.', test_list_path)759 'or a non-numeric bug identifier.', expectation.name) 772 760 773 761 if not has_bug and not has_wontfix: 774 self._log_non_fatal_error(lineno, 'Test lacks BUG modifier.', test_list_path)775 776 if self._is_lint_mode and 'rebaseline' in options:762 self._log_non_fatal_error(lineno, 'Test lacks BUG modifier.', expectation.name) 763 764 if self._is_lint_mode and 'rebaseline' in expectation.modifiers: 777 765 self._add_error(lineno, 778 766 'REBASELINE should only be used for running rebaseline.py. ' 779 'Cannot be checked in.', test_list_path)780 781 def _check_options_against_expectations(self, options, expectations, lineno, test_list_path):782 if 'slow' in options and TIMEOUT inexpectations:767 'Cannot be checked in.', expectation.name) 768 769 def _check_options_against_expectations(self, lineno, expectation): 770 if 'slow' in expectation.modifiers and 'timeout' in expectation.expectations: 783 771 self._add_error(lineno, 784 772 'A test can not be both SLOW and TIMEOUT. If it times out ' 785 'indefinitely, then it should be just TIMEOUT.', test_list_path)786 787 def _check_path_does_not_exist(self, lineno, test_list_path):773 'indefinitely, then it should be just TIMEOUT.', expectation.name) 774 775 def _check_path_does_not_exist(self, lineno, expectation): 788 776 # WebKit's way of skipping tests is to add a -disabled suffix. 789 777 # So we should consider the path existing if the path or the 790 778 # -disabled version exists. 791 if (not self._port.test_exists( test_list_path)792 and not self._port.test_exists( test_list_path+ '-disabled')):779 if (not self._port.test_exists(expectation.name) 780 and not self._port.test_exists(expectation.name + '-disabled')): 793 781 # Log a non fatal error here since you hit this case any 794 782 # time you update test_expectations.txt without syncing 795 783 # the LayoutTests directory 796 self._log_non_fatal_error(lineno, 'Path does not exist.', test_list_path)784 self._log_non_fatal_error(lineno, 'Path does not exist.', expectation.name) 797 785 return True 798 786 return False
Note: See TracChangeset
for help on using the changeset viewer.