Changeset 117805 in webkit
- Timestamp:
- May 21, 2012, 11:52:16 AM (14 years ago)
- Location:
- trunk/Tools
- Files:
-
- 11 edited
-
ChangeLog (modified) (1 diff)
-
Scripts/webkitpy/layout_tests/controllers/manager.py (modified) (1 diff)
-
Scripts/webkitpy/layout_tests/controllers/manager_unittest.py (modified) (2 diffs)
-
Scripts/webkitpy/layout_tests/models/test_expectations.py (modified) (3 diffs)
-
Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py (modified) (4 diffs)
-
Scripts/webkitpy/layout_tests/run_webkit_tests.py (modified) (3 diffs)
-
Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py (modified) (4 diffs)
-
Scripts/webkitpy/layout_tests/views/printing_unittest.py (modified) (1 diff)
-
Scripts/webkitpy/style/checkers/test_expectations.py (modified) (1 diff)
-
Scripts/webkitpy/tool/commands/queries.py (modified) (1 diff)
-
Scripts/webkitpy/tool/commands/rebaseline.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r117804 r117805 1 2012-05-21 Dirk Pranke <dpranke@chromium.org> 2 3 webkitpy: clean up the TestExpectations constructor 4 https://bugs.webkit.org/show_bug.cgi?id=86926 5 6 Reviewed by Ojan Vafai. 7 8 The TestExpectations constructor was attempting to pretend 9 it didn't need to get stuff from the Port, and as a result we 10 had a complicated constructor with a bunch of arguments, and 11 calling it was too complicated (although it made testing a 12 little easier and simplified the style checker). 13 14 This patch has the constructor pull all the data it needs from 15 the port directly, and allows us to delete a bunch of code. 16 17 * Scripts/webkitpy/layout_tests/controllers/manager.py: 18 (Manager.parse_expectations): 19 * Scripts/webkitpy/layout_tests/controllers/manager_unittest.py: 20 (ManagerTest.test_update_summary_with_result): 21 (ResultSummaryTest.get_result_summary): 22 * Scripts/webkitpy/layout_tests/models/test_expectations.py: 23 (TestExpectations.__init__): 24 * Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py: 25 (parse_exp): 26 (SkippedTests.check): 27 (RemoveConfigurationsTest.test_remove): 28 (test_remove_line): 29 * Scripts/webkitpy/layout_tests/run_webkit_tests.py: 30 (lint): 31 (run): 32 * Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py: 33 (LintTest.test_all_configurations.FakePort.__init__): 34 (LintTest.test_all_configurations.FakePort.test_expectations): 35 (LintTest.test_all_configurations.FakePort.skipped_layout_tests): 36 (LintTest.test_all_configurations.FakePort): 37 (LintTest.test_all_configurations.FakePort.all_test_configurations): 38 (LintTest.test_all_configurations.FakePort.configuration_specifier_macros): 39 (LintTest.test_all_configurations.FakePort.path_from_webkit_base): 40 (LintTest.test_all_configurations.FakePort.get_option): 41 (LintTest.test_all_configurations.FakeFactory.__init__): 42 (LintTest.test_all_configurations.FakeFactory.all_port_names): 43 (LintTest.test_all_configurations): 44 * Scripts/webkitpy/layout_tests/views/printing_unittest.py: 45 (Testprinter.get_result_summary): 46 * Scripts/webkitpy/style/checkers/test_expectations.py: 47 (TestExpectationsChecker.check_test_expectations): 48 * Scripts/webkitpy/tool/commands/queries.py: 49 (PrintExpectations._model): 50 * Scripts/webkitpy/tool/commands/rebaseline.py: 51 (RebaselineTest._update_expectations_file): 52 (RebaselineExpectations._expectations): 53 1 54 2012-05-21 Sudarsana Nagineni <sudarsana.nagineni@linux.intel.com> 2 55 -
trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py
r116552 r117805 363 363 364 364 def parse_expectations(self): 365 """Parse the expectations from the test_list files and return a data 366 structure holding them. Throws an error if the test_list files have 367 invalid syntax.""" 368 port = self._port 369 tests_to_ignore = set(self._options.ignore_tests) 370 self._expectations = test_expectations.TestExpectations( 371 port, 372 self._test_files, 373 port.test_expectations(), 374 port.test_configuration(), 375 self._options.lint_test_files, 376 port.test_expectations_overrides(), 377 port.skipped_layout_tests(self._test_files).union(tests_to_ignore)) 365 self._expectations = test_expectations.TestExpectations(self._port, self._test_files) 378 366 379 367 def _split_into_chunks_if_necessary(self, skipped): -
trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager_unittest.py
r112805 r117805 258 258 port = host.port_factory.get('test-win-xp') 259 259 test = 'failures/expected/reftest.html' 260 expectations = TestExpectations(port, tests=[test], 261 expectations='WONTFIX : failures/expected/reftest.html = IMAGE', 262 test_config=port.test_configuration()) 260 port.test_expectations = lambda: 'WONTFIX : failures/expected/reftest.html = IMAGE' 261 expectations = TestExpectations(port, tests=[test]) 263 262 # Reftests expected to be image mismatch should be respected when pixel_tests=False. 264 263 manager = Manager(port=port, options=MockOptions(pixel_tests=False, exit_after_n_failures=None, exit_after_n_crashes_or_timeouts=None), printer=Mock()) … … 386 385 387 386 def get_result_summary(self, port, test_names, expectations_str): 388 expectations = test_expectations.TestExpectations(port, test_names, expectations_str, port.test_configuration(), is_lint_mode=False) 387 port.test_expectations = lambda: expectations_str 388 expectations = test_expectations.TestExpectations(port, test_names) 389 389 return test_names, result_summary.ResultSummary(expectations, test_names), expectations 390 390 -
trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py
r113802 r117805 723 723 return cls.EXPECTATIONS.get(string.lower()) 724 724 725 def __init__(self, port, tests, expectations, 726 test_config, is_lint_mode=False, overrides=None, 727 skipped_tests=None): 728 """Loads and parses the test expectations given in the string. 729 Args: 730 port: handle to object containing platform-specific functionality 731 tests: list of all of the test files 732 expectations: test expectations as a string 733 test_config: specific values to check against when 734 parsing the file (usually port.test_config(), 735 but may be different when linting or doing other things). 736 is_lint_mode: If True, parse the expectations string and raise 737 an exception if warnings are encountered. 738 overrides: test expectations that are allowed to override any 739 entries in |expectations|. This is used by callers 740 that need to manage two sets of expectations (e.g., upstream 741 and downstream expectations). 742 skipped_tests: test paths to skip. 743 """ 725 def __init__(self, port, tests=None, is_lint_mode=False): 744 726 self._full_test_list = tests 745 self._test_config = test_config727 self._test_config = port.test_configuration() 746 728 self._is_lint_mode = is_lint_mode 747 729 self._model = TestExpectationsModel() … … 750 732 self._skipped_tests_warnings = [] 751 733 752 self._expectations = self._parser.parse( expectations)734 self._expectations = self._parser.parse(port.test_expectations()) 753 735 self._add_expectations(self._expectations, in_overrides=False) 754 736 737 overrides = port.test_expectations_overrides() 755 738 if overrides: 756 739 overrides_expectations = self._parser.parse(overrides) … … 758 741 self._expectations += overrides_expectations 759 742 760 self._add_skipped_tests(skipped_tests or []) 743 # FIXME: move ignore_tests into port.skipped_layout_tests() 744 self._add_skipped_tests(port.skipped_layout_tests(tests).union(set(port.get_option('ignore_tests', [])))) 761 745 762 746 self._has_warnings = False -
trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py
r111261 r117805 120 120 121 121 def parse_exp(self, expectations, overrides=None, is_lint_mode=False): 122 test_config = self._port.test_configuration() 123 self._exp = TestExpectations(self._port, 124 tests=self.get_basic_tests(), 125 expectations=expectations, 126 test_config=test_config, 127 is_lint_mode=is_lint_mode, 128 overrides=overrides) 122 self._port.test_expectations = lambda: expectations 123 self._port.test_expectations_overrides = lambda: overrides 124 self._exp = TestExpectations(self._port, self.get_basic_tests(), is_lint_mode) 129 125 130 126 def assert_exp(self, test, result): … … 266 262 port = MockHost().port_factory.get('qt') 267 263 port._filesystem.write_text_file(port._filesystem.join(port.layout_tests_dir(), 'failures/expected/text.html'), 'foo') 268 exp = TestExpectations(port, tests=['failures/expected/text.html'], 269 expectations=expectations, overrides=overrides, is_lint_mode=lint, 270 test_config=port.test_configuration(), skipped_tests=set(skips)) 264 port.test_expectations = lambda: expectations 265 port.test_expectations_overrides = lambda: overrides 266 port.skipped_layout_tests = lambda tests: set(skips) 267 exp = TestExpectations(port, ['failures/expected/text.html'], lint) 271 268 272 269 # Check that the expectation is for BUG_DUMMY SKIP : ... = PASS … … 411 408 412 409 test_config = test_port.test_configuration() 413 expectations = TestExpectations(test_port, 414 tests=self.get_basic_tests(), 415 expectations="""BUGX LINUX WIN RELEASE : failures/expected/foo.html = TEXT 410 test_port.test_expectations = lambda: """BUGX LINUX WIN RELEASE : failures/expected/foo.html = TEXT 416 411 BUGY WIN MAC DEBUG : failures/expected/foo.html = CRASH 417 """, 418 test_config=test_config, 419 is_lint_mode=False, 420 overrides=None) 412 """ 413 expectations = TestExpectations(test_port, self.get_basic_tests()) 421 414 422 415 actual_expectations = expectations.remove_configuration_from_test('failures/expected/foo.html', test_config) … … 433 426 434 427 test_config = test_port.test_configuration() 435 expectations = TestExpectations(test_port, 436 tests=None, 437 expectations="""BUGX WIN RELEASE : failures/expected/foo.html = TEXT 428 test_port.test_expectations = lambda: """BUGX WIN RELEASE : failures/expected/foo.html = TEXT 438 429 BUGY WIN DEBUG : failures/expected/foo.html = CRASH 439 """, 440 test_config=test_config, 441 is_lint_mode=False, 442 overrides=None) 430 """ 431 expectations = TestExpectations(test_port) 443 432 444 433 actual_expectations = expectations.remove_configuration_from_test('failures/expected/foo.html', test_config) -
trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py
r116859 r117805 47 47 48 48 49 def lint(port, options , expectations_class):49 def lint(port, options): 50 50 host = port.host 51 51 if options.platform: … … 63 63 64 64 try: 65 expectations_class(port_to_lint, 66 tests=None, 67 expectations=port_to_lint.test_expectations(), 68 test_config=port_to_lint.test_configuration(), 69 is_lint_mode=True, 70 overrides=port_to_lint.test_expectations_overrides()) 65 test_expectations.TestExpectations(port_to_lint, is_lint_mode=True) 71 66 except test_expectations.ParseError, e: 72 67 lint_failed = True … … 98 93 99 94 if options.lint_test_files: 100 return lint(port, options , test_expectations.TestExpectations)95 return lint(port, options) 101 96 102 97 # We wrap any parts of the run that are slow or likely to raise exceptions -
trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py
r116552 r117805 193 193 194 194 class FakePort(object): 195 def __init__(self, name, path): 195 def __init__(self, host, name, path): 196 self.host = host 196 197 self.name = name 197 198 self.path = path 198 199 199 200 def test_expectations(self): 201 self.host.ports_parsed.append(self.name) 200 202 return '' 201 203 … … 208 210 def test_expectations_overrides(self): 209 211 return None 212 213 def skipped_layout_tests(self, tests): 214 return set([]) 215 216 def all_test_configurations(self): 217 return [] 218 219 def configuration_specifier_macros(self): 220 return [] 221 222 def path_from_webkit_base(self): 223 return '' 224 225 def get_option(self, name, val): 226 return val 210 227 211 228 class FakeFactory(object): … … 215 232 for port in ports: 216 233 self.ports[port.name] = port 217 port.host = host218 port.factory = self219 234 220 235 def get(self, port_name, *args, **kwargs): … … 224 239 return sorted(self.ports.keys()) 225 240 226 class FakeExpectationsParser(object):227 def __init__(self, port, *args, **kwargs):228 port.host.ports_parsed.append(port.name)229 230 241 host = MockHost() 231 242 host.ports_parsed = [] 232 host.port_factory = FakeFactory(host, (FakePort( 'a', 'path-to-a'),233 FakePort( 'b', 'path-to-b'),234 FakePort( 'b-win', 'path-to-b')))235 236 self.assertEquals(run_webkit_tests.lint(host.port_factory.ports['a'], MockOptions(platform=None) , FakeExpectationsParser), 0)243 host.port_factory = FakeFactory(host, (FakePort(host, 'a', 'path-to-a'), 244 FakePort(host, 'b', 'path-to-b'), 245 FakePort(host, 'b-win', 'path-to-b'))) 246 247 self.assertEquals(run_webkit_tests.lint(host.port_factory.ports['a'], MockOptions(platform=None)), 0) 237 248 self.assertEquals(host.ports_parsed, ['a', 'b']) 238 249 239 250 host.ports_parsed = [] 240 self.assertEquals(run_webkit_tests.lint(host.port_factory.ports['a'], MockOptions(platform='a') , FakeExpectationsParser), 0)251 self.assertEquals(run_webkit_tests.lint(host.port_factory.ports['a'], MockOptions(platform='a')), 0) 241 252 self.assertEquals(host.ports_parsed, ['a']) 242 253 -
trunk/Tools/Scripts/webkitpy/layout_tests/views/printing_unittest.py
r112140 r117805 127 127 128 128 def get_result_summary(self, test_names, expectations_str): 129 expectations = test_expectations.TestExpectations( 130 self._port, test_names, expectations_str, 131 self._port.test_configuration(), 132 is_lint_mode=False) 129 port.test_expectations = lambda: expectations_str 130 port.test_expectations_overrides = lambda: None 131 expectations = test_expectations.TestExpectations(self._port, test_names) 133 132 134 133 rs = result_summary.ResultSummary(expectations, test_names) -
trunk/Tools/Scripts/webkitpy/style/checkers/test_expectations.py
r107124 r117805 80 80 err = None 81 81 expectations = None 82 # FIXME: We need to rework how we lint strings so that we can do it independently of what a 83 # port's existing expectations are. Linting should probably just call the parser directly. 84 # For now we override the port hooks. This will also need to be reworked when expectations 85 # can cascade arbitrarily, rather than just have expectations and overrides. 86 orig_expectations = self._port_obj.test_expectations 87 orig_overrides = self._port_obj.test_expectations_overrides 82 88 try: 83 expectations = test_expectations.TestExpectations( 84 port=self._port_obj, expectations=expectations_str, tests=tests, 85 test_config=self._port_obj.test_configuration(), 86 is_lint_mode=True, overrides=overrides) 89 self._port_obj.test_expectations = lambda: expectations_str 90 self._port_obj.test_expectations_overrides = lambda: overrides 91 expectations = test_expectations.TestExpectations(self._port_obj, tests, True) 87 92 except test_expectations.ParseError, error: 88 93 err = error 94 finally: 95 self._port_obj.text_expectations = orig_expectations 96 self._port_obj.text_expectations_overrides = orig_overrides 89 97 90 98 if err: -
trunk/Tools/Scripts/webkitpy/tool/commands/queries.py
r115977 r117805 457 457 expectations_path = port.path_to_test_expectations_file() 458 458 if not expectations_path in self._expectation_models: 459 lint_mode = False 460 self._expectation_models[expectations_path] = TestExpectations(port, tests, 461 port.test_expectations(), 462 port.test_configuration(), 463 lint_mode, 464 port.test_expectations_overrides(), 465 port.skipped_layout_tests(tests)).model() 459 self._expectation_models[expectations_path] = TestExpectations(port, tests).model() 466 460 return self._expectation_models[expectations_path] 467 461 -
trunk/Tools/Scripts/webkitpy/tool/commands/rebaseline.py
r116988 r117805 122 122 def _update_expectations_file(self, builder_name, test_name): 123 123 port = self._tool.port_factory.get_from_builder_name(builder_name) 124 expectationsString = port.test_expectations() 125 expectations = TestExpectations(port, None, expectationsString, port.test_configuration()) 124 expectations = TestExpectations(port) 126 125 127 126 for test_configuration in port.all_test_configurations(): … … 240 239 241 240 def _expectations(self, port): 242 return TestExpectations(port , None, port.test_expectations(), port.test_configuration())241 return TestExpectations(port) 243 242 244 243 def _update_expectations_file(self, port_name):
Note:
See TracChangeset
for help on using the changeset viewer.