Remove certain methods from TestExpectations and use TestExpectationsModel instead...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 5 Dec 2013 10:32:13 +0000 (10:32 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 5 Dec 2013 10:32:13 +0000 (10:32 +0000)
https://bugs.webkit.org/show_bug.cgi?id=125218

Patch by Dániel Bátyai <Batyai.Daniel@stud.u-szeged.hu> on 2013-12-05
Reviewed by Ryosuke Niwa.

* Scripts/webkitpy/layout_tests/controllers/layout_test_finder.py:
(LayoutTestFinder.skip_tests):
* Scripts/webkitpy/layout_tests/controllers/layout_test_runner.py:
(LayoutTestRunner.run_tests):
(LayoutTestRunner._update_summary_with_result):
* Scripts/webkitpy/layout_tests/controllers/manager.py:
(Manager._test_is_slow):
* Scripts/webkitpy/layout_tests/layout_package/json_layout_results_generator.py:
(JSONLayoutResultsGenerator._insert_failure_summaries):
* Scripts/webkitpy/layout_tests/models/test_expectations.py:
(TestExpectations.get_rebaselining_failures):
* Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py:
(assert_exp):
(MiscTests.test_multiple_results):
(MiscTests.test_category_expectations):
(MiscTests.test_get_modifiers):
(MiscTests.test_get_expectations_string):
(MiscTests.test_expectation_to_string):
(MiscTests.test_get_test_set):
(MiscTests.test_more_specific_override_resets_skip):
(SkippedTests.check):
* Scripts/webkitpy/layout_tests/models/test_run_results.py:
(TestRunResults.__init__):
(summarize_results):
* Scripts/webkitpy/tool/commands/rebaseline.py:
(RebaselineExpectations._tests_to_rebaseline):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@160165 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_finder.py
Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_runner.py
Tools/Scripts/webkitpy/layout_tests/controllers/manager.py
Tools/Scripts/webkitpy/layout_tests/layout_package/json_layout_results_generator.py
Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py
Tools/Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py
Tools/Scripts/webkitpy/layout_tests/models/test_run_results.py
Tools/Scripts/webkitpy/tool/commands/rebaseline.py

index 2fd987b..853d0e2 100644 (file)
@@ -1,3 +1,37 @@
+2013-12-05  Dániel Bátyai  <Batyai.Daniel@stud.u-szeged.hu>
+
+        Remove certain methods from TestExpectations and use TestExpectationsModel instead of them
+        https://bugs.webkit.org/show_bug.cgi?id=125218
+
+        Reviewed by Ryosuke Niwa.
+
+        * Scripts/webkitpy/layout_tests/controllers/layout_test_finder.py:
+        (LayoutTestFinder.skip_tests):
+        * Scripts/webkitpy/layout_tests/controllers/layout_test_runner.py:
+        (LayoutTestRunner.run_tests):
+        (LayoutTestRunner._update_summary_with_result):
+        * Scripts/webkitpy/layout_tests/controllers/manager.py:
+        (Manager._test_is_slow):
+        * Scripts/webkitpy/layout_tests/layout_package/json_layout_results_generator.py:
+        (JSONLayoutResultsGenerator._insert_failure_summaries):
+        * Scripts/webkitpy/layout_tests/models/test_expectations.py:
+        (TestExpectations.get_rebaselining_failures):
+        * Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py:
+        (assert_exp):
+        (MiscTests.test_multiple_results):
+        (MiscTests.test_category_expectations):
+        (MiscTests.test_get_modifiers):
+        (MiscTests.test_get_expectations_string):
+        (MiscTests.test_expectation_to_string):
+        (MiscTests.test_get_test_set):
+        (MiscTests.test_more_specific_override_resets_skip):
+        (SkippedTests.check):
+        * Scripts/webkitpy/layout_tests/models/test_run_results.py:
+        (TestRunResults.__init__):
+        (summarize_results):
+        * Scripts/webkitpy/tool/commands/rebaseline.py:
+        (RebaselineExpectations._tests_to_rebaseline):
+
 2013-12-04  Ryosuke Niwa  <rniwa@webkit.org>
 
         Enable HTMLTemplateElement by default
index 429aedd..7fffd7e 100644 (file)
@@ -96,10 +96,10 @@ class LayoutTestFinder(object):
     def skip_tests(self, paths, all_tests_list, expectations, http_tests):
         all_tests = set(all_tests_list)
 
-        tests_to_skip = expectations.get_tests_with_result_type(test_expectations.SKIP)
+        tests_to_skip = expectations.model().get_tests_with_result_type(test_expectations.SKIP)
         if self._options.skip_failing_tests:
-            tests_to_skip.update(expectations.get_tests_with_result_type(test_expectations.FAIL))
-            tests_to_skip.update(expectations.get_tests_with_result_type(test_expectations.FLAKY))
+            tests_to_skip.update(expectations.model().get_tests_with_result_type(test_expectations.FAIL))
+            tests_to_skip.update(expectations.model().get_tests_with_result_type(test_expectations.FLAKY))
 
         if self._options.skipped == 'only':
             tests_to_skip = all_tests - tests_to_skip
index 3fd40e3..dc09ead 100644 (file)
@@ -96,7 +96,7 @@ class LayoutTestRunner(object):
         self._printer.num_started = 0
 
         if not retrying:
-            self._printer.print_expected(run_results, self._expectations.get_tests_with_result_type)
+            self._printer.print_expected(run_results, self._expectations.model().get_tests_with_result_type)
 
         for test_name in set(tests_to_skip):
             result = test_results.TestResult(test_name)
@@ -188,8 +188,8 @@ class LayoutTestRunner(object):
             expected = True
         else:
             expected = self._expectations.matches_an_expected_result(result.test_name, result.type, self._options.pixel_tests or result.reftest_type)
-            exp_str = self._expectations.get_expectations_string(result.test_name)
-            got_str = self._expectations.expectation_to_string(result.type)
+            exp_str = self._expectations.model().get_expectations_string(result.test_name)
+            got_str = self._expectations.model().expectation_to_string(result.type)
 
         run_results.add(result, expected, self._test_is_slow(result.test_name))
 
index b4302c2..7370d58 100644 (file)
@@ -137,7 +137,7 @@ class Manager(object):
         return self._is_http_test(test_file) or self._is_perf_test(test_file)
 
     def _test_is_slow(self, test_file):
-        return self._expectations.has_modifier(test_file, test_expectations.SLOW)
+        return self._expectations.model().has_modifier(test_file, test_expectations.SLOW)
 
     def needs_servers(self, test_names):
         return any(self._test_requires_lock(test_name) for test_name in test_names) and self._options.http
index 715497d..51e1853 100644 (file)
@@ -132,7 +132,7 @@ class JSONLayoutResultsGenerator(json_results_generator.JSONResultsGenerator):
             self._get_failure_summary_entry(test_expectations.NOW),
             self.FIXABLE)
         self._insert_item_into_raw_list(results_for_builder,
-            len(self._expectations.get_tests_with_timeline(
+            len(self._expectations.model().get_tests_with_timeline(
                 test_expectations.NOW)), self.ALL_FIXABLE_COUNT)
         self._insert_item_into_raw_list(results_for_builder,
             self._get_failure_summary_entry(test_expectations.WONTFIX),
index 483d720..c84247d 100644 (file)
@@ -884,36 +884,6 @@ class TestExpectations(object):
     def get_rebaselining_failures(self):
         return self._model.get_test_set(REBASELINE)
 
-    # FIXME: Change the callsites to use TestExpectationsModel and remove.
-    def get_expectations(self, test):
-        return self._model.get_expectations(test)
-
-    # FIXME: Change the callsites to use TestExpectationsModel and remove.
-    def has_modifier(self, test, modifier):
-        return self._model.has_modifier(test, modifier)
-
-    # FIXME: Change the callsites to use TestExpectationsModel and remove.
-    def get_tests_with_result_type(self, result_type):
-        return self._model.get_tests_with_result_type(result_type)
-
-    # FIXME: Change the callsites to use TestExpectationsModel and remove.
-    def get_test_set(self, modifier, expectation=None, include_skips=True):
-        return self._model.get_test_set(modifier, expectation, include_skips)
-
-    # FIXME: Change the callsites to use TestExpectationsModel and remove.
-    def get_modifiers(self, test):
-        return self._model.get_modifiers(test)
-
-    # FIXME: Change the callsites to use TestExpectationsModel and remove.
-    def get_tests_with_timeline(self, timeline):
-        return self._model.get_tests_with_timeline(timeline)
-
-    def get_expectations_string(self, test):
-        return self._model.get_expectations_string(test)
-
-    def expectation_to_string(self, expectation):
-        return self._model.expectation_to_string(expectation)
-
     def matches_an_expected_result(self, test, result, pixel_tests_are_enabled):
         expected_results = self._model.get_expectations(test)
         if not pixel_tests_are_enabled:
index 821aa0f..0b1f615 100644 (file)
@@ -80,7 +80,7 @@ Bug(test) failures/expected/image.html [ WontFix Mac ]
         self._exp = TestExpectations(self._port, self.get_basic_tests(), expectations_to_lint=expectations_to_lint)
 
     def assert_exp(self, test, result):
-        self.assertEqual(self._exp.get_expectations(test),
+        self.assertEqual(self._exp.model().get_expectations(test),
                           set([result]))
 
     def assert_bad_expectations(self, expectations, overrides=None):
@@ -99,7 +99,7 @@ class BasicTests(Base):
 class MiscTests(Base):
     def test_multiple_results(self):
         self.parse_exp('Bug(x) failures/expected/text.html [ Crash Failure ]')
-        self.assertEqual(self._exp.get_expectations(
+        self.assertEqual(self._exp.model().get_expectations(
             'failures/expected/text.html'),
             set([FAIL, CRASH]))
 
@@ -137,28 +137,28 @@ class MiscTests(Base):
         self.parse_exp(exp_str)
         test_name = 'failures/expected/unknown-test.html'
         unknown_test = test_name
-        self.assertRaises(KeyError, self._exp.get_expectations,
+        self.assertRaises(KeyError, self._exp.model().get_expectations,
                           unknown_test)
         self.assert_exp('failures/expected/crash.html', PASS)
 
     def test_get_modifiers(self):
         self.parse_exp(self.get_basic_expectations())
-        self.assertEqual(self._exp.get_modifiers('passes/text.html'), [])
+        self.assertEqual(self._exp.model().get_modifiers('passes/text.html'), [])
 
     def test_get_expectations_string(self):
         self.parse_exp(self.get_basic_expectations())
-        self.assertEqual(self._exp.get_expectations_string('failures/expected/text.html'), 'FAIL')
+        self.assertEqual(self._exp.model().get_expectations_string('failures/expected/text.html'), 'FAIL')
 
     def test_expectation_to_string(self):
         # Normal cases are handled by other tests.
         self.parse_exp(self.get_basic_expectations())
-        self.assertRaises(ValueError, self._exp.expectation_to_string,
+        self.assertRaises(ValueError, self._exp.model().expectation_to_string,
                           -1)
 
     def test_get_test_set(self):
         # Handle some corner cases for this routine not covered by other tests.
         self.parse_exp(self.get_basic_expectations())
-        s = self._exp.get_test_set(WONTFIX)
+        s = self._exp.model().get_test_set(WONTFIX)
         self.assertEqual(s,
             set(['failures/expected/crash.html',
                  'failures/expected/image_checksum.html']))
@@ -236,7 +236,7 @@ class MiscTests(Base):
         self.assert_exp('failures/expected/text.html', IMAGE)
         self.assertFalse(self._port._filesystem.join(self._port.layout_tests_dir(),
                                                      'failures/expected/text.html') in
-                         self._exp.get_tests_with_result_type(SKIP))
+                         self._exp.model().get_tests_with_result_type(SKIP))
 
 
 class SkippedTests(Base):
@@ -253,9 +253,9 @@ class SkippedTests(Base):
         exp = TestExpectations(port, ['failures/expected/text.html'], expectations_to_lint=expectations_to_lint)
 
         # Check that the expectation is for BUG_DUMMY SKIP : ... [ Pass ]
-        self.assertEqual(exp.get_modifiers('failures/expected/text.html'),
+        self.assertEqual(exp.model().get_modifiers('failures/expected/text.html'),
                           [TestExpectationParser.DUMMY_BUG_MODIFIER, TestExpectationParser.SKIP_MODIFIER, TestExpectationParser.WONTFIX_MODIFIER])
-        self.assertEqual(exp.get_expectations('failures/expected/text.html'), set([PASS]))
+        self.assertEqual(exp.model().get_expectations('failures/expected/text.html'), set([PASS]))
 
     def test_skipped_tests_work(self):
         self.check(expectations='', overrides=None, skips=['failures/expected/text.html'])
index 7632364..773c26e 100644 (file)
@@ -57,7 +57,7 @@ class TestRunResults(object):
         for expectation in test_expectations.TestExpectations.EXPECTATIONS.values():
             self.tests_by_expectation[expectation] = set()
         for timeline in test_expectations.TestExpectations.TIMELINES.values():
-            self.tests_by_timeline[timeline] = expectations.get_tests_with_timeline(timeline)
+            self.tests_by_timeline[timeline] = expectations.model().get_tests_with_timeline(timeline)
         self.slow_tests = set()
         self.interrupted = False
 
@@ -154,7 +154,7 @@ def summarize_results(port_obj, expectations, initial_results, retry_results, en
         # Note that if a test crashed in the original run, we ignore
         # whether or not it crashed when we retried it (if we retried it),
         # and always consider the result not flaky.
-        expected = expectations.get_expectations_string(test_name)
+        expected = expectations.model().get_expectations_string(test_name)
         result_type = result.type
         actual = [keywords[result_type]]
 
@@ -168,7 +168,7 @@ def summarize_results(port_obj, expectations, initial_results, retry_results, en
         if result.reftest_type:
             test_dict.update(reftest_type=list(result.reftest_type))
 
-        if expectations.has_modifier(test_name, test_expectations.WONTFIX):
+        if expectations.model().has_modifier(test_name, test_expectations.WONTFIX):
             test_dict['wontfix'] = True
 
         if result_type == test_expectations.PASS:
@@ -184,7 +184,7 @@ def summarize_results(port_obj, expectations, initial_results, retry_results, en
                 num_missing += 1
         elif test_name in initial_results.unexpected_results_by_name:
             if retry_results and test_name not in retry_results.unexpected_results_by_name:
-                actual.extend(expectations.get_expectations_string(test_name).split(" "))
+                actual.extend(expectations.model().get_expectations_string(test_name).split(" "))
                 num_flaky += 1
             elif retry_results:
                 retry_result_type = retry_results.unexpected_results_by_name[test_name].type
@@ -204,7 +204,7 @@ def summarize_results(port_obj, expectations, initial_results, retry_results, en
         if include_time_and_modifiers:
             test_dict['time'] = round(1000 * result.test_run_time)
             # FIXME: Fix get_modifiers to return modifiers in new format.
-            test_dict['modifiers'] = ' '.join(expectations.get_modifiers(test_name)).replace('BUGWK', 'webkit.org/b/')
+            test_dict['modifiers'] = ' '.join(expectations.model().get_modifiers(test_name)).replace('BUGWK', 'webkit.org/b/')
 
         test_dict.update(_interpret_test_failures(result.failures))
 
index 9898673..eb91dc4 100644 (file)
@@ -324,7 +324,7 @@ class RebaselineExpectations(AbstractParallelRebaselineCommand):
         tests_to_rebaseline = {}
         expectations = TestExpectations(port, include_overrides=True)
         for test in expectations.get_rebaselining_failures():
-            tests_to_rebaseline[test] = TestExpectations.suffixes_for_expectations(expectations.get_expectations(test))
+            tests_to_rebaseline[test] = TestExpectations.suffixes_for_expectations(expectations.model().get_expectations(test))
         return tests_to_rebaseline
 
     def _add_tests_to_rebaseline_for_port(self, port_name):