Diff
Modified: trunk/Tools/ChangeLog (160755 => 160756)
--- trunk/Tools/ChangeLog 2013-12-18 07:37:08 UTC (rev 160755)
+++ trunk/Tools/ChangeLog 2013-12-18 11:41:08 UTC (rev 160756)
@@ -1,3 +1,41 @@
+2013-12-18 Dániel Bátyai <[email protected]>
+
+ Move expectation parsing out of the constructor of TestExpectations
+ https://bugs.webkit.org/show_bug.cgi?id=125439
+
+ Reviewed by Csaba Osztrogonác.
+
+ * Scripts/webkitpy/layout_tests/controllers/layout_test_runner_unittest.py:
+ (LayoutTestRunnerTests._run_tests):
+ (LayoutTestRunnerTests.test_interrupt_if_at_failure_limits):
+ (LayoutTestRunnerTests.test_update_summary_with_result):
+ * Scripts/webkitpy/layout_tests/controllers/manager.py:
+ (Manager.run):
+ * Scripts/webkitpy/layout_tests/controllers/manager_unittest.py:
+ (ManagerTest.test_look_for_new_crash_logs):
+ * Scripts/webkitpy/layout_tests/lint_test_expectations.py:
+ (lint):
+ * Scripts/webkitpy/layout_tests/models/test_expectations.py:
+ (TestExpectations.suffixes_for_expectations):
+ (TestExpectations.__init__):
+ (TestExpectations):
+ (TestExpectations.parse_generic_expectations):
+ (TestExpectations.parse_default_port_expectations):
+ (TestExpectations.parse_override_expectations):
+ (TestExpectations.parse_all_expectations):
+ * Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py:
+ (parse_exp):
+ (SkippedTests.check):
+ (SkippedTests.test_skipped_entry_dont_exist):
+ * Scripts/webkitpy/layout_tests/models/test_run_results_unittest.py:
+ (run_results):
+ * Scripts/webkitpy/tool/commands/queries.py:
+ (PrintExpectations._model):
+ * Scripts/webkitpy/tool/commands/rebaseline.py:
+ (RebaselineTest._update_expectations_file):
+ (RebaselineExpectations._update_expectations_files):
+ (RebaselineExpectations._tests_to_rebaseline):
+
2013-12-17 Jer Noble <[email protected]>
Fix TimeRanges::intersectWith
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_runner_unittest.py (160755 => 160756)
--- trunk/Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_runner_unittest.py 2013-12-18 07:37:08 UTC (rev 160755)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_runner_unittest.py 2013-12-18 11:41:08 UTC (rev 160756)
@@ -104,6 +104,7 @@
def _run_tests(self, runner, tests):
test_inputs = [TestInput(test, 6000) for test in tests]
expectations = TestExpectations(runner._port, tests)
+ expectations.parse_all_expectations()
runner.run_tests(expectations, test_inputs, set(),
num_workers=1, needs_http=any('http' in test for test in tests), needs_websockets=any(['websocket' in test for test in tests]), retrying=False)
@@ -122,7 +123,9 @@
test_names = ['passes/text.html', 'passes/image.html']
runner._test_inputs = [TestInput(test_name, 6000) for test_name in test_names]
- run_results = TestRunResults(TestExpectations(runner._port, test_names), len(test_names))
+ expectations = TestExpectations(runner._port, test_names)
+ expectations.parse_all_expectations()
+ run_results = TestRunResults(expectations, len(test_names))
run_results.unexpected_failures = 100
run_results.unexpected_crashes = 50
run_results.unexpected_timeouts = 50
@@ -150,6 +153,7 @@
runner._options.pixel_tests = False
test = 'failures/expected/reftest.html'
expectations = TestExpectations(runner._port, tests=[test])
+ expectations.parse_all_expectations()
runner._expectations = expectations
run_results = TestRunResults(expectations, 1)
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py (160755 => 160756)
--- trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py 2013-12-18 07:37:08 UTC (rev 160755)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py 2013-12-18 11:41:08 UTC (rev 160756)
@@ -182,6 +182,7 @@
self._printer.write_update("Parsing expectations ...")
self._expectations = test_expectations.TestExpectations(self._port, test_names, force_expectations_pass=self._options.force)
+ self._expectations.parse_all_expectations()
tests_to_run, tests_to_skip = self._prepare_lists(paths, test_names)
self._printer.print_found(len(test_names), len(tests_to_run), self._options.repeat_each, self._options.iterations)
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager_unittest.py (160755 => 160756)
--- trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager_unittest.py 2013-12-18 07:37:08 UTC (rev 160755)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager_unittest.py 2013-12-18 11:41:08 UTC (rev 160756)
@@ -85,6 +85,7 @@
port = host.port_factory.get('test-mac-leopard')
tests = ['failures/expected/crash.html']
expectations = test_expectations.TestExpectations(port, tests)
+ expectations.parse_all_expectations()
run_results = TestRunResults(expectations, len(tests))
manager = get_manager()
manager._look_for_new_crash_logs(run_results, time.time())
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/lint_test_expectations.py (160755 => 160756)
--- trunk/Tools/Scripts/webkitpy/layout_tests/lint_test_expectations.py 2013-12-18 07:37:08 UTC (rev 160755)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/lint_test_expectations.py 2013-12-18 11:41:08 UTC (rev 160756)
@@ -66,8 +66,9 @@
continue
try:
- test_expectations.TestExpectations(port_to_lint,
+ expectations = test_expectations.TestExpectations(port_to_lint,
expectations_to_lint={expectations_file: expectations_dict[expectations_file]})
+ expectations.parse_all_expectations()
except test_expectations.ParseError as e:
lint_failed = True
_log.error('')
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py (160755 => 160756)
--- trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py 2013-12-18 07:37:08 UTC (rev 160755)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py 2013-12-18 11:41:08 UTC (rev 160756)
@@ -830,9 +830,6 @@
suffixes.add('wav')
return set(suffixes)
- # FIXME: This constructor does too much work. We should move the actual parsing of
- # the expectations into separate routines so that linting and handling overrides
- # can be controlled separately, and the constructor can be more of a no-op.
def __init__(self, port, tests=None, include_generic=True, include_overrides=True, expectations_to_lint=None, force_expectations_pass=False):
self._full_test_list = tests
self._test_config = port.test_configuration()
@@ -843,36 +840,45 @@
self._skipped_tests_warnings = []
self._expectations = []
self._force_expectations_pass = force_expectations_pass
+ self._include_generic = include_generic
+ self._include_overrides = include_overrides
+ self._expectations_to_lint = expectations_to_lint
- expectations_dict = expectations_to_lint or port.expectations_dict()
-
- expectations_dict_index = 0
- # Populate generic expectations (if enabled by include_generic).
- if port.path_to_generic_test_expectations_file() in expectations_dict:
- if include_generic:
- expectations = self._parser.parse(expectations_dict.keys()[expectations_dict_index], expectations_dict.values()[expectations_dict_index])
+ def parse_generic_expectations(self):
+ if self._port.path_to_generic_test_expectations_file() in self._expectations_dict:
+ if self._include_generic:
+ expectations = self._parser.parse(self._expectations_dict.keys()[self._expectations_dict_index], self._expectations_dict.values()[self._expectations_dict_index])
self._add_expectations(expectations)
self._expectations += expectations
- expectations_dict_index += 1
+ self._expectations_dict_index += 1
- # Populate default port expectations (always enabled).
- if len(expectations_dict) > expectations_dict_index:
- expectations = self._parser.parse(expectations_dict.keys()[expectations_dict_index], expectations_dict.values()[expectations_dict_index])
+ def parse_default_port_expectations(self):
+ if len(self._expectations_dict) > self._expectations_dict_index:
+ expectations = self._parser.parse(self._expectations_dict.keys()[self._expectations_dict_index], self._expectations_dict.values()[self._expectations_dict_index])
self._add_expectations(expectations)
self._expectations += expectations
- expectations_dict_index += 1
+ self._expectations_dict_index += 1
- # Populate override expectations (if enabled by include_overrides).
- while len(expectations_dict) > expectations_dict_index and include_overrides:
- expectations = self._parser.parse(expectations_dict.keys()[expectations_dict_index], expectations_dict.values()[expectations_dict_index])
+ def parse_override_expectations(self):
+ while len(self._expectations_dict) > self._expectations_dict_index and self._include_overrides:
+ expectations = self._parser.parse(self._expectations_dict.keys()[self._expectations_dict_index], self._expectations_dict.values()[self._expectations_dict_index])
self._add_expectations(expectations)
self._expectations += expectations
- expectations_dict_index += 1
+ self._expectations_dict_index += 1
+ def parse_all_expectations(self):
+ self._expectations_dict = self._expectations_to_lint or self._port.expectations_dict()
+ self._expectations_dict_index = 0
+
+ self._has_warnings = False
+
+ self.parse_generic_expectations()
+ self.parse_default_port_expectations()
+ self.parse_override_expectations()
+
# FIXME: move ignore_tests into port.skipped_layout_tests()
- self.add_skipped_tests(port.skipped_layout_tests(tests).union(set(port.get_option('ignore_tests', []))))
+ self.add_skipped_tests(self._port.skipped_layout_tests(self._full_test_list).union(set(self._port.get_option('ignore_tests', []))))
- self._has_warnings = False
self._report_warnings()
self._process_tests_without_expectations()
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py (160755 => 160756)
--- trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py 2013-12-18 07:37:08 UTC (rev 160755)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py 2013-12-18 11:41:08 UTC (rev 160756)
@@ -78,6 +78,7 @@
self._port.expectations_dict = lambda: expectations_dict
expectations_to_lint = expectations_dict if is_lint_mode else None
self._exp = TestExpectations(self._port, self.get_basic_tests(), expectations_to_lint=expectations_to_lint)
+ self._exp.parse_all_expectations()
def assert_exp(self, test, result):
self.assertEqual(self._exp.model().get_expectations(test),
@@ -251,6 +252,7 @@
port.skipped_layout_tests = lambda tests: set(skips)
expectations_to_lint = expectations_dict if lint else None
exp = TestExpectations(port, ['failures/expected/text.html'], expectations_to_lint=expectations_to_lint)
+ exp.parse_all_expectations()
# Check that the expectation is for BUG_DUMMY SKIP : ... [ Pass ]
self.assertEqual(exp.model().get_modifiers('failures/expected/text.html'),
@@ -288,6 +290,7 @@
capture = OutputCapture()
capture.capture_output()
exp = TestExpectations(port)
+ exp.parse_all_expectations()
_, _, logs = capture.restore_output()
self.assertEqual('The following test foo/bar/baz.html from the Skipped list doesn\'t exist\n', logs)
@@ -471,6 +474,7 @@
Bug(y) [ Win Mac Debug ] failures/expected/foo.html [ Crash ]
"""}
expectations = TestExpectations(test_port, self.get_basic_tests())
+ expectations.parse_all_expectations()
actual_expectations = expectations.remove_configuration_from_test('failures/expected/foo.html', test_config)
@@ -489,6 +493,7 @@
Bug(y) [ Win Debug ] failures/expected/foo.html [ Crash ]
"""}
expectations = TestExpectations(test_port)
+ expectations.parse_all_expectations()
actual_expectations = expectations.remove_configuration_from_test('failures/expected/foo.html', test_config)
actual_expectations = expectations.remove_configuration_from_test('failures/expected/foo.html', host.port_factory.get('test-win-vista', None).test_configuration())
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/models/test_run_results_unittest.py (160755 => 160756)
--- trunk/Tools/Scripts/webkitpy/layout_tests/models/test_run_results_unittest.py 2013-12-18 07:37:08 UTC (rev 160755)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/models/test_run_results_unittest.py 2013-12-18 11:41:08 UTC (rev 160756)
@@ -50,6 +50,7 @@
tests = ['passes/text.html', 'failures/expected/timeout.html', 'failures/expected/crash.html', 'failures/expected/hang.html',
'failures/expected/audio.html']
expectations = test_expectations.TestExpectations(port, tests)
+ expectations.parse_all_expectations()
return test_run_results.TestRunResults(expectations, len(tests))
Modified: trunk/Tools/Scripts/webkitpy/tool/commands/queries.py (160755 => 160756)
--- trunk/Tools/Scripts/webkitpy/tool/commands/queries.py 2013-12-18 07:37:08 UTC (rev 160755)
+++ trunk/Tools/Scripts/webkitpy/tool/commands/queries.py 2013-12-18 11:41:08 UTC (rev 160756)
@@ -524,7 +524,9 @@
def _model(self, options, port_name, tests):
port = self._tool.port_factory.get(port_name, options)
- return TestExpectations(port, tests).model()
+ expectations = TestExpectations(port, tests)
+ expectations.parse_all_expectations()
+ return expectations.model()
class PrintBaselines(Command):
Modified: trunk/Tools/Scripts/webkitpy/tool/commands/rebaseline.py (160755 => 160756)
--- trunk/Tools/Scripts/webkitpy/tool/commands/rebaseline.py 2013-12-18 07:37:08 UTC (rev 160755)
+++ trunk/Tools/Scripts/webkitpy/tool/commands/rebaseline.py 2013-12-18 11:41:08 UTC (rev 160756)
@@ -152,6 +152,7 @@
lock = self._tool.make_file_lock(path + '.lock')
lock.acquire_lock()
expectations = TestExpectations(port, include_generic=False, include_overrides=False)
+ expectations.parse_all_expectations()
for test_configuration in port.all_test_configurations():
if test_configuration.version == port.test_configuration().version:
expectationsString = expectations.remove_configuration_from_test(test_name, test_configuration)
@@ -316,6 +317,7 @@
port = self._tool.port_factory.get(port_name)
expectations = TestExpectations(port)
+ expectations.parse_all_expectations()
for path in port.expectations_dict():
if self._tool.filesystem.exists(path):
self._tool.filesystem.write_text_file(path, expectations.remove_rebaselined_tests(expectations.get_rebaselining_failures(), path))
@@ -323,6 +325,7 @@
def _tests_to_rebaseline(self, port):
tests_to_rebaseline = {}
expectations = TestExpectations(port, include_overrides=True)
+ expectations.parse_all_expectations()
for test in expectations.get_rebaselining_failures():
tests_to_rebaseline[test] = TestExpectations.suffixes_for_expectations(expectations.model().get_expectations(test))
return tests_to_rebaseline