Changeset 91072 in webkit


Ignore:
Timestamp:
Jul 15, 2011 8:55:26 AM (13 years ago)
Author:
Dimitri Glazkov
Message:

Plumb the use of TestExpectationLine deeper, clean up.
https://bugs.webkit.org/show_bug.cgi?id=64559

Instead of carrying various bits of TestExpectationLine, plumb it down to its consumers,
also cleaning up names and remove an unused TestExpectations._get_options_list member.

Reviewed by Adam Barth.

  • Scripts/webkitpy/layout_tests/models/test_expectations.py:
Location:
trunk/Tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r91071 r91072  
     12011-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
    1132011-07-15  Dimitri Glazkov  <dglazkov@chromium.org>
    214
  • trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py

    r91071 r91072  
    310310        return self._test_to_expectations[test]
    311311
    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):
    314313        """Returns a list of errors, encountered while matching modifiers."""
    315314        # FIXME: Shouldn't return anything, this is a temporary layering volation.
    316315        errors = []
    317316        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):
    319318                continue
    320319
    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)
    324323
    325324        return errors
     
    691690        for expectation in expectation_list:
    692691            lineno += 1
    693             test_list_path = expectation.name
    694             options = expectation.modifiers
    695692            expectations = expectation.expectations
    696693
     
    698695                self._add_error(lineno, error, expectation.comment)
    699696
    700             if not expectations:
     697            if not expectation.expectations:
    701698                continue
    702699
    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)
    709705            if num_matches == ModifierMatcher.NO_MATCH:
    710706                continue
    711707
    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):
    719711                continue
    720712
    721713            if not self._full_test_list:
    722                 tests = [test_list_path]
     714                tests = [expectation.name]
    723715            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
    727721            # 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)
    729723            for (message, source) in modifier_errors:
    730724                self._add_error(lineno, message, source)
    731725
    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):
    738727        result = set()
    739         for part in expectations:
     728        for part in expectation_line.expectations:
    740729            expectation = TestExpectations.expectation_from_string(part)
    741730            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)
    743732                continue
    744733            result.add(expectation)
    745734        return result
    746735
    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)
    751739        return match_result.num_matches
    752740
    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)
    755743        for error in match_result.errors:
    756             self._add_error(lineno, error, test_list_path)
     744            self._add_error(lineno, error, expectation.name)
    757745        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)
    759747        return match_result
    760748
    761     def _check_semantics(self, options, lineno, test_list_path):
    762         has_wontfix = 'wontfix' in options
     749    def _check_semantics(self, lineno, expectation):
     750        has_wontfix = 'wontfix' in expectation.modifiers
    763751        has_bug = False
    764         for opt in options:
     752        for opt in expectation.modifiers:
    765753            if opt.startswith('bug'):
    766754                has_bug = True
     
    769757                        'BUG\d+ is not allowed, must be one of '
    770758                        '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)
    772760
    773761        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:
    777765            self._add_error(lineno,
    778766                '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 in expectations:
     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:
    783771            self._add_error(lineno,
    784772                '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):
    788776        # WebKit's way of skipping tests is to add a -disabled suffix.
    789777        # So we should consider the path existing if the path or the
    790778        # -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')):
    793781            # Log a non fatal error here since you hit this case any
    794782            # time you update test_expectations.txt without syncing
    795783            # 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)
    797785            return True
    798786        return False
Note: See TracChangeset for help on using the changeset viewer.