Diff
Modified: trunk/Tools/ChangeLog (91638 => 91639)
--- trunk/Tools/ChangeLog 2011-07-23 18:44:55 UTC (rev 91638)
+++ trunk/Tools/ChangeLog 2011-07-23 21:16:30 UTC (rev 91639)
@@ -1,3 +1,14 @@
+2011-07-23 Dimitri Glazkov <[email protected]>
+
+ Extract TestConfiguration from base and write a few unit tests to capture current behavior.
+ https://bugs.webkit.org/show_bug.cgi?id=65066
+
+ Reviewed by Adam Barth.
+
+ * Scripts/webkitpy/layout_tests/models/test_configuration.py: Added.
+ * Scripts/webkitpy/layout_tests/models/test_configuration_unittest.py: Added.
+ * Scripts/webkitpy/layout_tests/port/base.py: Moved code to test_configuration.py
+
2011-07-23 Alok Priyadarshi <[email protected]>
Switching off acceleration for small canvas broke gpu tests
Added: trunk/Tools/Scripts/webkitpy/layout_tests/models/test_configuration.py (0 => 91639)
--- trunk/Tools/Scripts/webkitpy/layout_tests/models/test_configuration.py (rev 0)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/models/test_configuration.py 2011-07-23 21:16:30 UTC (rev 91639)
@@ -0,0 +1,83 @@
+# Copyright (C) 2011 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+# * Neither the Google name nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+"""Representation of a layout test configuration."""
+
+
+class TestConfiguration(object):
+ def __init__(self, port=None, version=None, architecture=None, build_type=None, graphics_type=None):
+ self.version = version or port.version()
+ self.architecture = architecture or port.architecture()
+ self.build_type = build_type or port.options.configuration.lower()
+ self.graphics_type = graphics_type or port.graphics_type()
+
+ def items(self):
+ return self.__dict__.items()
+
+ def keys(self):
+ return self.__dict__.keys()
+
+ def __str__(self):
+ return ("<%(version)s, %(architecture)s, %(build_type)s, %(graphics_type)s>" %
+ self.__dict__)
+
+ def __repr__(self):
+ return "TestConfig(version='%(version)s', architecture='%(architecture)s', build_type='%(build_type)s', graphics_type='%(graphics_type)s')" % self.__dict__
+
+ def values(self):
+ """Returns the configuration values of this instance as a tuple."""
+ return self.__dict__.values()
+
+ def all_test_configurations(self):
+ """Returns a sequence of the TestConfigurations the port supports."""
+ # By default, we assume we want to test every graphics type in
+ # every configuration on every system.
+ test_configurations = []
+ for version, architecture in self.all_systems():
+ for build_type in self.all_build_types():
+ for graphics_type in self.all_graphics_types():
+ test_configurations.append(TestConfiguration(
+ version=version,
+ architecture=architecture,
+ build_type=build_type,
+ graphics_type=graphics_type))
+ return test_configurations
+
+ def all_systems(self):
+ return (('leopard', 'x86'),
+ ('snowleopard', 'x86'),
+ ('xp', 'x86'),
+ ('vista', 'x86'),
+ ('win7', 'x86'),
+ ('lucid', 'x86'),
+ ('lucid', 'x86_64'))
+
+ def all_build_types(self):
+ return ('debug', 'release')
+
+ def all_graphics_types(self):
+ return ('cpu', 'gpu')
Added: trunk/Tools/Scripts/webkitpy/layout_tests/models/test_configuration_unittest.py (0 => 91639)
--- trunk/Tools/Scripts/webkitpy/layout_tests/models/test_configuration_unittest.py (rev 0)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/models/test_configuration_unittest.py 2011-07-23 21:16:30 UTC (rev 91639)
@@ -0,0 +1,72 @@
+# Copyright (C) 2011 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+# * Neither the Google name nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+import unittest
+
+from webkitpy.layout_tests import port
+from webkitpy.layout_tests.models.test_configuration import *
+
+
+class TestConfigurationTest(unittest.TestCase):
+ def test_items(self):
+ config = TestConfiguration(None, 'xp', 'x86', 'release', 'cpu')
+ result_config_dict = {}
+ for category, specifier in config.items():
+ result_config_dict[category] = specifier
+ self.assertEquals({'version': 'xp', 'architecture': 'x86', 'build_type': 'release', 'graphics_type': 'cpu'}, result_config_dict)
+
+ def test_keys(self):
+ config = TestConfiguration(None, 'xp', 'x86', 'release', 'cpu')
+ result_config_keys = []
+ for category in config.keys():
+ result_config_keys.append(category)
+ self.assertEquals(set(['graphics_type', 'version', 'architecture', 'build_type']), set(result_config_keys))
+
+ def test_str(self):
+ config = TestConfiguration(None, 'xp', 'x86', 'release', 'cpu')
+ self.assertEquals('<xp, x86, release, cpu>', str(config))
+
+ def test_repr(self):
+ config = TestConfiguration(None, 'xp', 'x86', 'release', 'cpu')
+ self.assertEquals("TestConfig(version='xp', architecture='x86', build_type='release', graphics_type='cpu')", repr(config))
+
+ def test_values(self):
+ config = TestConfiguration(None, 'xp', 'x86', 'release', 'cpu')
+ result_config_values = []
+ for value in config.values():
+ result_config_values.append(value)
+ self.assertEquals(set(['xp', 'x86', 'release', 'cpu']), set(result_config_values))
+
+ def test_port_init(self):
+ config = TestConfiguration(port.get('test-win-xp', None))
+ self.assertEquals('<xp, x86, release, cpu>', str(config))
+
+ def test_all_test_configurations(self):
+ all_configs = TestConfiguration(None, 'xp', 'x86', 'release', 'cpu').all_test_configurations()
+ for config in all_configs:
+ self.assertTrue(isinstance(config, TestConfiguration))
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/base.py (91638 => 91639)
--- trunk/Tools/Scripts/webkitpy/layout_tests/port/base.py 2011-07-23 18:44:55 UTC (rev 91638)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/base.py 2011-07-23 21:16:30 UTC (rev 91639)
@@ -54,6 +54,7 @@
from webkitpy.common.system.executive import Executive, ScriptError
from webkitpy.common.system.user import User
from webkitpy.layout_tests import read_checksum_from_png
+from webkitpy.layout_tests.models.test_configuration import TestConfiguration
from webkitpy.layout_tests.port import config as port_config
from webkitpy.layout_tests.port import http_lock
from webkitpy.layout_tests.port import test_files
@@ -945,58 +946,3 @@
"""Return the full path to the top of the baseline tree for a
given platform."""
return self._filesystem.join(self.layout_tests_dir(), 'platform', platform)
-
-
-class TestConfiguration(object):
- def __init__(self, port=None, version=None, architecture=None, build_type=None, graphics_type=None):
- self.version = version or port.version()
- self.architecture = architecture or port.architecture()
- self.build_type = build_type or port.options.configuration.lower()
- self.graphics_type = graphics_type or port.graphics_type()
-
- def items(self):
- return self.__dict__.items()
-
- def keys(self):
- return self.__dict__.keys()
-
- def __str__(self):
- return ("<%(version)s, %(architecture)s, %(build_type)s, %(graphics_type)s>" %
- self.__dict__)
-
- def __repr__(self):
- return "TestConfig(version='%(version)s', architecture='%(architecture)s', build_type='%(build_type)s', graphics_type='%(graphics_type)s')" % self.__dict__
-
- def values(self):
- """Returns the configuration values of this instance as a tuple."""
- return self.__dict__.values()
-
- def all_test_configurations(self):
- """Returns a sequence of the TestConfigurations the port supports."""
- # By default, we assume we want to test every graphics type in
- # every configuration on every system.
- test_configurations = []
- for version, architecture in self.all_systems():
- for build_type in self.all_build_types():
- for graphics_type in self.all_graphics_types():
- test_configurations.append(TestConfiguration(
- version=version,
- architecture=architecture,
- build_type=build_type,
- graphics_type=graphics_type))
- return test_configurations
-
- def all_systems(self):
- return (('leopard', 'x86'),
- ('snowleopard', 'x86'),
- ('xp', 'x86'),
- ('vista', 'x86'),
- ('win7', 'x86'),
- ('lucid', 'x86'),
- ('lucid', 'x86_64'))
-
- def all_build_types(self):
- return ('debug', 'release')
-
- def all_graphics_types(self):
- return ('cpu', 'gpu')