Changeset 106591 in webkit


Ignore:
Timestamp:
Feb 2, 2012 1:55:08 PM (12 years ago)
Author:
dpranke@chromium.org
Message:

nrwt shouldn't blow up when there are errors in test_expectations.txt
https://bugs.webkit.org/show_bug.cgi?id=73603

Reviewed by Ojan Vafai.

This change removes the distinction between 'errors' and 'warnings'
in the test expectations parser. Now, any problem is a
'warning', and if we are linting the file, warnings become fatal (errors).

This will allow a normal run-webkit-tests run to proceed even if
there are bad lines.

  • Scripts/webkitpy/layout_tests/models/test_expectations.py:

(ParseError.init):
(ParseError.str):
(ParseError.repr):
(TestExpectationSerializer.to_string):
(TestExpectationParser._parse_modifiers):
(TestExpectationParser._parse_expectations):
(TestExpectationParser._check_modifiers_against_expectations):
(TestExpectationParser._tokenize):
(TestExpectationLine.init):
(TestExpectationLine.is_invalid):
(TestExpectationsModel.add_expectation_line):
(TestExpectationsModel._already_seen_better_match):
(TestExpectations.init):
(TestExpectations._report_warnings):
(TestExpectations.remove_rebaselined_tests.without_rebaseline_modifier):

  • Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py:

(assert_bad_expectations):
(test_parse_warning):
(test_overridesduplicate):
(ExpectationSyntaxTests.test_missing_expectation):
(ExpectationSyntaxTests.test_missing_colon):
(ExpectationSyntaxTests.test_too_many_colons):
(ExpectationSyntaxTests.test_too_many_equals_signs):
(ExpectationSyntaxTests.test_unrecognized_expectation):
(SemanticTests.test_bug_format):
(SemanticTests.test_bad_bugid):
(SemanticTests.test_slow_and_timeout):
(test_ambiguous):
(test_more_modifiers):
(test_order_in_file):
(test_macro_overrides):
(RebaseliningTest.assertRemove):
(TestExpectationParserTests.test_tokenize_blank):
(TestExpectationParserTests.test_tokenize_missing_colon):
(TestExpectationParserTests.test_tokenize_extra_colon):
(TestExpectationParserTests.test_tokenize_empty_comment):
(TestExpectationParserTests.test_tokenize_comment):
(TestExpectationParserTests.test_tokenize_missing_equal):
(TestExpectationParserTests.test_tokenize_extra_equal):
(TestExpectationParserTests.test_tokenize_valid):
(TestExpectationParserTests.test_tokenize_valid_with_comment):
(TestExpectationParserTests.test_tokenize_valid_with_multiple_modifiers):
(TestExpectationSerializerTests.test_unparsed_to_string):

  • Scripts/webkitpy/layout_tests/run_webkit_tests.py:

(lint):

  • Scripts/webkitpy/style/checkers/test_expectations.py:

(TestExpectationsChecker.check_test_expectations):

Location:
trunk/Tools
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r106584 r106591  
     12012-02-02  Dirk Pranke  <dpranke@chromium.org>
     2
     3       nrwt shouldn't blow up when there are errors in test_expectations.txt
     4       https://bugs.webkit.org/show_bug.cgi?id=73603
     5
     6       Reviewed by Ojan Vafai.
     7
     8       This change removes the distinction between 'errors' and 'warnings'
     9       in the test expectations parser. Now, any problem is a
     10       'warning', and if we are linting the file, warnings become fatal (errors).
     11
     12        This will allow a normal run-webkit-tests run to proceed even if
     13        there are bad lines.
     14
     15        * Scripts/webkitpy/layout_tests/models/test_expectations.py:
     16        (ParseError.__init__):
     17        (ParseError.__str__):
     18        (ParseError.__repr__):
     19        (TestExpectationSerializer.to_string):
     20        (TestExpectationParser._parse_modifiers):
     21        (TestExpectationParser._parse_expectations):
     22        (TestExpectationParser._check_modifiers_against_expectations):
     23        (TestExpectationParser._tokenize):
     24        (TestExpectationLine.__init__):
     25        (TestExpectationLine.is_invalid):
     26        (TestExpectationsModel.add_expectation_line):
     27        (TestExpectationsModel._already_seen_better_match):
     28        (TestExpectations.__init__):
     29        (TestExpectations._report_warnings):
     30        (TestExpectations.remove_rebaselined_tests.without_rebaseline_modifier):
     31        * Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py:
     32        (assert_bad_expectations):
     33        (test_parse_warning):
     34        (test_overrides__duplicate):
     35        (ExpectationSyntaxTests.test_missing_expectation):
     36        (ExpectationSyntaxTests.test_missing_colon):
     37        (ExpectationSyntaxTests.test_too_many_colons):
     38        (ExpectationSyntaxTests.test_too_many_equals_signs):
     39        (ExpectationSyntaxTests.test_unrecognized_expectation):
     40        (SemanticTests.test_bug_format):
     41        (SemanticTests.test_bad_bugid):
     42        (SemanticTests.test_slow_and_timeout):
     43        (test_ambiguous):
     44        (test_more_modifiers):
     45        (test_order_in_file):
     46        (test_macro_overrides):
     47        (RebaseliningTest.assertRemove):
     48        (TestExpectationParserTests.test_tokenize_blank):
     49        (TestExpectationParserTests.test_tokenize_missing_colon):
     50        (TestExpectationParserTests.test_tokenize_extra_colon):
     51        (TestExpectationParserTests.test_tokenize_empty_comment):
     52        (TestExpectationParserTests.test_tokenize_comment):
     53        (TestExpectationParserTests.test_tokenize_missing_equal):
     54        (TestExpectationParserTests.test_tokenize_extra_equal):
     55        (TestExpectationParserTests.test_tokenize_valid):
     56        (TestExpectationParserTests.test_tokenize_valid_with_comment):
     57        (TestExpectationParserTests.test_tokenize_valid_with_multiple_modifiers):
     58        (TestExpectationSerializerTests.test_unparsed_to_string):
     59        * Scripts/webkitpy/layout_tests/run_webkit_tests.py:
     60        (lint):
     61        * Scripts/webkitpy/style/checkers/test_expectations.py:
     62        (TestExpectationsChecker.check_test_expectations):
     63
    1642012-02-02  Sheriff Bot  <webkit.review.bot@gmail.com>
    265
  • trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py

    r106293 r106591  
    109109
    110110class ParseError(Exception):
    111     def __init__(self, fatal, errors):
    112         self.fatal = fatal
    113         self.errors = errors
     111    def __init__(self, warnings):
     112        self.warnings = warnings
    114113
    115114    def __str__(self):
    116         return '\n'.join(map(str, self.errors))
     115        return '\n'.join(map(str, self.warnings))
    117116
    118117    def __repr__(self):
    119         return 'ParseError(fatal=%s, errors=%s)' % (self.fatal, self.errors)
     118        return 'ParseError(warnings=%s)' % self.warnings
    120119
    121120
     
    127126
    128127    def to_string(self, expectation_line):
    129         if expectation_line.is_malformed():
     128        if expectation_line.is_invalid():
    130129            return expectation_line.original_string or ''
    131130
     
    249248                has_bugid = True
    250249                if re.match(self.BUG_MODIFIER_REGEX, modifier):
    251                     expectation_line.errors.append('BUG\d+ is not allowed, must be one of BUGCR\d+, BUGWK\d+, BUGV8_\d+, or a non-numeric bug identifier.')
     250                    expectation_line.warnings.append('BUG\d+ is not allowed, must be one of BUGCR\d+, BUGWK\d+, BUGV8_\d+, or a non-numeric bug identifier.')
    252251                else:
    253252                    expectation_line.parsed_bug_modifiers.append(modifier)
     
    259258
    260259        if self._allow_rebaseline_modifier and self.REBASELINE_MODIFIER in expectation_line.modifiers:
    261             expectation_line.errors.append('REBASELINE should only be used for running rebaseline.py. Cannot be checked in.')
    262 
    263         expectation_line.matching_configurations = self._test_configuration_converter.to_config_set(parsed_specifiers, expectation_line.errors)
     260            expectation_line.warnings.append('REBASELINE should only be used for running rebaseline.py. Cannot be checked in.')
     261
     262        expectation_line.matching_configurations = self._test_configuration_converter.to_config_set(parsed_specifiers, expectation_line.warnings)
    264263
    265264    def _parse_expectations(self, expectation_line):
     
    268267            expectation = TestExpectations.expectation_from_string(part)
    269268            if expectation is None:  # Careful, PASS is currently 0.
    270                 expectation_line.errors.append('Unsupported expectation: %s' % part)
     269                expectation_line.warnings.append('Unsupported expectation: %s' % part)
    271270                continue
    272271            result.add(expectation)
     
    275274    def _check_modifiers_against_expectations(self, expectation_line):
    276275        if self.SLOW_MODIFIER in expectation_line.modifiers and self.TIMEOUT_EXPECTATION in expectation_line.expectations:
    277             expectation_line.errors.append('A test can not be both SLOW and TIMEOUT. If it times out indefinitely, then it should be just TIMEOUT.')
     276            expectation_line.warnings.append('A test can not be both SLOW and TIMEOUT. If it times out indefinitely, then it should be just TIMEOUT.')
    278277
    279278    def _check_path_does_not_exist(self, expectation_line):
     
    339338        parts = remaining_string.split(':')
    340339        if len(parts) != 2:
    341             expectation_line.errors.append("Missing a ':'" if len(parts) < 2 else "Extraneous ':'")
     340            expectation_line.warnings.append("Missing a ':'" if len(parts) < 2 else "Extraneous ':'")
    342341        else:
    343342            test_and_expectation = parts[1].split('=')
    344343            if len(test_and_expectation) != 2:
    345                 expectation_line.errors.append("Missing expectations" if len(test_and_expectation) < 2 else "Extraneous '='")
    346 
    347         if not expectation_line.is_malformed():
     344                expectation_line.warnings.append("Missing expectations" if len(test_and_expectation) < 2 else "Extraneous '='")
     345
     346        if not expectation_line.is_invalid():
    348347            expectation_line.modifiers = cls._split_space_separated(parts[0])
    349348            expectation_line.name = test_and_expectation[0].strip()
     
    386385        self.comment = None
    387386        self.matching_tests = []
    388         self.errors = []
    389387        self.warnings = []
    390388
    391     def is_malformed(self):
    392         return len(self.errors) > 0
    393 
    394389    def is_invalid(self):
    395         return self.is_malformed() or len(self.warnings) > 0
     390        return len(self.warnings) > 0
    396391
    397392    def is_flaky(self):
     
    477472
    478473    def add_expectation_line(self, expectation_line, overrides_allowed):
    479         """Returns a list of errors, encountered while matching modifiers."""
     474        """Returns a list of warnings encountered while matching modifiers."""
    480475
    481476        if expectation_line.is_invalid():
     
    593588
    594589        if prev_expectation_line.matching_configurations == expectation_line.matching_configurations:
    595             expectation_line.errors.append('Duplicate or ambiguous %s.' % expectation_source)
     590            expectation_line.warnings.append('Duplicate or ambiguous %s.' % expectation_source)
    596591            return True
    597592
    598593        if prev_expectation_line.matching_configurations >= expectation_line.matching_configurations:
    599             expectation_line.errors.append('More specific entry on line %d overrides line %d' % (expectation_line.line_number, prev_expectation_line.line_number))
     594            expectation_line.warnings.append('More specific entry on line %d overrides line %d' % (expectation_line.line_number, prev_expectation_line.line_number))
    600595            # FIXME: return False if we want more specific to win.
    601596            return True
    602597
    603598        if prev_expectation_line.matching_configurations <= expectation_line.matching_configurations:
    604             expectation_line.errors.append('More specific entry on line %d overrides line %d' % (prev_expectation_line.line_number, expectation_line.line_number))
     599            expectation_line.warnings.append('More specific entry on line %d overrides line %d' % (prev_expectation_line.line_number, expectation_line.line_number))
    605600            return True
    606601
    607602        if prev_expectation_line.matching_configurations & expectation_line.matching_configurations:
    608             expectation_line.errors.append('Entries on line %d and line %d match overlapping sets of configurations' % (prev_expectation_line.line_number, expectation_line.line_number))
     603            expectation_line.warnings.append('Entries on line %d and line %d match overlapping sets of configurations' % (prev_expectation_line.line_number, expectation_line.line_number))
    609604            return True
    610605
     
    707702                parsing the file (usually port.test_config(),
    708703                but may be different when linting or doing other things).
    709             is_lint_mode: If True, just parse the expectations string
    710                 looking for errors.
     704            is_lint_mode: If True, parse the expectations string and raise
     705                an exception if warnings are encountered.
    711706            overrides: test expectations that are allowed to override any
    712707                entries in |expectations|. This is used by callers
     
    732727
    733728        self._has_warnings = False
    734         self._report_errors()
     729        self._report_warnings()
    735730        self._process_tests_without_expectations()
    736731
     
    799794        return self._model.has_modifier(test, REBASELINE)
    800795
    801     def _report_errors(self):
    802         errors = []
     796    def _report_warnings(self):
    803797        warnings = []
    804798        test_expectation_path = self._port.path_to_test_expectations_file()
     
    806800            test_expectation_path = self._port.host.filesystem.relpath(test_expectation_path, self._port.path_from_webkit_base())
    807801        for expectation in self._expectations:
    808             for error in expectation.errors:
    809                 errors.append('%s:%d %s %s' % (test_expectation_path, expectation.line_number, error, expectation.name if expectation.expectations else expectation.original_string))
    810802            for warning in expectation.warnings:
    811803                warnings.append('%s:%d %s %s' % (test_expectation_path, expectation.line_number, warning, expectation.name if expectation.expectations else expectation.original_string))
     
    814806            warnings.append('%s%s' % (test_expectation_path, warning))
    815807
    816         if errors or warnings:
    817             if errors:
    818                 raise ParseError(fatal=True, errors=sorted(errors + warnings))
    819             if warnings:
    820                 self._has_warnings = True
    821                 if self._is_lint_mode:
    822                     raise ParseError(fatal=False, errors=warnings)
     808        if warnings:
     809            self._has_warnings = True
     810            if self._is_lint_mode:
     811                raise ParseError(warnings)
    823812
    824813    def _process_tests_without_expectations(self):
     
    834823        """Returns a copy of the expectations with the tests removed."""
    835824        def without_rebaseline_modifier(expectation):
    836             return not (not expectation.is_malformed() and expectation.name in except_these_tests and "rebaseline" in expectation.modifiers)
     825            return not (not expectation.is_invalid() and expectation.name in except_these_tests and "rebaseline" in expectation.modifiers)
    837826
    838827        return TestExpectationSerializer.list_to_string(filter(without_rebaseline_modifier, self._expectations))
  • trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py

    r106293 r106591  
    132132                          set([result]))
    133133
     134    def assert_bad_expectations(self, expectations, overrides=None):
     135        self.assertRaises(ParseError, self.parse_exp, expectations, is_lint_mode=True, overrides=overrides)
     136
    134137
    135138class BasicTests(Base):
     
    193196        self.assertEqual(s, set([]))
    194197
    195     def test_parse_error_fatal(self):
     198    def test_parse_warning(self):
    196199        try:
    197200            self.parse_exp("""FOO : failures/expected/text.html = TEXT
    198 SKIP : failures/expected/image.html""")
     201SKIP : failures/expected/image.html""", is_lint_mode=True)
    199202            self.assertFalse(True, "ParseError wasn't raised")
    200203        except ParseError, e:
    201             self.assertTrue(e.fatal)
    202             exp_errors = [u":1 Test lacks BUG modifier. failures/expected/text.html",
    203                           u":1 Unrecognized modifier 'foo' failures/expected/text.html",
    204                           u":2 Missing expectations SKIP : failures/expected/image.html"]
    205             self.assertEqual(str(e), '\n'.join(self._port.path_to_test_expectations_file() + str(error) for error in exp_errors))
    206 
    207     def test_parse_error_nonfatal(self):
     204            warnings = [u":1 Test lacks BUG modifier. failures/expected/text.html",
     205                        u":1 Unrecognized modifier 'foo' failures/expected/text.html",
     206                        u":2 Missing expectations SKIP : failures/expected/image.html"]
     207            self.assertEqual(str(e), '\n'.join(self._port.path_to_test_expectations_file() + str(warning) for warning in warnings))
     208
    208209        try:
    209210            self.parse_exp('SKIP : failures/expected/text.html = TEXT', is_lint_mode=True)
    210211            self.assertFalse(True, "ParseError wasn't raised")
    211212        except ParseError, e:
    212             self.assertFalse(e.fatal)
    213             exp_errors = [u':1 Test lacks BUG modifier. failures/expected/text.html']
    214             self.assertEqual(str(e), '\n'.join(self._port.path_to_test_expectations_file() + str(error) for error in exp_errors))
     213            warnings = [u':1 Test lacks BUG modifier. failures/expected/text.html']
     214            self.assertEqual(str(e), '\n'.join(self._port.path_to_test_expectations_file() + str(warning) for warning in warnings))
    215215
    216216    def test_error_on_different_platform(self):
     
    238238
    239239    def test_overrides__duplicate(self):
    240         self.assertRaises(ParseError, self.parse_exp,
    241              "BUG_EXP: failures/expected/text.html = TEXT",
    242              """
    243 BUG_OVERRIDE : failures/expected/text.html = IMAGE
    244 BUG_OVERRIDE : failures/expected/text.html = CRASH
    245 """)
     240        self.assert_bad_expectations("BUG_EXP: failures/expected/text.html = TEXT",
     241                                     "BUG_OVERRIDE : failures/expected/text.html = IMAGE\n"
     242                                     "BUG_OVERRIDE : failures/expected/text.html = CRASH\n")
    246243
    247244    def test_pixel_tests_flag(self):
     
    288285    def test_missing_expectation(self):
    289286        # This is missing the expectation.
    290         self.assertRaises(ParseError, self.parse_exp,
    291                           'BUG_TEST: failures/expected/text.html')
     287        self.assert_bad_expectations('BUG_TEST: failures/expected/text.html')
    292288
    293289    def test_missing_colon(self):
    294290        # This is missing the modifiers and the ':'
    295         self.assertRaises(ParseError, self.parse_exp,
    296                           'failures/expected/text.html = TEXT')
    297 
    298     def disabled_test_too_many_colons(self):
    299         # FIXME: Enable this test and fix the underlying bug.
    300         self.assertRaises(ParseError, self.parse_exp,
    301                           'BUG_TEST: failures/expected/text.html = PASS :')
     291        self.assert_bad_expectations('failures/expected/text.html = TEXT')
     292
     293    def test_too_many_colons(self):
     294        self.assert_bad_expectations('BUG_TEST: failures/expected/text.html = PASS :')
    302295
    303296    def test_too_many_equals_signs(self):
    304         self.assertRaises(ParseError, self.parse_exp,
    305                           'BUG_TEST: failures/expected/text.html = TEXT = IMAGE')
     297        self.assert_bad_expectations('BUG_TEST: failures/expected/text.html = TEXT = IMAGE')
    306298
    307299    def test_unrecognized_expectation(self):
    308         self.assertRaises(ParseError, self.parse_exp,
    309                           'BUG_TEST: failures/expected/text.html = UNKNOWN')
     300        self.assert_bad_expectations('BUG_TEST: failures/expected/text.html = UNKNOWN')
    310301
    311302    def test_macro(self):
     
    319310class SemanticTests(Base):
    320311    def test_bug_format(self):
    321         self.assertRaises(ParseError, self.parse_exp, 'BUG1234 : failures/expected/text.html = TEXT')
     312        self.assertRaises(ParseError, self.parse_exp, 'BUG1234 : failures/expected/text.html = TEXT', is_lint_mode=True)
    322313
    323314    def test_bad_bugid(self):
    324315        try:
    325             self.parse_exp('BUG1234 SLOW : failures/expected/text.html = TEXT')
     316            self.parse_exp('BUG1234 SLOW : failures/expected/text.html = TEXT', is_lint_mode=True)
    326317            self.fail('should have raised an error about a bad bug identifier')
    327318        except ParseError, exp:
    328             self.assertEquals(exp.fatal, True)
    329             self.assertEquals(len(exp.errors), 1)
     319            self.assertEquals(len(exp.warnings), 1)
    330320
    331321    def test_missing_bugid(self):
    332         # This should log a non-fatal error.
    333322        self.parse_exp('SLOW : failures/expected/text.html = TEXT')
    334323        self.assertTrue(self._exp.has_warnings())
     
    337326        # A test cannot be SLOW and expected to TIMEOUT.
    338327        self.assertRaises(ParseError, self.parse_exp,
    339             'BUG_TEST SLOW : failures/expected/timeout.html = TIMEOUT')
     328            'BUG_TEST SLOW : failures/expected/timeout.html = TIMEOUT', is_lint_mode=True)
    340329
    341330    def test_rebaseline(self):
     
    348337        self.assertRaises(ParseError, self.parse_exp, """
    349338BUG_EXP : failures/expected/text.html = TEXT
    350 BUG_EXP : failures/expected/text.html = IMAGE""")
     339BUG_EXP : failures/expected/text.html = IMAGE""", is_lint_mode=True)
    351340
    352341        self.assertRaises(ParseError, self.parse_exp,
    353342            self.get_basic_expectations(), overrides="""
    354343BUG_OVERRIDE : failures/expected/text.html = TEXT
    355 BUG_OVERRIDE : failures/expected/text.html = IMAGE""", )
     344BUG_OVERRIDE : failures/expected/text.html = IMAGE""", is_lint_mode=True)
    356345
    357346    def test_missing_file(self):
     
    382371
    383372    def test_ambiguous(self):
    384         self.assertRaises(ParseError, self.parse_exp, """
    385 BUG_TEST RELEASE : passes/text.html = PASS
    386 BUG_TEST WIN : passes/text.html = FAIL
    387 """)
     373        self.assert_bad_expectations("BUG_TEST RELEASE : passes/text.html = PASS\n"
     374                                     "BUG_TEST WIN : passes/text.html = FAIL\n")
    388375
    389376    def test_more_modifiers(self):
    390         exp_str = """
    391 BUG_TEST RELEASE : passes/text.html = PASS
    392 BUG_TEST WIN RELEASE : passes/text.html = TEXT
    393 """
    394         self.assertRaises(ParseError, self.parse_exp, exp_str)
     377        self.assert_bad_expectations("BUG_TEST RELEASE : passes/text.html = PASS\n"
     378                                     "BUG_TEST WIN RELEASE : passes/text.html = TEXT\n")
    395379
    396380    def test_order_in_file(self):
    397         exp_str = """
    398 BUG_TEST WIN RELEASE : passes/text.html = TEXT
    399 BUG_TEST RELEASE : passes/text.html = PASS
    400 """
    401         self.assertRaises(ParseError, self.parse_exp, exp_str)
     381        self.assert_bad_expectations("BUG_TEST WIN RELEASE : passes/text.html = TEXT\n"
     382                                     "BUG_TEST RELEASE : passes/text.html = PASS\n")
    402383
    403384    def test_macro_overrides(self):
    404         exp_str = """
    405 BUG_TEST WIN : passes/text.html = PASS
    406 BUG_TEST XP : passes/text.html = TEXT
    407 """
    408         self.assertRaises(ParseError, self.parse_exp, exp_str)
     385        self.assert_bad_expectations("BUG_TEST WIN : passes/text.html = PASS\n"
     386                                     "BUG_TEST XP : passes/text.html = TEXT\n")
    409387
    410388
     
    412390    """Test rebaselining-specific functionality."""
    413391    def assertRemove(self, input_expectations, tests, expected_expectations):
    414         self.parse_exp(input_expectations)
     392        self.parse_exp(input_expectations, is_lint_mode=False)
    415393        actual_expectations = self._exp.remove_rebaselined_tests(tests)
    416394        self.assertEqual(expected_expectations, actual_expectations)
     
    432410    def test_tokenize_blank(self):
    433411        expectation = TestExpectationParser._tokenize('')
    434         self.assertEqual(expectation.is_malformed(), False)
    435412        self.assertEqual(expectation.comment, None)
    436         self.assertEqual(len(expectation.errors), 0)
     413        self.assertEqual(len(expectation.warnings), 0)
    437414
    438415    def test_tokenize_missing_colon(self):
    439416        expectation = TestExpectationParser._tokenize('Qux.')
    440         self.assertEqual(expectation.is_malformed(), True)
    441         self.assertEqual(str(expectation.errors), '["Missing a \':\'"]')
     417        self.assertEqual(str(expectation.warnings), '["Missing a \':\'"]')
    442418
    443419    def test_tokenize_extra_colon(self):
    444420        expectation = TestExpectationParser._tokenize('FOO : : bar')
    445         self.assertEqual(expectation.is_malformed(), True)
    446         self.assertEqual(str(expectation.errors), '["Extraneous \':\'"]')
     421        self.assertEqual(str(expectation.warnings), '["Extraneous \':\'"]')
    447422
    448423    def test_tokenize_empty_comment(self):
    449424        expectation = TestExpectationParser._tokenize('//')
    450         self.assertEqual(expectation.is_malformed(), False)
    451425        self.assertEqual(expectation.comment, '')
    452         self.assertEqual(len(expectation.errors), 0)
     426        self.assertEqual(len(expectation.warnings), 0)
    453427
    454428    def test_tokenize_comment(self):
    455429        expectation = TestExpectationParser._tokenize('//Qux.')
    456         self.assertEqual(expectation.is_malformed(), False)
    457430        self.assertEqual(expectation.comment, 'Qux.')
    458         self.assertEqual(len(expectation.errors), 0)
     431        self.assertEqual(len(expectation.warnings), 0)
    459432
    460433    def test_tokenize_missing_equal(self):
    461434        expectation = TestExpectationParser._tokenize('FOO : bar')
    462         self.assertEqual(expectation.is_malformed(), True)
    463         self.assertEqual(str(expectation.errors), "['Missing expectations\']")
     435        self.assertEqual(str(expectation.warnings), "['Missing expectations\']")
    464436
    465437    def test_tokenize_extra_equal(self):
    466438        expectation = TestExpectationParser._tokenize('FOO : bar = BAZ = Qux.')
    467         self.assertEqual(expectation.is_malformed(), True)
    468         self.assertEqual(str(expectation.errors), '["Extraneous \'=\'"]')
     439        self.assertEqual(str(expectation.warnings), '["Extraneous \'=\'"]')
    469440
    470441    def test_tokenize_valid(self):
    471442        expectation = TestExpectationParser._tokenize('FOO : bar = BAZ')
    472         self.assertEqual(expectation.is_malformed(), False)
    473443        self.assertEqual(expectation.comment, None)
    474         self.assertEqual(len(expectation.errors), 0)
     444        self.assertEqual(len(expectation.warnings), 0)
    475445
    476446    def test_tokenize_valid_with_comment(self):
    477447        expectation = TestExpectationParser._tokenize('FOO : bar = BAZ //Qux.')
    478         self.assertEqual(expectation.is_malformed(), False)
    479448        self.assertEqual(expectation.comment, 'Qux.')
    480449        self.assertEqual(str(expectation.modifiers), '[\'foo\']')
    481450        self.assertEqual(str(expectation.expectations), '[\'baz\']')
    482         self.assertEqual(len(expectation.errors), 0)
     451        self.assertEqual(len(expectation.warnings), 0)
    483452
    484453    def test_tokenize_valid_with_multiple_modifiers(self):
    485454        expectation = TestExpectationParser._tokenize('FOO1 FOO2 : bar = BAZ //Qux.')
    486         self.assertEqual(expectation.is_malformed(), False)
    487455        self.assertEqual(expectation.comment, 'Qux.')
    488456        self.assertEqual(str(expectation.modifiers), '[\'foo1\', \'foo2\']')
    489457        self.assertEqual(str(expectation.expectations), '[\'baz\']')
    490         self.assertEqual(len(expectation.errors), 0)
     458        self.assertEqual(len(expectation.warnings), 0)
    491459
    492460    def test_parse_empty_string(self):
     
    539507        expectation.modifiers = ['foo1', 'foO2']
    540508        self.assertEqual(serializer.to_string(expectation), 'FOO1 FOO2 : bar = BAZ1 BAZ2 //Qux.')
    541         expectation.errors.append('Oh the horror.')
     509        expectation.warnings.append('Oh the horror.')
    542510        self.assertEqual(serializer.to_string(expectation), '')
    543511        expectation.original_string = 'Yes it is!'
  • trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py

    r106224 r106591  
    7171            lint_failed = True
    7272            _log.error('')
    73             for error in e.errors:
    74                 _log.error(error)
     73            for warning in e.warnings:
     74                _log.error(warning)
    7575            _log.error('')
    7676        files_linted.add(expectations_file)
  • trunk/Tools/Scripts/webkitpy/style/checkers/test_expectations.py

    r105948 r106591  
    9999
    100100        if err:
    101             level = 2
    102             if err.fatal:
    103                 level = 5
    104             for error in err.errors:
    105                 matched = self._output_regex.match(error)
     101            level = 5
     102            for warning in err.warnings:
     103                matched = self._output_regex.match(warning)
    106104                if matched:
    107105                    lineno, message = matched.group('line', 'message')
Note: See TracChangeset for help on using the changeset viewer.