| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 # as PASS is 0. | 44 # as PASS is 0. |
| 45 (PASS, FAIL, TEXT, IMAGE, IMAGE_PLUS_TEXT, AUDIO, TIMEOUT, CRASH, LEAK, SKIP, WO
NTFIX, | 45 (PASS, FAIL, TEXT, IMAGE, IMAGE_PLUS_TEXT, AUDIO, TIMEOUT, CRASH, LEAK, SKIP, WO
NTFIX, |
| 46 SLOW, REBASELINE, NEEDS_REBASELINE, NEEDS_MANUAL_REBASELINE, MISSING, FLAKY, NO
W, NONE) = range(19) | 46 SLOW, REBASELINE, NEEDS_REBASELINE, NEEDS_MANUAL_REBASELINE, MISSING, FLAKY, NO
W, NONE) = range(19) |
| 47 | 47 |
| 48 # FIXME: Perhas these two routines should be part of the Port instead? | 48 # FIXME: Perhas these two routines should be part of the Port instead? |
| 49 BASELINE_SUFFIX_LIST = ('png', 'wav', 'txt') | 49 BASELINE_SUFFIX_LIST = ('png', 'wav', 'txt') |
| 50 | 50 |
| 51 WEBKIT_BUG_PREFIX = 'webkit.org/b/' | 51 WEBKIT_BUG_PREFIX = 'webkit.org/b/' |
| 52 CHROMIUM_BUG_PREFIX = 'crbug.com/' | 52 CHROMIUM_BUG_PREFIX = 'crbug.com/' |
| 53 V8_BUG_PREFIX = 'code.google.com/p/v8/issues/detail?id=' | 53 V8_BUG_PREFIX = 'code.google.com/p/v8/issues/detail?id=' |
| 54 MOJO_BUG_PREFIX = 'https://github.com/domokit/mojo/issues/' |
| 54 NAMED_BUG_PREFIX = 'Bug(' | 55 NAMED_BUG_PREFIX = 'Bug(' |
| 55 | 56 |
| 56 MISSING_KEYWORD = 'Missing' | 57 MISSING_KEYWORD = 'Missing' |
| 57 NEEDS_REBASELINE_KEYWORD = 'NeedsRebaseline' | 58 NEEDS_REBASELINE_KEYWORD = 'NeedsRebaseline' |
| 58 NEEDS_MANUAL_REBASELINE_KEYWORD = 'NeedsManualRebaseline' | 59 NEEDS_MANUAL_REBASELINE_KEYWORD = 'NeedsManualRebaseline' |
| 59 | 60 |
| 60 class ParseError(Exception): | 61 class ParseError(Exception): |
| 61 def __init__(self, warnings): | 62 def __init__(self, warnings): |
| 62 super(ParseError, self).__init__() | 63 super(ParseError, self).__init__() |
| 63 self.warnings = warnings | 64 self.warnings = warnings |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 expectations = [] | 278 expectations = [] |
| 278 warnings = [] | 279 warnings = [] |
| 279 has_unrecognized_expectation = False | 280 has_unrecognized_expectation = False |
| 280 | 281 |
| 281 tokens = remaining_string.split() | 282 tokens = remaining_string.split() |
| 282 state = 'start' | 283 state = 'start' |
| 283 for token in tokens: | 284 for token in tokens: |
| 284 if (token.startswith(WEBKIT_BUG_PREFIX) or | 285 if (token.startswith(WEBKIT_BUG_PREFIX) or |
| 285 token.startswith(CHROMIUM_BUG_PREFIX) or | 286 token.startswith(CHROMIUM_BUG_PREFIX) or |
| 286 token.startswith(V8_BUG_PREFIX) or | 287 token.startswith(V8_BUG_PREFIX) or |
| 288 token.startswith(MOJO_BUG_PREFIX) or |
| 287 token.startswith(NAMED_BUG_PREFIX)): | 289 token.startswith(NAMED_BUG_PREFIX)): |
| 288 if state != 'start': | 290 if state != 'start': |
| 289 warnings.append('"%s" is not at the start of the line.' % to
ken) | 291 warnings.append('"%s" is not at the start of the line.' % to
ken) |
| 290 break | 292 break |
| 291 if token.startswith(WEBKIT_BUG_PREFIX): | 293 if (token.startswith(WEBKIT_BUG_PREFIX) or |
| 292 bugs.append(token) | 294 token.startswith(CHROMIUM_BUG_PREFIX) or |
| 293 elif token.startswith(CHROMIUM_BUG_PREFIX): | 295 token.startswith(MOJO_BUG_PREFIX) or |
| 294 bugs.append(token) | 296 token.startswith(V8_BUG_PREFIX)): |
| 295 elif token.startswith(V8_BUG_PREFIX): | |
| 296 bugs.append(token) | 297 bugs.append(token) |
| 297 else: | 298 else: |
| 298 match = re.match('Bug\((\w+)\)$', token) | 299 match = re.match('Bug\((\w+)\)$', token) |
| 299 if not match: | 300 if not match: |
| 300 warnings.append('unrecognized bug identifier "%s"' % tok
en) | 301 warnings.append('unrecognized bug identifier "%s"' % tok
en) |
| 301 break | 302 break |
| 302 else: | 303 else: |
| 303 bugs.append(token) | 304 bugs.append(token) |
| 304 elif token == '[': | 305 elif token == '[': |
| 305 if state == 'start': | 306 if state == 'start': |
| (...skipping 811 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1117 # If reconstitute_only_these is an empty list, we want to return ori
ginal_string. | 1118 # If reconstitute_only_these is an empty list, we want to return ori
ginal_string. |
| 1118 # So we need to compare reconstitute_only_these to None, not just ch
eck if it's falsey. | 1119 # So we need to compare reconstitute_only_these to None, not just ch
eck if it's falsey. |
| 1119 if reconstitute_only_these is None or expectation_line in reconstitu
te_only_these: | 1120 if reconstitute_only_these is None or expectation_line in reconstitu
te_only_these: |
| 1120 return expectation_line.to_string(test_configuration_converter) | 1121 return expectation_line.to_string(test_configuration_converter) |
| 1121 return expectation_line.original_string | 1122 return expectation_line.original_string |
| 1122 | 1123 |
| 1123 def nones_out(expectation_line): | 1124 def nones_out(expectation_line): |
| 1124 return expectation_line is not None | 1125 return expectation_line is not None |
| 1125 | 1126 |
| 1126 return "\n".join(filter(nones_out, map(serialize, expectation_lines))) | 1127 return "\n".join(filter(nones_out, map(serialize, expectation_lines))) |
| OLD | NEW |