OLD | NEW |
1 # Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2006-2008 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 |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 | 305 |
306 test_list_path = tests_and_expecation_parts[0].strip() | 306 test_list_path = tests_and_expecation_parts[0].strip() |
307 expectations = self._ParseExpectations(tests_and_expecation_parts[1], | 307 expectations = self._ParseExpectations(tests_and_expecation_parts[1], |
308 lineno, test_list_path) | 308 lineno, test_list_path) |
309 | 309 |
310 if 'slow' in options and TIMEOUT in expectations: | 310 if 'slow' in options and TIMEOUT in expectations: |
311 self._AddError(lineno, 'A test cannot be both slow and timeout. If the ' | 311 self._AddError(lineno, 'A test cannot be both slow and timeout. If the ' |
312 'test times out indefinitely, the it should be listed as timeout.', | 312 'test times out indefinitely, the it should be listed as timeout.', |
313 test_and_expectations) | 313 test_and_expectations) |
314 | 314 |
315 full_path = os.path.join(path_utils.LayoutDataDir(), test_list_path) | 315 full_path = os.path.join(path_utils.LayoutTestsDir(test_list_path), |
| 316 test_list_path) |
316 full_path = os.path.normpath(full_path) | 317 full_path = os.path.normpath(full_path) |
317 # WebKit's way of skipping tests is to add a -disabled suffix. | 318 # WebKit's way of skipping tests is to add a -disabled suffix. |
318 # So we should consider the path existing if the path or the -disabled | 319 # So we should consider the path existing if the path or the -disabled |
319 # version exists. | 320 # version exists. |
320 if not os.path.exists(full_path) and not \ | 321 if not os.path.exists(full_path) and not \ |
321 os.path.exists(full_path + '-disabled'): | 322 os.path.exists(full_path + '-disabled'): |
322 # Log a non fatal error here since you hit this case any time you | 323 # Log a non fatal error here since you hit this case any time you |
323 # update test_expectations.txt without syncing the LayoutTests | 324 # update test_expectations.txt without syncing the LayoutTests |
324 # directory | 325 # directory |
325 self._LogNonFatalError(lineno, 'Path does not exist.', test_list_path) | 326 self._LogNonFatalError(lineno, 'Path does not exist.', test_list_path) |
(...skipping 28 matching lines...) Expand all Loading... |
354 self._AddError(lineno, 'Unsupported expectation: %s' % part, | 355 self._AddError(lineno, 'Unsupported expectation: %s' % part, |
355 test_list_path) | 356 test_list_path) |
356 continue | 357 continue |
357 expectation = self.EXPECTATIONS[part] | 358 expectation = self.EXPECTATIONS[part] |
358 result.add(expectation) | 359 result.add(expectation) |
359 return result | 360 return result |
360 | 361 |
361 def _ExpandTests(self, test_list_path): | 362 def _ExpandTests(self, test_list_path): |
362 # Convert the test specification to an absolute, normalized | 363 # Convert the test specification to an absolute, normalized |
363 # path and make sure directories end with the OS path separator. | 364 # path and make sure directories end with the OS path separator. |
364 path = os.path.join(path_utils.LayoutDataDir(), test_list_path) | 365 path = os.path.join(path_utils.LayoutTestsDir(test_list_path), |
| 366 test_list_path) |
365 path = os.path.normpath(path) | 367 path = os.path.normpath(path) |
366 if os.path.isdir(path): path = os.path.join(path, '') | 368 if os.path.isdir(path): path = os.path.join(path, '') |
367 # This is kind of slow - O(n*m) - since this is called for all | 369 # This is kind of slow - O(n*m) - since this is called for all |
368 # entries in the test lists. It has not been a performance | 370 # entries in the test lists. It has not been a performance |
369 # issue so far. Maybe we should re-measure the time spent reading | 371 # issue so far. Maybe we should re-measure the time spent reading |
370 # in the test lists? | 372 # in the test lists? |
371 result = [] | 373 result = [] |
372 for test in self._full_test_list: | 374 for test in self._full_test_list: |
373 if test.startswith(path): result.append(test) | 375 if test.startswith(path): result.append(test) |
374 return result | 376 return result |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 def _AddError(self, lineno, msg, path): | 428 def _AddError(self, lineno, msg, path): |
427 """Reports an error that will prevent running the tests. Does not | 429 """Reports an error that will prevent running the tests. Does not |
428 immediately raise an exception because we'd like to aggregate all the | 430 immediately raise an exception because we'd like to aggregate all the |
429 errors so they can all be printed out.""" | 431 errors so they can all be printed out.""" |
430 self._errors.append('\nLine:%s %s %s' % (lineno, msg, path)) | 432 self._errors.append('\nLine:%s %s %s' % (lineno, msg, path)) |
431 | 433 |
432 def _LogNonFatalError(self, lineno, msg, path): | 434 def _LogNonFatalError(self, lineno, msg, path): |
433 """Reports an error that will not prevent running the tests. These are | 435 """Reports an error that will not prevent running the tests. These are |
434 still errors, but not bad enough to warrant breaking test running.""" | 436 still errors, but not bad enough to warrant breaking test running.""" |
435 self._non_fatal_errors.append('Line:%s %s %s' % (lineno, msg, path)) | 437 self._non_fatal_errors.append('Line:%s %s %s' % (lineno, msg, path)) |
OLD | NEW |