OLD | NEW |
1 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """A helper class for reading in and dealing with tests expectations | 5 """A helper class for reading in and dealing with tests expectations |
6 for layout tests. | 6 for layout tests. |
7 """ | 7 """ |
8 | 8 |
9 import logging | 9 import logging |
10 import os | 10 import os |
11 import re | 11 import re |
12 import sys | 12 import sys |
13 import time | 13 import time |
14 import path_utils | 14 import path_utils |
15 import compare_failures | 15 import compare_failures |
16 | 16 |
17 sys.path.append(path_utils.PathFromBase('third_party')) | 17 sys.path.append(path_utils.PathFromBase('third_party')) |
18 import simplejson | 18 import simplejson |
19 | 19 |
20 # Test expectation and modifier constants. | 20 # Test expectation and modifier constants. |
21 (PASS, FAIL, TEXT, IMAGE, IMAGE_PLUS_TEXT, TIMEOUT, CRASH, SKIP, WONTFIX, | 21 (PASS, FAIL, TEXT, IMAGE, IMAGE_PLUS_TEXT, TIMEOUT, CRASH, SKIP, WONTFIX, |
22 DEFER, SLOW, REBASELINE, NONE) = range(13) | 22 DEFER, SLOW, REBASELINE, MISSING, NONE) = range(14) |
23 | 23 |
24 # Test expectation file update action constants | 24 # Test expectation file update action constants |
25 (NO_CHANGE, REMOVE_TEST, REMOVE_PLATFORM, ADD_PLATFORMS_EXCEPT_THIS) = range(4) | 25 (NO_CHANGE, REMOVE_TEST, REMOVE_PLATFORM, ADD_PLATFORMS_EXCEPT_THIS) = range(4) |
26 | 26 |
27 class TestExpectations: | 27 class TestExpectations: |
28 TEST_LIST = "test_expectations.txt" | 28 TEST_LIST = "test_expectations.txt" |
29 | 29 |
30 def __init__(self, tests, directory, platform, is_debug_mode, is_lint_mode): | 30 def __init__(self, tests, directory, platform, is_debug_mode, is_lint_mode): |
31 """Reads the test expectations files from the given directory.""" | 31 """Reads the test expectations files from the given directory.""" |
32 path = os.path.join(directory, self.TEST_LIST) | 32 path = os.path.join(directory, self.TEST_LIST) |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 -If a test is included twice, then the more precise path wins. | 209 -If a test is included twice, then the more precise path wins. |
210 -CRASH tests cannot be DEFER or WONTFIX | 210 -CRASH tests cannot be DEFER or WONTFIX |
211 """ | 211 """ |
212 | 212 |
213 EXPECTATIONS = { 'pass': PASS, | 213 EXPECTATIONS = { 'pass': PASS, |
214 'fail': FAIL, | 214 'fail': FAIL, |
215 'text': TEXT, | 215 'text': TEXT, |
216 'image': IMAGE, | 216 'image': IMAGE, |
217 'image+text': IMAGE_PLUS_TEXT, | 217 'image+text': IMAGE_PLUS_TEXT, |
218 'timeout': TIMEOUT, | 218 'timeout': TIMEOUT, |
219 'crash': CRASH } | 219 'crash': CRASH, |
| 220 'missing': MISSING } |
220 | 221 |
221 PLATFORMS = [ 'mac', 'linux', 'win', 'win-xp', 'win-vista', 'win-7' ] | 222 PLATFORMS = [ 'mac', 'linux', 'win', 'win-xp', 'win-vista', 'win-7' ] |
222 | 223 |
223 BUILD_TYPES = [ 'debug', 'release' ] | 224 BUILD_TYPES = [ 'debug', 'release' ] |
224 | 225 |
225 MODIFIERS = { 'skip': SKIP, | 226 MODIFIERS = { 'skip': SKIP, |
226 'wontfix': WONTFIX, | 227 'wontfix': WONTFIX, |
227 'defer': DEFER, | 228 'defer': DEFER, |
228 'slow': SLOW, | 229 'slow': SLOW, |
229 'rebaseline': REBASELINE, | 230 'rebaseline': REBASELINE, |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
676 def _AddError(self, lineno, msg, path): | 677 def _AddError(self, lineno, msg, path): |
677 """Reports an error that will prevent running the tests. Does not | 678 """Reports an error that will prevent running the tests. Does not |
678 immediately raise an exception because we'd like to aggregate all the | 679 immediately raise an exception because we'd like to aggregate all the |
679 errors so they can all be printed out.""" | 680 errors so they can all be printed out.""" |
680 self._errors.append('\nLine:%s %s %s' % (lineno, msg, path)) | 681 self._errors.append('\nLine:%s %s %s' % (lineno, msg, path)) |
681 | 682 |
682 def _LogNonFatalError(self, lineno, msg, path): | 683 def _LogNonFatalError(self, lineno, msg, path): |
683 """Reports an error that will not prevent running the tests. These are | 684 """Reports an error that will not prevent running the tests. These are |
684 still errors, but not bad enough to warrant breaking test running.""" | 685 still errors, but not bad enough to warrant breaking test running.""" |
685 self._non_fatal_errors.append('Line:%s %s %s' % (lineno, msg, path)) | 686 self._non_fatal_errors.append('Line:%s %s %s' % (lineno, msg, path)) |
OLD | NEW |