Title: [92634] trunk/Tools
Revision
92634
Author
[email protected]
Date
2011-08-08 14:28:03 -0700 (Mon, 08 Aug 2011)

Log Message

TestExpectationsEditor should return a list of updated expectations.
https://bugs.webkit.org/show_bug.cgi?id=65872

Reviewed by Adam Barth.

* Scripts/webkitpy/layout_tests/models/test_expectations.py: Added a list to store lines that are being updated.
* Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py: Changed tests to account for updated lines.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (92633 => 92634)


--- trunk/Tools/ChangeLog	2011-08-08 21:07:33 UTC (rev 92633)
+++ trunk/Tools/ChangeLog	2011-08-08 21:28:03 UTC (rev 92634)
@@ -1,3 +1,13 @@
+2011-08-08  Dimitri Glazkov  <[email protected]>
+
+        TestExpectationsEditor should return a list of updated expectations.
+        https://bugs.webkit.org/show_bug.cgi?id=65872
+
+        Reviewed by Adam Barth.
+
+        * Scripts/webkitpy/layout_tests/models/test_expectations.py: Added a list to store lines that are being updated.
+        * Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py: Changed tests to account for updated lines.
+
 2011-08-08  Jochen Eisinger  <[email protected]>
 
         Fix SCM webkitpy unit test failures

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py (92633 => 92634)


--- trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py	2011-08-08 21:07:33 UTC (rev 92633)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py	2011-08-08 21:28:03 UTC (rev 92634)
@@ -641,6 +641,7 @@
         Here, we treat updating expectations to PASS as special: if possible, the corresponding lines are completely removed.
         """
         # FIXME: Allow specifying modifiers (SLOW, SKIP, WONTFIX).
+        updated_expectations = []
         expectation_lines = self._test_to_expectation_lines.get(test, [])
         remaining_configurations = test_config_set.copy()
         bug_ids = self._get_valid_bug_ids(parsed_bug_modifiers)
@@ -649,33 +650,41 @@
             if expectation_line.matching_configurations == remaining_configurations:
                 # Tweak expectations on existing line.
                 if expectation_line.parsed_expectations == expectation_set:
-                    return
+                    return updated_expectations
                 self._bug_manager.close_bug(expectation_line.parsed_bug_modifiers, bug_ids)
+                updated_expectations.append(expectation_line)
                 if remove_expectations:
                     expectation_line.matching_configurations = set()
-                    return
-                expectation_line.parsed_expectations = expectation_set
-                expectation_line.parsed_bug_modifiers = bug_ids
-                return
+                else:
+                    expectation_line.parsed_expectations = expectation_set
+                    expectation_line.parsed_bug_modifiers = bug_ids
+                return updated_expectations
             elif expectation_line.matching_configurations >= remaining_configurations:
                 # 1) Split up into two expectation lines:
                 # * one with old expectations (existing expectation_line)
                 # * one with new expectations (new expectation_line)
                 # 2) Finish looking, since there will be no more remaining configs to test for.
                 expectation_line.matching_configurations -= remaining_configurations
+                updated_expectations.append(expectation_line)
                 break
             elif expectation_line.matching_configurations <= remaining_configurations:
                 # Remove existing expectation line.
                 self._bug_manager.close_bug(expectation_line.parsed_bug_modifiers, bug_ids)
                 expectation_line.matching_configurations = set()
+                updated_expectations.append(expectation_line)
             else:
                 intersection = expectation_line.matching_configurations & remaining_configurations
                 if intersection:
                     expectation_line.matching_configurations -= intersection
+                    updated_expectations.append(expectation_line)
 
         if not remove_expectations:
-            self._expectation_lines.append(self._create_new_line(test, bug_ids, remaining_configurations, expectation_set))
+            new_expectation_line = self._create_new_line(test, bug_ids, remaining_configurations, expectation_set)
+            updated_expectations.append(new_expectation_line)
+            self._expectation_lines.append(new_expectation_line)
 
+        return updated_expectations
+
     def _get_valid_bug_ids(self, suggested_bug_ids):
         # FIXME: Flesh out creating a bug properly (title, etc.)
         return suggested_bug_ids or [self._bug_manager.create_bug()]

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py (92633 => 92634)


--- trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py	2011-08-08 21:07:33 UTC (rev 92633)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py	2011-08-08 21:28:03 UTC (rev 92634)
@@ -633,11 +633,14 @@
         result = TestExpectationSerializer.list_to_string(expectation_lines, converter)
         self.assertEquals(result, expected_string)
 
-    def assert_update_roundtrip(self, in_string, test, expectation_set, expected_string, remove_flakes=False, parsed_bug_modifiers=None, test_configs=None):
+    def assert_update_roundtrip(self, in_string, test, expectation_set, expected_string, expected_update_count, remove_flakes=False, parsed_bug_modifiers=None, test_configs=None):
         test_config_set = test_configs or set([self.test_port.test_configuration()])
         expectation_lines = self.make_parsed_expectation_lines(in_string)
         editor = TestExpectationsEditor(expectation_lines, MockBugManager())
-        editor.update_expectation(test, test_config_set, expectation_set, parsed_bug_modifiers=parsed_bug_modifiers)
+        updated_expectation_lines = editor.update_expectation(test, test_config_set, expectation_set, parsed_bug_modifiers=parsed_bug_modifiers)
+        for updated_expectation_line in updated_expectation_lines:
+            self.assertTrue(updated_expectation_line in expectation_lines)
+        self.assertEquals(len(updated_expectation_lines), expected_update_count)
         converter = TestConfigurationConverter(self.test_port.all_test_configurations(), self.test_port.configuration_specifier_macros())
         result = TestExpectationSerializer.list_to_string(expectation_lines, converter)
         self.assertEquals(result, expected_string)
@@ -778,79 +781,79 @@
     def test_update_expectation(self):
         self.assert_update_roundtrip("""
 BUGX1 XP RELEASE CPU : failures/expected/keyboard.html = TEXT""", 'failures/expected/keyboard.html', set([IMAGE]), """
-BUG_NEWLY_CREATED XP RELEASE CPU : failures/expected/keyboard.html = IMAGE""")
+BUG_NEWLY_CREATED XP RELEASE CPU : failures/expected/keyboard.html = IMAGE""", 1)
 
         self.assert_update_roundtrip("""
-BUGX1 XP RELEASE CPU : failures/expected/keyboard.html = TEXT""", 'failures/expected/keyboard.html', set([PASS]), '')
+BUGX1 XP RELEASE CPU : failures/expected/keyboard.html = TEXT""", 'failures/expected/keyboard.html', set([PASS]), '', 1)
 
         self.assert_update_roundtrip("""
 BUGX1 XP RELEASE CPU : failures/expected = TEXT""", 'failures/expected/keyboard.html', set([IMAGE]), """
 BUGX1 XP RELEASE CPU : failures/expected = TEXT
-BUG_NEWLY_CREATED XP RELEASE CPU : failures/expected/keyboard.html = IMAGE""")
+BUG_NEWLY_CREATED XP RELEASE CPU : failures/expected/keyboard.html = IMAGE""", 1)
 
         self.assert_update_roundtrip("""
 BUGX1 XP RELEASE CPU : failures/expected = TEXT""", 'failures/expected/keyboard.html', set([PASS]), """
 BUGX1 XP RELEASE CPU : failures/expected = TEXT
-BUG_NEWLY_CREATED XP RELEASE CPU : failures/expected/keyboard.html = PASS""")
+BUG_NEWLY_CREATED XP RELEASE CPU : failures/expected/keyboard.html = PASS""", 1)
 
         self.assert_update_roundtrip("""
 BUGX1 XP RELEASE CPU : failures/expected/keyboard.html = TEXT""", 'failures/expected/keyboard.html', set([TEXT]), """
-BUGX1 XP RELEASE CPU : failures/expected/keyboard.html = TEXT""")
+BUGX1 XP RELEASE CPU : failures/expected/keyboard.html = TEXT""", 0)
 
         self.assert_update_roundtrip("""
 BUGX1 XP RELEASE CPU : failures/expected/keyboard.html = TEXT""", 'failures/expected/keyboard.html', set([IMAGE]), """
-BUGAWESOME XP RELEASE CPU : failures/expected/keyboard.html = IMAGE""", parsed_bug_modifiers=['BUGAWESOME'])
+BUGAWESOME XP RELEASE CPU : failures/expected/keyboard.html = IMAGE""", 1, parsed_bug_modifiers=['BUGAWESOME'])
 
         self.assert_update_roundtrip("""
 BUGX1 XP RELEASE : failures/expected/keyboard.html = TEXT""", 'failures/expected/keyboard.html', set([IMAGE]), """
 BUGX1 XP RELEASE GPU : failures/expected/keyboard.html = TEXT
-BUG_NEWLY_CREATED XP RELEASE CPU : failures/expected/keyboard.html = IMAGE""")
+BUG_NEWLY_CREATED XP RELEASE CPU : failures/expected/keyboard.html = IMAGE""", 2)
 
         self.assert_update_roundtrip("""
 BUGX1 XP RELEASE : failures/expected/keyboard.html = TEXT""", 'failures/expected/keyboard.html', set([PASS]), """
-BUGX1 XP RELEASE GPU : failures/expected/keyboard.html = TEXT""")
+BUGX1 XP RELEASE GPU : failures/expected/keyboard.html = TEXT""", 1)
 
         self.assert_update_roundtrip("""
 BUGX1 XP RELEASE : failures/expected/keyboard.html = TEXT""", 'failures/expected/keyboard.html', set([IMAGE]), """
 BUGX1 XP RELEASE GPU : failures/expected/keyboard.html = TEXT
-BUGAWESOME XP RELEASE CPU : failures/expected/keyboard.html = IMAGE""", parsed_bug_modifiers=['BUGAWESOME'])
+BUGAWESOME XP RELEASE CPU : failures/expected/keyboard.html = IMAGE""", 2, parsed_bug_modifiers=['BUGAWESOME'])
 
         self.assert_update_roundtrip("""
 BUGX1 WIN : failures/expected/keyboard.html = TEXT""", 'failures/expected/keyboard.html', set([IMAGE]), """
 BUGX1 XP DEBUG CPU : failures/expected/keyboard.html = TEXT
 BUGX1 XP GPU : failures/expected/keyboard.html = TEXT
 BUGX1 VISTA WIN7 : failures/expected/keyboard.html = TEXT
-BUG_NEWLY_CREATED XP RELEASE CPU : failures/expected/keyboard.html = IMAGE""")
+BUG_NEWLY_CREATED XP RELEASE CPU : failures/expected/keyboard.html = IMAGE""", 2)
 
         self.assert_update_roundtrip("""
 BUGX1 WIN : failures/expected/keyboard.html = TEXT""", 'failures/expected/keyboard.html', set([PASS]), """
 BUGX1 XP DEBUG CPU : failures/expected/keyboard.html = TEXT
 BUGX1 XP GPU : failures/expected/keyboard.html = TEXT
-BUGX1 VISTA WIN7 : failures/expected/keyboard.html = TEXT""")
+BUGX1 VISTA WIN7 : failures/expected/keyboard.html = TEXT""", 1)
 
         self.assert_update_roundtrip("""
 BUGX1 WIN : failures/expected/keyboard.html = TEXT""", 'failures/expected/keyboard.html', set([IMAGE]), """
 BUGX1 XP DEBUG CPU : failures/expected/keyboard.html = TEXT
 BUGX1 XP GPU : failures/expected/keyboard.html = TEXT
 BUGX1 VISTA WIN7 : failures/expected/keyboard.html = TEXT
-BUG_NEWLY_CREATED XP RELEASE CPU : failures/expected/keyboard.html = IMAGE""")
+BUG_NEWLY_CREATED XP RELEASE CPU : failures/expected/keyboard.html = IMAGE""", 2)
 
         self.assert_update_roundtrip("""
 BUGX1 XP RELEASE CPU: failures/expected/keyboard.html = TEXT""", 'failures/expected/keyboard.html', set([IMAGE]), """
-BUG_NEWLY_CREATED WIN RELEASE CPU : failures/expected/keyboard.html = IMAGE""", test_configs=self.WIN_RELEASE_CPU_CONFIGS)
+BUG_NEWLY_CREATED WIN RELEASE CPU : failures/expected/keyboard.html = IMAGE""", 2, test_configs=self.WIN_RELEASE_CPU_CONFIGS)
 
         self.assert_update_roundtrip("""
-BUGX1 XP RELEASE CPU: failures/expected/keyboard.html = TEXT""", 'failures/expected/keyboard.html', set([PASS]), '', test_configs=self.WIN_RELEASE_CPU_CONFIGS)
+BUGX1 XP RELEASE CPU: failures/expected/keyboard.html = TEXT""", 'failures/expected/keyboard.html', set([PASS]), '', 1, test_configs=self.WIN_RELEASE_CPU_CONFIGS)
 
         self.assert_update_roundtrip("""
 BUGX1 RELEASE CPU: failures/expected/keyboard.html = TEXT""", 'failures/expected/keyboard.html', set([IMAGE]), """
 BUGX1 LINUX MAC RELEASE CPU : failures/expected/keyboard.html = TEXT
-BUG_NEWLY_CREATED WIN RELEASE CPU : failures/expected/keyboard.html = IMAGE""", test_configs=self.WIN_RELEASE_CPU_CONFIGS)
+BUG_NEWLY_CREATED WIN RELEASE CPU : failures/expected/keyboard.html = IMAGE""", 2, test_configs=self.WIN_RELEASE_CPU_CONFIGS)
 
         self.assert_update_roundtrip("""
 BUGX1 MAC : failures/expected/keyboard.html = TEXT""", 'failures/expected/keyboard.html', set([IMAGE]), """
 BUGX1 MAC : failures/expected/keyboard.html = TEXT
-BUG_NEWLY_CREATED WIN RELEASE CPU : failures/expected/keyboard.html = IMAGE""", test_configs=self.WIN_RELEASE_CPU_CONFIGS)
+BUG_NEWLY_CREATED WIN RELEASE CPU : failures/expected/keyboard.html = IMAGE""", 1, test_configs=self.WIN_RELEASE_CPU_CONFIGS)
 
     def test_update_expectation_multiple(self):
         in_string = """
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to