Title: [91786] trunk/Tools
Revision
91786
Author
[email protected]
Date
2011-07-26 14:44:28 -0700 (Tue, 26 Jul 2011)

Log Message

TestConfigurationConverter should not barf on invalid specifiers.
https://bugs.webkit.org/show_bug.cgi?id=65194

Reviewed by Adam Barth.

* Scripts/webkitpy/layout_tests/models/test_configuration.py: Refactored TestConfigurationConverter.to_config_set a bit,
    made it return empty set whenever an invalid specifier is encountered.
* Scripts/webkitpy/layout_tests/models/test_configuration_unittest.py: Added corresponding tests.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (91785 => 91786)


--- trunk/Tools/ChangeLog	2011-07-26 21:42:29 UTC (rev 91785)
+++ trunk/Tools/ChangeLog	2011-07-26 21:44:28 UTC (rev 91786)
@@ -1,5 +1,16 @@
 2011-07-26  Dimitri Glazkov  <[email protected]>
 
+        TestConfigurationConverter should not barf on invalid specifiers.
+        https://bugs.webkit.org/show_bug.cgi?id=65194
+
+        Reviewed by Adam Barth.
+
+        * Scripts/webkitpy/layout_tests/models/test_configuration.py: Refactored TestConfigurationConverter.to_config_set a bit,
+            made it return empty set whenever an invalid specifier is encountered.
+        * Scripts/webkitpy/layout_tests/models/test_configuration_unittest.py: Added corresponding tests.
+
+2011-07-26  Dimitri Glazkov  <[email protected]>
+
         Introduce a way to convert between specifier lists and TestConfiguration sets.
         https://bugs.webkit.org/show_bug.cgi?id=65094
 

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/models/test_configuration.py (91785 => 91786)


--- trunk/Tools/Scripts/webkitpy/layout_tests/models/test_configuration.py	2011-07-26 21:42:29 UTC (rev 91785)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/models/test_configuration.py	2011-07-26 21:44:28 UTC (rev 91786)
@@ -128,6 +128,10 @@
                 if len(set_by_category) == 1 and category_priority(category) > specifier_priority(specifier):
                     self._junk_specifier_combinations[specifier] = set_by_category
 
+    def _expand_macros(self, specifier):
+        expanded_specifiers = self._configuration_macros.get(specifier)
+        return expanded_specifiers or [specifier]
+
     def to_config_set(self, specifier_set):
         """Convert a list of specifiers into a set of TestConfiguration instances."""
         if len(specifier_set) == 0:
@@ -135,18 +139,13 @@
 
         matching_sets = {}
 
-        def update_matching_set(specifier):
-            configurations = self._specifier_to_configuration_set[specifier]
-            category = self._specifier_to_category[specifier]
-            matching_sets.setdefault(category, set()).update(configurations)
-
         for specifier in specifier_set:
-            expanded_specifiers = self._configuration_macros.get(specifier)
-            if expanded_specifiers:
-                for expanded_specifier in expanded_specifiers:
-                    update_matching_set(expanded_specifier)
-            else:
-                update_matching_set(specifier)
+            for expanded_specifier in self._expand_macros(specifier):
+                configurations = self._specifier_to_configuration_set.get(expanded_specifier)
+                if not configurations:
+                    return set()
+                category = self._specifier_to_category[expanded_specifier]
+                matching_sets.setdefault(category, set()).update(configurations)
 
         return set.intersection(*matching_sets.values())
 

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/models/test_configuration_unittest.py (91785 => 91786)


--- trunk/Tools/Scripts/webkitpy/layout_tests/models/test_configuration_unittest.py	2011-07-26 21:42:29 UTC (rev 91785)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/models/test_configuration_unittest.py	2011-07-26 21:44:28 UTC (rev 91786)
@@ -115,6 +115,10 @@
 
         self.assertEquals(converter.to_config_set(set()), self._all_test_configurations)
 
+        self.assertEquals(converter.to_config_set(set(['foo'])), set())
+
+        self.assertEquals(converter.to_config_set(set(['xp', 'foo'])), set())
+
         configs_to_match = set([
             TestConfiguration(None, 'xp', 'x86', 'release', 'gpu'),
             TestConfiguration(None, 'xp', 'x86', 'release', 'cpu'),
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to