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

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

Issue 40151: Fix _ValidateLists to work when running in linting mode. (Closed)
Patch Set: Fix 80 char violation Created 11 years, 9 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
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 os 9 import os
10 import re 10 import re
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 """Read the expectation files for the given filename and return a single 112 """Read the expectation files for the given filename and return a single
113 expectations file with the merged results. 113 expectations file with the merged results.
114 """ 114 """
115 115
116 path = os.path.join(self._directory, filename) 116 path = os.path.join(self._directory, filename)
117 return TestExpectationsFile(path, self._tests, self._platform, 117 return TestExpectationsFile(path, self._tests, self._platform,
118 self._is_debug_mode) 118 self._is_debug_mode)
119 119
120 def _ValidateLists(self): 120 def _ValidateLists(self):
121 # Make sure there's no overlap between the tests in the two files. 121 # Make sure there's no overlap between the tests in the two files.
122 overlap = self._fixable.GetTests() & self._ignored.GetTests() 122 if self._tests:
123 relativizeFilenames = True
124 overlap = self._fixable.GetTests() & self._ignored.GetTests()
125 else:
126 relativizeFilenames = False
127 # If self._tests is None, then we have no way of expanding test paths
128 # So they remain shortened (e.g. LayoutTests/mac doesn't get expanded to
129 # include LayoutTests/mac/foo.html). So find duplicate prefixes
130 # instead of exact matches.
131 overlap = [];
132 for fixableTest in self._fixable.GetTests():
133 for ignoredTest in self._ignored.GetTests():
134 # Add both tests so they both get printed
135 if (fixableTest.startswith(ignoredTest) or
136 ignoredTest.startswith(fixableTest)):
137 overlap.append(fixableTest)
138 overlap.append(ignoredTest)
139
123 message = "Files contained in both " + self.FIXABLE + " and " + self.IGNORED 140 message = "Files contained in both " + self.FIXABLE + " and " + self.IGNORED
124 compare_failures.PrintFilesFromSet(overlap, message, sys.stdout) 141 compare_failures.PrintFilesFromSet(overlap, message, sys.stdout,
142 opt_relativizeFilenames=relativizeFilenames)
125 assert(len(overlap) == 0) 143 assert(len(overlap) == 0)
126 # Make sure there are no ignored tests expected to crash. 144 # Make sure there are no ignored tests expected to crash.
127 assert(len(self._ignored.GetTestsExpectedTo(CRASH)) == 0) 145 assert(len(self._ignored.GetTestsExpectedTo(CRASH)) == 0)
128 146
129 147
130 def StripComments(line): 148 def StripComments(line):
131 """Strips comments from a line and return None if the line is empty 149 """Strips comments from a line and return None if the line is empty
132 or else the contents of line with leading and trailing spaces removed 150 or else the contents of line with leading and trailing spaces removed
133 and all other whitespace collapsed""" 151 and all other whitespace collapsed"""
134 152
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 self._tests[expectation].add(test) 387 self._tests[expectation].add(test)
370 388
371 def _AddSkippedTests(self, tests, is_deferred): 389 def _AddSkippedTests(self, tests, is_deferred):
372 for test in tests: 390 for test in tests:
373 if is_deferred: 391 if is_deferred:
374 self._skipped_deferred.add(test) 392 self._skipped_deferred.add(test)
375 self._skipped.add(test) 393 self._skipped.add(test)
376 394
377 def _AddError(self, lineno, msg, path): 395 def _AddError(self, lineno, msg, path):
378 self._errors.append('\nLine:%s %s\n%s' % (lineno, msg, path)) 396 self._errors.append('\nLine:%s %s\n%s' % (lineno, msg, path))
OLDNEW
« no previous file with comments | « webkit/tools/layout_tests/layout_package/compare_failures.py ('k') | webkit/tools/layout_tests/run_webkit_tests.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698