Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: webkit/tools/layout_tests/layout_package/test_expectations.py

Issue 146112: Allow layout tests to be located both in src/webkit/data/layout_tests and... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 448
449 test_list_path = tests_and_expecation_parts[0].strip() 449 test_list_path = tests_and_expecation_parts[0].strip()
450 expectations = self._ParseExpectations(tests_and_expecation_parts[1], 450 expectations = self._ParseExpectations(tests_and_expecation_parts[1],
451 lineno, test_list_path) 451 lineno, test_list_path)
452 452
453 if 'slow' in options and TIMEOUT in expectations: 453 if 'slow' in options and TIMEOUT in expectations:
454 self._AddError(lineno, 'A test cannot be both slow and timeout. If the ' 454 self._AddError(lineno, 'A test cannot be both slow and timeout. If the '
455 'test times out indefinitely, the it should be listed as timeout.', 455 'test times out indefinitely, the it should be listed as timeout.',
456 test_and_expectations) 456 test_and_expectations)
457 457
458 full_path = os.path.join(path_utils.LayoutDataDir(), test_list_path) 458 full_path = os.path.join(path_utils.LayoutTestsDir(test_list_path),
459 test_list_path)
459 full_path = os.path.normpath(full_path) 460 full_path = os.path.normpath(full_path)
460 # WebKit's way of skipping tests is to add a -disabled suffix. 461 # WebKit's way of skipping tests is to add a -disabled suffix.
461 # So we should consider the path existing if the path or the -disabled 462 # So we should consider the path existing if the path or the -disabled
462 # version exists. 463 # version exists.
463 if not os.path.exists(full_path) and not \ 464 if not os.path.exists(full_path) and not \
464 os.path.exists(full_path + '-disabled'): 465 os.path.exists(full_path + '-disabled'):
465 # Log a non fatal error here since you hit this case any time you 466 # Log a non fatal error here since you hit this case any time you
466 # update test_expectations.txt without syncing the LayoutTests 467 # update test_expectations.txt without syncing the LayoutTests
467 # directory 468 # directory
468 self._LogNonFatalError(lineno, 'Path does not exist.', test_list_path) 469 self._LogNonFatalError(lineno, 'Path does not exist.', test_list_path)
(...skipping 28 matching lines...) Expand all
497 self._AddError(lineno, 'Unsupported expectation: %s' % part, 498 self._AddError(lineno, 'Unsupported expectation: %s' % part,
498 test_list_path) 499 test_list_path)
499 continue 500 continue
500 expectation = self.EXPECTATIONS[part] 501 expectation = self.EXPECTATIONS[part]
501 result.add(expectation) 502 result.add(expectation)
502 return result 503 return result
503 504
504 def _ExpandTests(self, test_list_path): 505 def _ExpandTests(self, test_list_path):
505 # Convert the test specification to an absolute, normalized 506 # Convert the test specification to an absolute, normalized
506 # path and make sure directories end with the OS path separator. 507 # path and make sure directories end with the OS path separator.
507 path = os.path.join(path_utils.LayoutDataDir(), test_list_path) 508 path = os.path.join(path_utils.LayoutTestsDir(test_list_path),
509 test_list_path)
508 path = os.path.normpath(path) 510 path = os.path.normpath(path)
509 if os.path.isdir(path): path = os.path.join(path, '') 511 if os.path.isdir(path): path = os.path.join(path, '')
510 # This is kind of slow - O(n*m) - since this is called for all 512 # This is kind of slow - O(n*m) - since this is called for all
511 # entries in the test lists. It has not been a performance 513 # entries in the test lists. It has not been a performance
512 # issue so far. Maybe we should re-measure the time spent reading 514 # issue so far. Maybe we should re-measure the time spent reading
513 # in the test lists? 515 # in the test lists?
514 result = [] 516 result = []
515 for test in self._full_test_list: 517 for test in self._full_test_list:
516 if test.startswith(path): result.append(test) 518 if test.startswith(path): result.append(test)
517 return result 519 return result
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 def _AddError(self, lineno, msg, path): 571 def _AddError(self, lineno, msg, path):
570 """Reports an error that will prevent running the tests. Does not 572 """Reports an error that will prevent running the tests. Does not
571 immediately raise an exception because we'd like to aggregate all the 573 immediately raise an exception because we'd like to aggregate all the
572 errors so they can all be printed out.""" 574 errors so they can all be printed out."""
573 self._errors.append('\nLine:%s %s %s' % (lineno, msg, path)) 575 self._errors.append('\nLine:%s %s %s' % (lineno, msg, path))
574 576
575 def _LogNonFatalError(self, lineno, msg, path): 577 def _LogNonFatalError(self, lineno, msg, path):
576 """Reports an error that will not prevent running the tests. These are 578 """Reports an error that will not prevent running the tests. These are
577 still errors, but not bad enough to warrant breaking test running.""" 579 still errors, but not bad enough to warrant breaking test running."""
578 self._non_fatal_errors.append('Line:%s %s %s' % (lineno, msg, path)) 580 self._non_fatal_errors.append('Line:%s %s %s' % (lineno, msg, path))
OLDNEW
« no previous file with comments | « webkit/tools/layout_tests/layout_package/platform_utils_win.py ('k') | webkit/tools/layout_tests/rebaseline.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698