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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 CHROMIUM_BUG_PREFIX = 'crbug.com/' | 54 CHROMIUM_BUG_PREFIX = 'crbug.com/' |
55 V8_BUG_PREFIX = 'code.google.com/p/v8/issues/detail?id=' | 55 V8_BUG_PREFIX = 'code.google.com/p/v8/issues/detail?id=' |
56 NAMED_BUG_PREFIX = 'Bug(' | 56 NAMED_BUG_PREFIX = 'Bug(' |
57 | 57 |
58 MISSING_KEYWORD = 'Missing' | 58 MISSING_KEYWORD = 'Missing' |
59 NEEDS_REBASELINE_KEYWORD = 'NeedsRebaseline' | 59 NEEDS_REBASELINE_KEYWORD = 'NeedsRebaseline' |
60 NEEDS_MANUAL_REBASELINE_KEYWORD = 'NeedsManualRebaseline' | 60 NEEDS_MANUAL_REBASELINE_KEYWORD = 'NeedsManualRebaseline' |
61 | 61 |
62 | 62 |
63 class ParseError(Exception): | 63 class ParseError(Exception): |
| 64 |
64 def __init__(self, warnings): | 65 def __init__(self, warnings): |
65 super(ParseError, self).__init__() | 66 super(ParseError, self).__init__() |
66 self.warnings = warnings | 67 self.warnings = warnings |
67 | 68 |
68 def __str__(self): | 69 def __str__(self): |
69 return '\n'.join(map(str, self.warnings)) | 70 return '\n'.join(map(str, self.warnings)) |
70 | 71 |
71 def __repr__(self): | 72 def __repr__(self): |
72 return 'ParseError(warnings=%s)' % self.warnings | 73 return 'ParseError(warnings=%s)' % self.warnings |
73 | 74 |
74 | 75 |
75 class TestExpectationParser(object): | 76 class TestExpectationParser(object): |
76 """Provides parsing facilities for lines in the test_expectation.txt file.""
" | 77 """Provides parsing facilities for lines in the test_expectation.txt file.""
" |
77 | 78 |
78 # FIXME: Rename these to *_KEYWORD as in MISSING_KEYWORD above, but make the
case studdly-caps to match the actual file contents. | 79 # FIXME: Rename these to *_KEYWORD as in MISSING_KEYWORD above, but make |
| 80 # the case studdly-caps to match the actual file contents. |
79 REBASELINE_MODIFIER = 'rebaseline' | 81 REBASELINE_MODIFIER = 'rebaseline' |
80 NEEDS_REBASELINE_MODIFIER = 'needsrebaseline' | 82 NEEDS_REBASELINE_MODIFIER = 'needsrebaseline' |
81 NEEDS_MANUAL_REBASELINE_MODIFIER = 'needsmanualrebaseline' | 83 NEEDS_MANUAL_REBASELINE_MODIFIER = 'needsmanualrebaseline' |
82 PASS_EXPECTATION = 'pass' | 84 PASS_EXPECTATION = 'pass' |
83 SKIP_MODIFIER = 'skip' | 85 SKIP_MODIFIER = 'skip' |
84 SLOW_MODIFIER = 'slow' | 86 SLOW_MODIFIER = 'slow' |
85 WONTFIX_MODIFIER = 'wontfix' | 87 WONTFIX_MODIFIER = 'wontfix' |
86 | 88 |
87 TIMEOUT_EXPECTATION = 'timeout' | 89 TIMEOUT_EXPECTATION = 'timeout' |
88 | 90 |
89 MISSING_BUG_WARNING = 'Test lacks BUG specifier.' | 91 MISSING_BUG_WARNING = 'Test lacks BUG specifier.' |
90 | 92 |
91 def __init__(self, port, all_tests, is_lint_mode): | 93 def __init__(self, port, all_tests, is_lint_mode): |
92 self._port = port | 94 self._port = port |
93 self._test_configuration_converter = TestConfigurationConverter(set(port
.all_test_configurations()), port.configuration_specifier_macros()) | 95 self._test_configuration_converter = TestConfigurationConverter( |
| 96 set(port.all_test_configurations()), port.configuration_specifier_ma
cros()) |
94 | 97 |
95 if all_tests: | 98 if all_tests: |
96 self._all_tests = set(all_tests) | 99 self._all_tests = set(all_tests) |
97 else: | 100 else: |
98 self._all_tests = set() | 101 self._all_tests = set() |
99 | 102 |
100 self._is_lint_mode = is_lint_mode | 103 self._is_lint_mode = is_lint_mode |
101 | 104 |
102 def parse(self, filename, expectations_string): | 105 def parse(self, filename, expectations_string): |
103 expectation_lines = [] | 106 expectation_lines = [] |
(...skipping 11 matching lines...) Expand all Loading... |
115 expectation_line.name = test_name | 118 expectation_line.name = test_name |
116 expectation_line.filename = file_name | 119 expectation_line.filename = file_name |
117 expectation_line.expectations = expectations | 120 expectation_line.expectations = expectations |
118 return expectation_line | 121 return expectation_line |
119 | 122 |
120 def expectation_line_for_test(self, test_name, expectations): | 123 def expectation_line_for_test(self, test_name, expectations): |
121 expectation_line = self._create_expectation_line(test_name, expectations
, '<Bot TestExpectations>') | 124 expectation_line = self._create_expectation_line(test_name, expectations
, '<Bot TestExpectations>') |
122 self._parse_line(expectation_line) | 125 self._parse_line(expectation_line) |
123 return expectation_line | 126 return expectation_line |
124 | 127 |
125 | |
126 def expectation_for_skipped_test(self, test_name): | 128 def expectation_for_skipped_test(self, test_name): |
127 if not self._port.test_exists(test_name): | 129 if not self._port.test_exists(test_name): |
128 _log.warning('The following test %s from the Skipped list doesn\'t e
xist' % test_name) | 130 _log.warning('The following test %s from the Skipped list doesn\'t e
xist' % test_name) |
129 expectation_line = self._create_expectation_line(test_name, [TestExpecta
tionParser.PASS_EXPECTATION], '<Skipped file>') | 131 expectation_line = self._create_expectation_line(test_name, [TestExpecta
tionParser.PASS_EXPECTATION], '<Skipped file>') |
130 expectation_line.expectations = [TestExpectationParser.SKIP_MODIFIER, Te
stExpectationParser.WONTFIX_MODIFIER] | 132 expectation_line.expectations = [TestExpectationParser.SKIP_MODIFIER, Te
stExpectationParser.WONTFIX_MODIFIER] |
131 expectation_line.is_skipped_outside_expectations_file = True | 133 expectation_line.is_skipped_outside_expectations_file = True |
132 self._parse_line(expectation_line) | 134 self._parse_line(expectation_line) |
133 return expectation_line | 135 return expectation_line |
134 | 136 |
135 def _parse_line(self, expectation_line): | 137 def _parse_line(self, expectation_line): |
(...skipping 15 matching lines...) Expand all Loading... |
151 self._parse_expectations(expectation_line) | 153 self._parse_expectations(expectation_line) |
152 | 154 |
153 def _parse_specifier(self, specifier): | 155 def _parse_specifier(self, specifier): |
154 return specifier.lower() | 156 return specifier.lower() |
155 | 157 |
156 def _parse_specifiers(self, expectation_line): | 158 def _parse_specifiers(self, expectation_line): |
157 if self._is_lint_mode: | 159 if self._is_lint_mode: |
158 self._lint_line(expectation_line) | 160 self._lint_line(expectation_line) |
159 | 161 |
160 parsed_specifiers = set([self._parse_specifier(specifier) for specifier
in expectation_line.specifiers]) | 162 parsed_specifiers = set([self._parse_specifier(specifier) for specifier
in expectation_line.specifiers]) |
161 expectation_line.matching_configurations = self._test_configuration_conv
erter.to_config_set(parsed_specifiers, expectation_line.warnings) | 163 expectation_line.matching_configurations = self._test_configuration_conv
erter.to_config_set( |
| 164 parsed_specifiers, expectation_line.warnings) |
162 | 165 |
163 def _lint_line(self, expectation_line): | 166 def _lint_line(self, expectation_line): |
164 expectations = [expectation.lower() for expectation in expectation_line.
expectations] | 167 expectations = [expectation.lower() for expectation in expectation_line.
expectations] |
165 if not expectation_line.bugs and self.WONTFIX_MODIFIER not in expectatio
ns: | 168 if not expectation_line.bugs and self.WONTFIX_MODIFIER not in expectatio
ns: |
166 expectation_line.warnings.append(self.MISSING_BUG_WARNING) | 169 expectation_line.warnings.append(self.MISSING_BUG_WARNING) |
167 if self.REBASELINE_MODIFIER in expectations: | 170 if self.REBASELINE_MODIFIER in expectations: |
168 expectation_line.warnings.append('REBASELINE should only be used for
running rebaseline.py. Cannot be checked in.') | 171 expectation_line.warnings.append('REBASELINE should only be used for
running rebaseline.py. Cannot be checked in.') |
169 | 172 |
170 if self.NEEDS_REBASELINE_MODIFIER in expectations or self.NEEDS_MANUAL_R
EBASELINE_MODIFIER in expectations: | 173 if self.NEEDS_REBASELINE_MODIFIER in expectations or self.NEEDS_MANUAL_R
EBASELINE_MODIFIER in expectations: |
171 for test in expectation_line.matching_tests: | 174 for test in expectation_line.matching_tests: |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 self.comment = None | 405 self.comment = None |
403 self.matching_tests = [] | 406 self.matching_tests = [] |
404 self.warnings = [] | 407 self.warnings = [] |
405 self.is_skipped_outside_expectations_file = False | 408 self.is_skipped_outside_expectations_file = False |
406 | 409 |
407 def __str__(self): | 410 def __str__(self): |
408 return "TestExpectationLine{name=%s, matching_configurations=%s, origina
l_string=%s}" % (self.name, self.matching_configurations, self.original_string) | 411 return "TestExpectationLine{name=%s, matching_configurations=%s, origina
l_string=%s}" % (self.name, self.matching_configurations, self.original_string) |
409 | 412 |
410 def __eq__(self, other): | 413 def __eq__(self, other): |
411 return (self.original_string == other.original_string | 414 return (self.original_string == other.original_string |
412 and self.filename == other.filename | 415 and self.filename == other.filename |
413 and self.line_numbers == other.line_numbers | 416 and self.line_numbers == other.line_numbers |
414 and self.name == other.name | 417 and self.name == other.name |
415 and self.path == other.path | 418 and self.path == other.path |
416 and self.bugs == other.bugs | 419 and self.bugs == other.bugs |
417 and self.specifiers == other.specifiers | 420 and self.specifiers == other.specifiers |
418 and self.parsed_specifiers == other.parsed_specifiers | 421 and self.parsed_specifiers == other.parsed_specifiers |
419 and self.matching_configurations == other.matching_configurations | 422 and self.matching_configurations == other.matching_configuration
s |
420 and self.expectations == other.expectations | 423 and self.expectations == other.expectations |
421 and self.parsed_expectations == other.parsed_expectations | 424 and self.parsed_expectations == other.parsed_expectations |
422 and self.comment == other.comment | 425 and self.comment == other.comment |
423 and self.matching_tests == other.matching_tests | 426 and self.matching_tests == other.matching_tests |
424 and self.warnings == other.warnings | 427 and self.warnings == other.warnings |
425 and self.is_skipped_outside_expectations_file == other.is_skipped_ou
tside_expectations_file) | 428 and self.is_skipped_outside_expectations_file == other.is_skippe
d_outside_expectations_file) |
426 | 429 |
427 def is_invalid(self): | 430 def is_invalid(self): |
428 return bool(self.warnings and self.warnings != [TestExpectationParser.MI
SSING_BUG_WARNING]) | 431 return bool(self.warnings and self.warnings != [TestExpectationParser.MI
SSING_BUG_WARNING]) |
429 | 432 |
430 def is_flaky(self): | 433 def is_flaky(self): |
431 return len(self.parsed_expectations) > 1 | 434 return len(self.parsed_expectations) > 1 |
432 | 435 |
433 def is_whitespace_or_comment(self): | 436 def is_whitespace_or_comment(self): |
434 return bool(re.match("^\s*$", self.original_string.split('#')[0])) | 437 return bool(re.match("^\s*$", self.original_string.split('#')[0])) |
435 | 438 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 result.bugs = list(set(line1.bugs) | set(line2.bugs)) | 470 result.bugs = list(set(line1.bugs) | set(line2.bugs)) |
468 result.specifiers = list(set(line1.specifiers) | set(line2.specifiers)) | 471 result.specifiers = list(set(line1.specifiers) | set(line2.specifiers)) |
469 result.parsed_specifiers = list(set(line1.parsed_specifiers) | set(line2
.parsed_specifiers)) | 472 result.parsed_specifiers = list(set(line1.parsed_specifiers) | set(line2
.parsed_specifiers)) |
470 result.matching_configurations = set(line1.matching_configurations) | se
t(line2.matching_configurations) | 473 result.matching_configurations = set(line1.matching_configurations) | se
t(line2.matching_configurations) |
471 result.matching_tests = list(list(set(line1.matching_tests) | set(line2.
matching_tests))) | 474 result.matching_tests = list(list(set(line1.matching_tests) | set(line2.
matching_tests))) |
472 result.warnings = list(set(line1.warnings) | set(line2.warnings)) | 475 result.warnings = list(set(line1.warnings) | set(line2.warnings)) |
473 result.is_skipped_outside_expectations_file = line1.is_skipped_outside_e
xpectations_file or line2.is_skipped_outside_expectations_file | 476 result.is_skipped_outside_expectations_file = line1.is_skipped_outside_e
xpectations_file or line2.is_skipped_outside_expectations_file |
474 return result | 477 return result |
475 | 478 |
476 def to_string(self, test_configuration_converter, include_specifiers=True, i
nclude_expectations=True, include_comment=True): | 479 def to_string(self, test_configuration_converter, include_specifiers=True, i
nclude_expectations=True, include_comment=True): |
477 parsed_expectation_to_string = dict([[parsed_expectation, expectation_st
ring] for expectation_string, parsed_expectation in TestExpectations.EXPECTATION
S.items()]) | 480 parsed_expectation_to_string = dict([[parsed_expectation, expectation_st
ring] |
| 481 for expectation_string, parsed_expe
ctation in TestExpectations.EXPECTATIONS.items()]) |
478 | 482 |
479 if self.is_invalid(): | 483 if self.is_invalid(): |
480 return self.original_string or '' | 484 return self.original_string or '' |
481 | 485 |
482 if self.name is None: | 486 if self.name is None: |
483 return '' if self.comment is None else "#%s" % self.comment | 487 return '' if self.comment is None else "#%s" % self.comment |
484 | 488 |
485 if test_configuration_converter and self.bugs: | 489 if test_configuration_converter and self.bugs: |
486 specifiers_list = test_configuration_converter.to_specifiers_list(se
lf.matching_configurations) | 490 specifiers_list = test_configuration_converter.to_specifiers_list(se
lf.matching_configurations) |
487 result = [] | 491 result = [] |
488 for specifiers in specifiers_list: | 492 for specifiers in specifiers_list: |
489 # FIXME: this is silly that we join the specifiers and then imme
diately split them. | 493 # FIXME: this is silly that we join the specifiers and then imme
diately split them. |
490 specifiers = self._serialize_parsed_specifiers(test_configuratio
n_converter, specifiers).split() | 494 specifiers = self._serialize_parsed_specifiers(test_configuratio
n_converter, specifiers).split() |
491 expectations = self._serialize_parsed_expectations(parsed_expect
ation_to_string).split() | 495 expectations = self._serialize_parsed_expectations(parsed_expect
ation_to_string).split() |
492 result.append(self._format_line(self.bugs, specifiers, self.name
, expectations, self.comment)) | 496 result.append(self._format_line(self.bugs, specifiers, self.name
, expectations, self.comment)) |
493 return "\n".join(result) if result else None | 497 return "\n".join(result) if result else None |
494 | 498 |
495 return self._format_line(self.bugs, self.specifiers, self.name, self.exp
ectations, self.comment, | 499 return self._format_line(self.bugs, self.specifiers, self.name, self.exp
ectations, self.comment, |
496 include_specifiers, include_expectations, include_comment) | 500 include_specifiers, include_expectations, inclu
de_comment) |
497 | 501 |
498 def to_csv(self): | 502 def to_csv(self): |
499 # Note that this doesn't include the comments. | 503 # Note that this doesn't include the comments. |
500 return '%s,%s,%s,%s' % (self.name, ' '.join(self.bugs), ' '.join(self.sp
ecifiers), ' '.join(self.expectations)) | 504 return '%s,%s,%s,%s' % (self.name, ' '.join(self.bugs), ' '.join(self.sp
ecifiers), ' '.join(self.expectations)) |
501 | 505 |
502 def _serialize_parsed_expectations(self, parsed_expectation_to_string): | 506 def _serialize_parsed_expectations(self, parsed_expectation_to_string): |
503 result = [] | 507 result = [] |
504 for index in TestExpectations.EXPECTATIONS.values(): | 508 for index in TestExpectations.EXPECTATIONS.values(): |
505 if index in self.parsed_expectations: | 509 if index in self.parsed_expectations: |
506 result.append(parsed_expectation_to_string[index]) | 510 result.append(parsed_expectation_to_string[index]) |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
683 """Returns a list of warnings encountered while matching specifiers.""" | 687 """Returns a list of warnings encountered while matching specifiers.""" |
684 | 688 |
685 if expectation_line.is_invalid(): | 689 if expectation_line.is_invalid(): |
686 return | 690 return |
687 | 691 |
688 for test in expectation_line.matching_tests: | 692 for test in expectation_line.matching_tests: |
689 if self._already_seen_better_match(test, expectation_line): | 693 if self._already_seen_better_match(test, expectation_line): |
690 continue | 694 continue |
691 | 695 |
692 if model_all_expectations: | 696 if model_all_expectations: |
693 expectation_line = TestExpectationLine.merge_expectation_lines(s
elf.get_expectation_line(test), expectation_line, model_all_expectations) | 697 expectation_line = TestExpectationLine.merge_expectation_lines( |
| 698 self.get_expectation_line(test), expectation_line, model_all
_expectations) |
694 | 699 |
695 self._clear_expectations_for_test(test) | 700 self._clear_expectations_for_test(test) |
696 self._test_to_expectation_line[test] = expectation_line | 701 self._test_to_expectation_line[test] = expectation_line |
697 self._add_test(test, expectation_line) | 702 self._add_test(test, expectation_line) |
698 | 703 |
699 def _add_test(self, test, expectation_line): | 704 def _add_test(self, test, expectation_line): |
700 """Sets the expected state for a given test. | 705 """Sets the expected state for a given test. |
701 | 706 |
702 This routine assumes the test has not been added before. If it has, | 707 This routine assumes the test has not been added before. If it has, |
703 use _clear_expectations_for_test() to reset the state prior to | 708 use _clear_expectations_for_test() to reset the state prior to |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
780 # to be warnings and return False". | 785 # to be warnings and return False". |
781 | 786 |
782 if prev_expectation_line.matching_configurations == expectation_line.mat
ching_configurations: | 787 if prev_expectation_line.matching_configurations == expectation_line.mat
ching_configurations: |
783 expectation_line.warnings.append('Duplicate or ambiguous entry lines
%s:%s and %s:%s.' % ( | 788 expectation_line.warnings.append('Duplicate or ambiguous entry lines
%s:%s and %s:%s.' % ( |
784 self._shorten_filename(prev_expectation_line.filename), prev_exp
ectation_line.line_numbers, | 789 self._shorten_filename(prev_expectation_line.filename), prev_exp
ectation_line.line_numbers, |
785 self._shorten_filename(expectation_line.filename), expectation_l
ine.line_numbers)) | 790 self._shorten_filename(expectation_line.filename), expectation_l
ine.line_numbers)) |
786 return True | 791 return True |
787 | 792 |
788 if prev_expectation_line.matching_configurations >= expectation_line.mat
ching_configurations: | 793 if prev_expectation_line.matching_configurations >= expectation_line.mat
ching_configurations: |
789 expectation_line.warnings.append('More specific entry for %s on line
%s:%s overrides line %s:%s.' % (expectation_line.name, | 794 expectation_line.warnings.append('More specific entry for %s on line
%s:%s overrides line %s:%s.' % (expectation_line.name, |
790 self._shorten_filename(prev_expectation_line.filename), prev_exp
ectation_line.line_numbers, | 795
self._shorten_filename( |
791 self._shorten_filename(expectation_line.filename), expectation_l
ine.line_numbers)) | 796
prev_expectation_line.filename), prev_expec
tation_line.line_numbers, |
| 797
self._shorten_filename(expectation_line.filenam
e), expectation_line.line_numbers)) |
792 # FIXME: return False if we want more specific to win. | 798 # FIXME: return False if we want more specific to win. |
793 return True | 799 return True |
794 | 800 |
795 if prev_expectation_line.matching_configurations <= expectation_line.mat
ching_configurations: | 801 if prev_expectation_line.matching_configurations <= expectation_line.mat
ching_configurations: |
796 expectation_line.warnings.append('More specific entry for %s on line
%s:%s overrides line %s:%s.' % (expectation_line.name, | 802 expectation_line.warnings.append('More specific entry for %s on line
%s:%s overrides line %s:%s.' % (expectation_line.name, |
797 self._shorten_filename(expectation_line.filename), expectation_l
ine.line_numbers, | 803
self._shorten_filename( |
798 self._shorten_filename(prev_expectation_line.filename), prev_exp
ectation_line.line_numbers)) | 804
expectation_line.filename), expectation_lin
e.line_numbers, |
| 805
self._shorten_filename(prev_expectation_line.fi
lename), prev_expectation_line.line_numbers)) |
799 return True | 806 return True |
800 | 807 |
801 if prev_expectation_line.matching_configurations & expectation_line.matc
hing_configurations: | 808 if prev_expectation_line.matching_configurations & expectation_line.matc
hing_configurations: |
802 expectation_line.warnings.append('Entries for %s on lines %s:%s and
%s:%s match overlapping sets of configurations.' % (expectation_line.name, | 809 expectation_line.warnings.append('Entries for %s on lines %s:%s and
%s:%s match overlapping sets of configurations.' % (expectation_line.name, |
803 self._shorten_filename(prev_expectation_line.filename), prev_exp
ectation_line.line_numbers, | 810
self._shorten_filename( |
804 self._shorten_filename(expectation_line.filename), expectation_l
ine.line_numbers)) | 811
prev_expectation_line.fi
lename), prev_expectation_line.line_numbers, |
| 812
self._shorten_filename(expec
tation_line.filename), expectation_line.line_numbers)) |
805 return True | 813 return True |
806 | 814 |
807 # Configuration sets are disjoint, then. | 815 # Configuration sets are disjoint, then. |
808 return False | 816 return False |
809 | 817 |
810 | 818 |
811 class TestExpectations(object): | 819 class TestExpectations(object): |
812 """Test expectations consist of lines with specifications of what | 820 """Test expectations consist of lines with specifications of what |
813 to expect from layout test cases. The test cases can be directories | 821 to expect from layout test cases. The test cases can be directories |
814 in which case the expectations apply to all test cases in that | 822 in which case the expectations apply to all test cases in that |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
847 'timeout': TIMEOUT, | 855 'timeout': TIMEOUT, |
848 'crash': CRASH, | 856 'crash': CRASH, |
849 'leak': LEAK, | 857 'leak': LEAK, |
850 'missing': MISSING, | 858 'missing': MISSING, |
851 TestExpectationParser.SKIP_MODIFIER: SKIP, | 859 TestExpectationParser.SKIP_MODIFIER: SKIP, |
852 TestExpectationParser.NEEDS_REBASELINE_MODIFIER: NEEDS_REBAS
ELINE, | 860 TestExpectationParser.NEEDS_REBASELINE_MODIFIER: NEEDS_REBAS
ELINE, |
853 TestExpectationParser.NEEDS_MANUAL_REBASELINE_MODIFIER: NEED
S_MANUAL_REBASELINE, | 861 TestExpectationParser.NEEDS_MANUAL_REBASELINE_MODIFIER: NEED
S_MANUAL_REBASELINE, |
854 TestExpectationParser.WONTFIX_MODIFIER: WONTFIX, | 862 TestExpectationParser.WONTFIX_MODIFIER: WONTFIX, |
855 TestExpectationParser.SLOW_MODIFIER: SLOW, | 863 TestExpectationParser.SLOW_MODIFIER: SLOW, |
856 TestExpectationParser.REBASELINE_MODIFIER: REBASELINE, | 864 TestExpectationParser.REBASELINE_MODIFIER: REBASELINE, |
857 } | 865 } |
858 | 866 |
859 EXPECTATIONS_TO_STRING = dict((k, v) for (v, k) in EXPECTATIONS.iteritems()) | 867 EXPECTATIONS_TO_STRING = dict((k, v) for (v, k) in EXPECTATIONS.iteritems()) |
860 | 868 |
861 # (aggregated by category, pass/fail/skip, type) | 869 # (aggregated by category, pass/fail/skip, type) |
862 EXPECTATION_DESCRIPTIONS = {SKIP: 'skipped', | 870 EXPECTATION_DESCRIPTIONS = {SKIP: 'skipped', |
863 PASS: 'passes', | 871 PASS: 'passes', |
864 FAIL: 'failures', | 872 FAIL: 'failures', |
865 IMAGE: 'image-only failures', | 873 IMAGE: 'image-only failures', |
866 TEXT: 'text-only failures', | 874 TEXT: 'text-only failures', |
867 IMAGE_PLUS_TEXT: 'image and text failures', | 875 IMAGE_PLUS_TEXT: 'image and text failures', |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1051 def _shorten_filename(self, filename): | 1059 def _shorten_filename(self, filename): |
1052 if filename.startswith(self._port.path_from_webkit_base()): | 1060 if filename.startswith(self._port.path_from_webkit_base()): |
1053 return self._port.host.filesystem.relpath(filename, self._port.path_
from_webkit_base()) | 1061 return self._port.host.filesystem.relpath(filename, self._port.path_
from_webkit_base()) |
1054 return filename | 1062 return filename |
1055 | 1063 |
1056 def _report_warnings(self): | 1064 def _report_warnings(self): |
1057 warnings = [] | 1065 warnings = [] |
1058 for expectation in self._expectations: | 1066 for expectation in self._expectations: |
1059 for warning in expectation.warnings: | 1067 for warning in expectation.warnings: |
1060 warnings.append('%s:%s %s %s' % (self._shorten_filename(expectat
ion.filename), expectation.line_numbers, | 1068 warnings.append('%s:%s %s %s' % (self._shorten_filename(expectat
ion.filename), expectation.line_numbers, |
1061 warning, expectation.name if expectation.expecta
tions else expectation.original_string)) | 1069 warning, expectation.name if ex
pectation.expectations else expectation.original_string)) |
1062 | 1070 |
1063 if warnings: | 1071 if warnings: |
1064 self._has_warnings = True | 1072 self._has_warnings = True |
1065 if self._is_lint_mode: | 1073 if self._is_lint_mode: |
1066 raise ParseError(warnings) | 1074 raise ParseError(warnings) |
1067 _log.warning('--lint-test-files warnings:') | 1075 _log.warning('--lint-test-files warnings:') |
1068 for warning in warnings: | 1076 for warning in warnings: |
1069 _log.warning(warning) | 1077 _log.warning(warning) |
1070 _log.warning('') | 1078 _log.warning('') |
1071 | 1079 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1156 # If reconstitute_only_these is an empty list, we want to return ori
ginal_string. | 1164 # If reconstitute_only_these is an empty list, we want to return ori
ginal_string. |
1157 # So we need to compare reconstitute_only_these to None, not just ch
eck if it's falsey. | 1165 # So we need to compare reconstitute_only_these to None, not just ch
eck if it's falsey. |
1158 if reconstitute_only_these is None or expectation_line in reconstitu
te_only_these: | 1166 if reconstitute_only_these is None or expectation_line in reconstitu
te_only_these: |
1159 return expectation_line.to_string(test_configuration_converter) | 1167 return expectation_line.to_string(test_configuration_converter) |
1160 return expectation_line.original_string | 1168 return expectation_line.original_string |
1161 | 1169 |
1162 def nones_out(expectation_line): | 1170 def nones_out(expectation_line): |
1163 return expectation_line is not None | 1171 return expectation_line is not None |
1164 | 1172 |
1165 return "\n".join(filter(nones_out, map(serialize, expectation_lines))) | 1173 return "\n".join(filter(nones_out, map(serialize, expectation_lines))) |
OLD | NEW |