Title: [91877] trunk/Tools
Revision
91877
Author
[email protected]
Date
2011-07-27 15:42:34 -0700 (Wed, 27 Jul 2011)

Log Message

Allow ports to specify their own test expectation specifier macros.
https://bugs.webkit.org/show_bug.cgi?id=65291

Reviewed by Adam Barth.

* Scripts/webkitpy/layout_tests/models/test_expectations.py: Changed SpecificityCalculator to use port macros.
* Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py: Ditto.
* Scripts/webkitpy/layout_tests/port/base.py: Added configuration_specifier_macros to retrieve the macros.
* Scripts/webkitpy/layout_tests/port/chromium.py: Overrode it to return Chromium's macros.
* Scripts/webkitpy/layout_tests/port/test.py: Added test macros.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (91876 => 91877)


--- trunk/Tools/ChangeLog	2011-07-27 22:35:47 UTC (rev 91876)
+++ trunk/Tools/ChangeLog	2011-07-27 22:42:34 UTC (rev 91877)
@@ -1,5 +1,18 @@
 2011-07-27  Dimitri Glazkov  <[email protected]>
 
+        Allow ports to specify their own test expectation specifier macros.
+        https://bugs.webkit.org/show_bug.cgi?id=65291
+
+        Reviewed by Adam Barth.
+
+        * Scripts/webkitpy/layout_tests/models/test_expectations.py: Changed SpecificityCalculator to use port macros.
+        * Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py: Ditto.
+        * Scripts/webkitpy/layout_tests/port/base.py: Added configuration_specifier_macros to retrieve the macros.
+        * Scripts/webkitpy/layout_tests/port/chromium.py: Overrode it to return Chromium's macros.
+        * Scripts/webkitpy/layout_tests/port/test.py: Added test macros.
+
+2011-07-27  Dimitri Glazkov  <[email protected]>
+
         Allow TestConfigurationConverter report conversion errors.
         https://bugs.webkit.org/show_bug.cgi?id=65287
 

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


--- trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py	2011-07-27 22:35:47 UTC (rev 91876)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py	2011-07-27 22:42:34 UTC (rev 91877)
@@ -159,7 +159,7 @@
 
     def __init__(self, port, test_config, full_test_list, allow_rebaseline_modifier):
         self._port = port
-        self._specificity_calculator = SpecificityCalculator(test_config, port.all_test_configurations())
+        self._specificity_calculator = SpecificityCalculator(test_config, port)
         self._full_test_list = full_test_list
         self._allow_rebaseline_modifier = allow_rebaseline_modifier
 
@@ -818,11 +818,6 @@
     This class also detects errors in this test expectation, like unknown modifiers,
     invalid modifier combinations, and duplicate modifiers.
     """
-    MACROS = {
-        'mac': ['leopard', 'snowleopard'],
-        'win': ['xp', 'vista', 'win7'],
-        'linux': ['lucid'],
-    }
 
     # We don't include the "none" modifier because it isn't actually legal.
     REGEXES_TO_IGNORE = (['bug\w+'] +
@@ -837,12 +832,12 @@
     # 'MAC XP'. See SpecificityCalculatorTest.test_invalid_combinations() in the
     # _unittest.py file.
 
-    def __init__(self, test_config, all_test_configurations):
+    def __init__(self, test_config, port):
         """Initialize a SpecificityCalculator argument with the TestConfiguration it
         should be matched against."""
         self.test_config = test_config
-        self.allowed_configurations = all_test_configurations
-        self.macros = self.MACROS
+        self.allowed_configurations = port.all_test_configurations()
+        self.macros = port.configuration_specifier_macros()
 
         self.regexes_to_ignore = {}
         for regex_str in self.REGEXES_TO_IGNORE:

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


--- trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py	2011-07-27 22:35:47 UTC (rev 91876)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py	2011-07-27 22:42:34 UTC (rev 91877)
@@ -382,7 +382,7 @@
     def setUp(self):
         port_obj = port.get('test-win-xp', None)
         self.config = port_obj.test_configuration()
-        self.calculator = SpecificityCalculator(self.config, port_obj.all_test_configurations())
+        self.calculator = SpecificityCalculator(self.config, port_obj)
 
     def assert_specificity(self, modifiers, expected_specificity=-1, num_errors=0):
         expectation = TestExpectationLine()

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/base.py (91876 => 91877)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/base.py	2011-07-27 22:35:47 UTC (rev 91876)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/base.py	2011-07-27 22:42:34 UTC (rev 91877)
@@ -756,6 +756,18 @@
         test configurations for this port."""
         return self._generate_all_test_configurations()
 
+    # FIXME: Belongs on a Platform object.
+    def configuration_specifier_macros(self):
+        """Ports may provide a way to abbreviate configuration specifiers to conveniently
+        refer to them as one term or alias specific values to more generic ones. For example:
+
+        (xp, vista, win7) -> win # Abbreviate all Windows versions into one namesake.
+        (lucid) -> linux  # Change specific name of the Linux distro to a more generic term.
+
+        Returns a dictionary, each key representing a macro term ('win', for example),
+        and value being a list of valid configuration specifiers (such as ['xp', 'vista', 'win7'])."""
+        return {}
+
     def all_baseline_variants(self):
         """Returns a list of platform names sufficient to cover all the baselines.
 

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium.py (91876 => 91877)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium.py	2011-07-27 22:35:47 UTC (rev 91876)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium.py	2011-07-27 22:42:34 UTC (rev 91877)
@@ -79,6 +79,12 @@
         'chromium-gpu-mac-snowleopard', 'chromium-gpu-win-win7', 'chromium-gpu-linux-x86_64',
     ]
 
+    CONFIGURATION_SPECIFIER_MACROS = {
+        'mac': ['leopard', 'snowleopard'],
+        'win': ['xp', 'vista', 'win7'],
+        'linux': ['lucid'],
+    }
+
     def __init__(self, **kwargs):
         Port.__init__(self, **kwargs)
         # All sub-classes override this, but we need an initial value for testing.
@@ -266,6 +272,9 @@
             self._helper.stdin.close()
             self._helper.wait()
 
+    def configuration_specifier_macros(self):
+        return self.CONFIGURATION_SPECIFIER_MACROS
+
     def all_baseline_variants(self):
         return self.ALL_BASELINE_VARIANTS
 

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/test.py (91876 => 91877)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/test.py	2011-07-27 22:35:47 UTC (rev 91876)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/test.py	2011-07-27 22:42:34 UTC (rev 91877)
@@ -395,6 +395,10 @@
     def _all_graphics_types(self):
         return ('cpu', 'gpu')
 
+    def configuration_specifier_macros(self):
+        """To avoid surprises when introducing new macros, these are intentionally fixed in time."""
+        return {'mac': ['leopard', 'snowleopard'], 'win': ['xp', 'vista', 'win7'], 'linux': ['lucid']}
+
     def all_baseline_variants(self):
         return self.ALL_BASELINE_VARIANTS
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to