webkitpy: Better name-version mapping (Part 2)
authorjbedard@apple.com <jbedard@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 13 Dec 2017 19:04:04 +0000 (19:04 +0000)
committerjbedard@apple.com <jbedard@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 13 Dec 2017 19:04:04 +0000 (19:04 +0000)
https://bugs.webkit.org/show_bug.cgi?id=179621
<rdar://problem/35589585>

Reviewed by David Kilzer.

Now that we have a central mapping of version numbers to version names, this
mapping should be used to compute version names. This patch treats passes versions
as objects, only mapping them to names when strings are needed.

* Scripts/webkitpy/common/system/platforminfo.py:
(PlatformInfo.__init__): Store os_version as a version object instead of a string.
(PlatformInfo.os_version_name): Convert os_version to a string through the VersionNameMap.
* Scripts/webkitpy/common/system/platforminfo_mock.py:
(MockPlatformInfo.__init__): Store os_version as a version object.
(MockPlatformInfo.os_version_name): Mirror PlatformInfo.
* Scripts/webkitpy/common/system/platforminfo_unittest.py:
(TestPlatformInfo.test_real_code): Only Mac and Windows have defined version objects.
(TestPlatformInfo.test_os_version): Deleted, this behavior is now managed by VersionNameMap.
* Scripts/webkitpy/common/version.py:
(Version.__cmp__): Allow a version object to be compared with 'None'.
* Scripts/webkitpy/common/version_name_map.py:
(VersionNameMap.map): Check for the apple_additions VersionNameMap.
(VersionNameMap.__init__): Add a wincairo mapping, the same as the win mapping.
* Scripts/webkitpy/common/version_unittest.py:
(VersionTestCase.test_compare_versions): Test comparing a version object to 'None'.
* Scripts/webkitpy/layout_tests/models/test_configuration.py:
(TestConfiguration.__init__): Strip formatting from version name. Note that this object still
accepts a string because the version string implicitly contains the platform as well.
* Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py: Win7 should be 7SP0 as
it is in the VersionNameMap.
* Scripts/webkitpy/port/apple.py:
(ApplePort): Replace VERSION_FALLBACK_ORDER with a minimum and maximum version. This is required
because it may be the case that scripts are aware of more versions than the port actually supports.
(ApplePort.determine_full_port_name): Use the host operating system to compute the full port name.
(ApplePort._allowed_versions): Return a list of valid port versions by iterating through the
VersionNameMap.
(ApplePort._generate_all_test_configurations): Compute a list of configurations by iterating through
_allowed_versions and converting each version to a string.
(ApplePort._apple_baseline_path): Return a layout test expectation directory inside apple_additions.
(ApplePort._skipped_file_search_paths): Deleted.
(ApplePort._allowed_port_names): Deleted.
(ApplePort._future_port_name): Deleted.
* Scripts/webkitpy/port/base.py:
(Port.__init__): Replace _version string with _os_version object.
(Port.version_name): Convert version object to string.
(Port.test_configuration): Pass version string to TestConfiguration.
(Port.version): Deleted.
* Scripts/webkitpy/port/darwin_testcase.py:
(DarwinTest.assert_name): Convert an os_version_string to a version object and construct a port.
* Scripts/webkitpy/port/factory_unittest.py:
(FactoryTest.test_mac): Replace version strings with version objects.
(FactoryTest.test_win): Ditto.
* Scripts/webkitpy/port/gtk.py:
(GtkPort._generate_all_test_configurations): Replace _version with version_name().
* Scripts/webkitpy/port/ios.py:
(IOSPort.version_name): Both Simulator and device share the same version-name convention.
(IOSPort._generate_all_test_configurations): Replace _version with version_name().
(IOSPort.default_baseline_search_path): Use the internal mapping of version names to construct
apple_additions expectations.
(IOSPort._apple_additions_path): Deleted.
* Scripts/webkitpy/port/ios_device.py:
(IOSDevicePort.ios_version): Return None if no version is defined.
* Scripts/webkitpy/port/ios_device_unittest.py:
(IOSDeviceTest):
(IOSDeviceTest.test_layout_test_searchpath_with_apple_additions): Conform with the new mock
apple_additions.
(IOSDeviceTest.make_port): Deleted.
* Scripts/webkitpy/port/ios_simulator.py:
(IOSSimulatorPort._create_devices): Use Version object over list of version strings.
* Scripts/webkitpy/port/ios_simulator_unittest.py:
(IOSSimulatorTest):
(IOSSimulatorTest.make_port): Use iOS 11 as the default version for testing.
(IOSSimulatorTest.test_layout_test_searchpath_with_apple_additions): Conform with the new
mock apple_additions.
* Scripts/webkitpy/port/ios_testcase.py:
(IOSTest.make_port): Use iOS 11 as the default version for testing.
* Scripts/webkitpy/port/mac.py:
(MacPort):
(MacPort.__init__): Use Version object for _os_version.
(MacPort.default_baseline_search_path): Use the internal mapping of version names to construct
apple_additions expectations.
(MacPort.configuration_specifier_macros): Automatically construct macros based on VersionNameMap.
(MacPort._apple_additions_path): Deleted.
* Scripts/webkitpy/port/mac_unittest.py:
(MacTest): Use Version object instead of version string.
(MacTest.test_version):
* Scripts/webkitpy/port/port_testcase.py:
(bind_mock_apple_additions): Add a mock VersionNameMap to mock apple_additions.
(bind_mock_apple_additions.MockAppleAdditions):
(bind_mock_apple_additions.MockAppleAdditions.version_name_mapping):
* Scripts/webkitpy/port/test.py:
(TestPort):
(TestPort.__init__): Use VersionNameMap to compute the correct Version from a port name.
(TestPort.version_name): Mirror Port object.
(TestPort.baseline_search_path): Replace win7 with 7sp0.
(TestPort._all_systems): Ditto.
(TestPort.configuration_specifier_macros): Ditto.
* Scripts/webkitpy/port/win.py:
(WinPort):
(WinPort.__init__): Construct Version object from port name.
(WinPort.default_baseline_search_path): Use the internal mapping of version names to construct
apple_additions expectations.
(WinCairoPort):
(WinCairoPort.default_baseline_search_path): Use MIN/MAX instead of the VERSION_FALLBACK_ORDER.
(WinCairoPort._future_port_name): Deleted.
* Scripts/webkitpy/port/win_unittest.py:
(WinPortTest.test_baseline_search_path): Add new Windows versions not previously included.
(WinPortTest._assert_version): Handle expected_version as a Version object.
(WinPortTest.test_versions): Pass Version objects instead of version strings.
* Scripts/webkitpy/port/wpe.py:
(WPEPort._generate_all_test_configurations): Replace _version with version_name().
* Scripts/webkitpy/tool/commands/queries_unittest.py:
(PrintExpectationsTest.test_multiple): Replace win7 with 7sp0.
(PrintBaselinesTest.test_multiple): Ditto.
* Scripts/webkitpy/tool/commands/queues.py:
(PatchProcessingQueue._new_port_name_from_old): Use os_version_name() instead of Version object.

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

29 files changed:
Tools/ChangeLog
Tools/Scripts/webkitpy/common/system/platforminfo.py
Tools/Scripts/webkitpy/common/system/platforminfo_mock.py
Tools/Scripts/webkitpy/common/system/platforminfo_unittest.py
Tools/Scripts/webkitpy/common/version.py
Tools/Scripts/webkitpy/common/version_name_map.py
Tools/Scripts/webkitpy/common/version_unittest.py
Tools/Scripts/webkitpy/layout_tests/models/test_configuration.py
Tools/Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py
Tools/Scripts/webkitpy/port/apple.py
Tools/Scripts/webkitpy/port/base.py
Tools/Scripts/webkitpy/port/darwin_testcase.py
Tools/Scripts/webkitpy/port/factory_unittest.py
Tools/Scripts/webkitpy/port/gtk.py
Tools/Scripts/webkitpy/port/ios.py
Tools/Scripts/webkitpy/port/ios_device.py
Tools/Scripts/webkitpy/port/ios_device_unittest.py
Tools/Scripts/webkitpy/port/ios_simulator.py
Tools/Scripts/webkitpy/port/ios_simulator_unittest.py
Tools/Scripts/webkitpy/port/ios_testcase.py
Tools/Scripts/webkitpy/port/mac.py
Tools/Scripts/webkitpy/port/mac_unittest.py
Tools/Scripts/webkitpy/port/port_testcase.py
Tools/Scripts/webkitpy/port/test.py
Tools/Scripts/webkitpy/port/win.py
Tools/Scripts/webkitpy/port/win_unittest.py
Tools/Scripts/webkitpy/port/wpe.py
Tools/Scripts/webkitpy/tool/commands/queries_unittest.py
Tools/Scripts/webkitpy/tool/commands/queues.py

index c9fef6541a3f70c95c20ae3f401296162c48be55..249c37a3fc1f6512b43671f9ee69189c67aa4794 100644 (file)
@@ -1,3 +1,123 @@
+2017-12-13  Jonathan Bedard  <jbedard@apple.com>
+
+        webkitpy: Better name-version mapping (Part 2)
+        https://bugs.webkit.org/show_bug.cgi?id=179621
+        <rdar://problem/35589585>
+
+        Reviewed by David Kilzer.
+
+        Now that we have a central mapping of version numbers to version names, this
+        mapping should be used to compute version names. This patch treats passes versions
+        as objects, only mapping them to names when strings are needed.
+
+        * Scripts/webkitpy/common/system/platforminfo.py:
+        (PlatformInfo.__init__): Store os_version as a version object instead of a string.
+        (PlatformInfo.os_version_name): Convert os_version to a string through the VersionNameMap.
+        * Scripts/webkitpy/common/system/platforminfo_mock.py:
+        (MockPlatformInfo.__init__): Store os_version as a version object.
+        (MockPlatformInfo.os_version_name): Mirror PlatformInfo.
+        * Scripts/webkitpy/common/system/platforminfo_unittest.py:
+        (TestPlatformInfo.test_real_code): Only Mac and Windows have defined version objects.
+        (TestPlatformInfo.test_os_version): Deleted, this behavior is now managed by VersionNameMap.
+        * Scripts/webkitpy/common/version.py:
+        (Version.__cmp__): Allow a version object to be compared with 'None'.
+        * Scripts/webkitpy/common/version_name_map.py:
+        (VersionNameMap.map): Check for the apple_additions VersionNameMap.
+        (VersionNameMap.__init__): Add a wincairo mapping, the same as the win mapping.
+        * Scripts/webkitpy/common/version_unittest.py:
+        (VersionTestCase.test_compare_versions): Test comparing a version object to 'None'.
+        * Scripts/webkitpy/layout_tests/models/test_configuration.py:
+        (TestConfiguration.__init__): Strip formatting from version name. Note that this object still
+        accepts a string because the version string implicitly contains the platform as well.
+        * Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py: Win7 should be 7SP0 as
+        it is in the VersionNameMap.
+        * Scripts/webkitpy/port/apple.py:
+        (ApplePort): Replace VERSION_FALLBACK_ORDER with a minimum and maximum version. This is required
+        because it may be the case that scripts are aware of more versions than the port actually supports.
+        (ApplePort.determine_full_port_name): Use the host operating system to compute the full port name.
+        (ApplePort._allowed_versions): Return a list of valid port versions by iterating through the
+        VersionNameMap.
+        (ApplePort._generate_all_test_configurations): Compute a list of configurations by iterating through
+        _allowed_versions and converting each version to a string.
+        (ApplePort._apple_baseline_path): Return a layout test expectation directory inside apple_additions.
+        (ApplePort._skipped_file_search_paths): Deleted.
+        (ApplePort._allowed_port_names): Deleted.
+        (ApplePort._future_port_name): Deleted.
+        * Scripts/webkitpy/port/base.py:
+        (Port.__init__): Replace _version string with _os_version object.
+        (Port.version_name): Convert version object to string.
+        (Port.test_configuration): Pass version string to TestConfiguration.
+        (Port.version): Deleted.
+        * Scripts/webkitpy/port/darwin_testcase.py:
+        (DarwinTest.assert_name): Convert an os_version_string to a version object and construct a port.
+        * Scripts/webkitpy/port/factory_unittest.py:
+        (FactoryTest.test_mac): Replace version strings with version objects.
+        (FactoryTest.test_win): Ditto.
+        * Scripts/webkitpy/port/gtk.py:
+        (GtkPort._generate_all_test_configurations): Replace _version with version_name().
+        * Scripts/webkitpy/port/ios.py:
+        (IOSPort.version_name): Both Simulator and device share the same version-name convention.
+        (IOSPort._generate_all_test_configurations): Replace _version with version_name().
+        (IOSPort.default_baseline_search_path): Use the internal mapping of version names to construct
+        apple_additions expectations.
+        (IOSPort._apple_additions_path): Deleted.
+        * Scripts/webkitpy/port/ios_device.py:
+        (IOSDevicePort.ios_version): Return None if no version is defined.
+        * Scripts/webkitpy/port/ios_device_unittest.py:
+        (IOSDeviceTest):
+        (IOSDeviceTest.test_layout_test_searchpath_with_apple_additions): Conform with the new mock
+        apple_additions.
+        (IOSDeviceTest.make_port): Deleted.
+        * Scripts/webkitpy/port/ios_simulator.py:
+        (IOSSimulatorPort._create_devices): Use Version object over list of version strings.
+        * Scripts/webkitpy/port/ios_simulator_unittest.py:
+        (IOSSimulatorTest):
+        (IOSSimulatorTest.make_port): Use iOS 11 as the default version for testing.
+        (IOSSimulatorTest.test_layout_test_searchpath_with_apple_additions): Conform with the new
+        mock apple_additions.
+        * Scripts/webkitpy/port/ios_testcase.py:
+        (IOSTest.make_port): Use iOS 11 as the default version for testing.
+        * Scripts/webkitpy/port/mac.py:
+        (MacPort):
+        (MacPort.__init__): Use Version object for _os_version.
+        (MacPort.default_baseline_search_path): Use the internal mapping of version names to construct
+        apple_additions expectations.
+        (MacPort.configuration_specifier_macros): Automatically construct macros based on VersionNameMap.
+        (MacPort._apple_additions_path): Deleted.
+        * Scripts/webkitpy/port/mac_unittest.py:
+        (MacTest): Use Version object instead of version string.
+        (MacTest.test_version):
+        * Scripts/webkitpy/port/port_testcase.py:
+        (bind_mock_apple_additions): Add a mock VersionNameMap to mock apple_additions.
+        (bind_mock_apple_additions.MockAppleAdditions):
+        (bind_mock_apple_additions.MockAppleAdditions.version_name_mapping):
+        * Scripts/webkitpy/port/test.py:
+        (TestPort):
+        (TestPort.__init__): Use VersionNameMap to compute the correct Version from a port name.
+        (TestPort.version_name): Mirror Port object.
+        (TestPort.baseline_search_path): Replace win7 with 7sp0.
+        (TestPort._all_systems): Ditto.
+        (TestPort.configuration_specifier_macros): Ditto.
+        * Scripts/webkitpy/port/win.py:
+        (WinPort):
+        (WinPort.__init__): Construct Version object from port name.
+        (WinPort.default_baseline_search_path): Use the internal mapping of version names to construct
+        apple_additions expectations.
+        (WinCairoPort):
+        (WinCairoPort.default_baseline_search_path): Use MIN/MAX instead of the VERSION_FALLBACK_ORDER.
+        (WinCairoPort._future_port_name): Deleted.
+        * Scripts/webkitpy/port/win_unittest.py:
+        (WinPortTest.test_baseline_search_path): Add new Windows versions not previously included.
+        (WinPortTest._assert_version): Handle expected_version as a Version object.
+        (WinPortTest.test_versions): Pass Version objects instead of version strings.
+        * Scripts/webkitpy/port/wpe.py:
+        (WPEPort._generate_all_test_configurations): Replace _version with version_name().
+        * Scripts/webkitpy/tool/commands/queries_unittest.py:
+        (PrintExpectationsTest.test_multiple): Replace win7 with 7sp0.
+        (PrintBaselinesTest.test_multiple): Ditto.
+        * Scripts/webkitpy/tool/commands/queues.py:
+        (PatchProcessingQueue._new_port_name_from_old): Use os_version_name() instead of Version object.
+
 2017-12-12  Daniel Bates  <dabates@apple.com>
 
         [WK] Add modern WebKit SPI to set auto fill button type and query if the auto fill button is enabled
index 854be6623a73265232a1cf19a8ad8d2b289a980e..aca0c3b3e72edf163dfda4094e99ce322428a15e 100644 (file)
@@ -31,7 +31,7 @@ import re
 import sys
 
 from webkitpy.common.version import Version
-from webkitpy.common.version_name_map import VersionNameMap
+from webkitpy.common.version_name_map import PUBLIC_TABLE, VersionNameMap
 from webkitpy.common.system.executive import Executive
 
 
@@ -54,24 +54,17 @@ class PlatformInfo(object):
         self.os_name = self._determine_os_name(sys_module.platform)
         self.os_version = None
 
+        self._is_cygwin = sys_module.platform == 'cygwin'
+
         if self.os_name.startswith('mac'):
-            version = Version.from_string(platform_module.mac_ver()[0])
+            self.os_version = Version.from_string(platform_module.mac_ver()[0])
         elif self.os_name.startswith('win'):
-            version = self._win_version()
+            self.os_version = self._win_version()
         elif self.os_name == 'linux' or self.os_name == 'freebsd' or self.os_name == 'openbsd' or self.os_name == 'netbsd':
-            version = None
+            return
         else:
             # Most other platforms (namely iOS) return conforming version strings.
-            version = Version.from_string(platform_module.release())
-
-        self._is_cygwin = sys_module.platform == 'cygwin'
-
-        if version is None:
-            return
-
-        self.os_version = VersionNameMap.map(self).to_name(version, table='public')
-        assert self.os_version is not None
-        self.os_version = self.os_version.lower().replace(' ', '')
+            self.os_version = Version.from_string(platform_module.release())
 
     def is_mac(self):
         return self.os_name == 'mac'
@@ -110,6 +103,11 @@ class PlatformInfo(object):
         # Windows-2008ServerR2-6.1.7600
         return self._platform_module.platform()
 
+    def os_version_name(self, table=PUBLIC_TABLE):
+        if not self.os_version:
+            return None
+        return VersionNameMap.map(self).to_name(self.os_version, table=table)
+
     def total_bytes_memory(self):
         if self.is_mac():
             return long(self._executive.run_command(["sysctl", "-n", "hw.memsize"]))
index 51bf1bf04bfd250f80827b64d990885fcd829a3e..17309fb481b061f1169e99e60bfd9d874c7be9d3 100644 (file)
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 from webkitpy.common.version import Version
+from webkitpy.common.version_name_map import PUBLIC_TABLE, VersionNameMap
 
 
 class MockPlatformInfo(object):
-    def __init__(self, os_name='mac', os_version='snowleopard'):
+    def __init__(self, os_name='mac', os_version=Version.from_name('Snow Leopard')):
+        assert isinstance(os_version, Version)
         self.os_name = os_name
         self.os_version = os_version
         self.expected_xcode_simctl_list = None
@@ -60,6 +62,11 @@ class MockPlatformInfo(object):
     def display_name(self):
         return "MockPlatform 1.0"
 
+    def os_version_name(self, table=PUBLIC_TABLE):
+        if not self.os_version:
+            return None
+        return VersionNameMap.map(self).to_name(self.os_version, table=table)
+
     def total_bytes_memory(self):
         return 3 * 1024 * 1024 * 1024  # 3GB is a reasonable amount of ram to mock.
 
index 490f0bd145ba151d5cd93b80c6f8a013689693b1..15eccd52fb46cb7cad901882d0b5c7ff3251ef09 100644 (file)
@@ -77,7 +77,8 @@ class TestPlatformInfo(unittest.TestCase):
         # This test makes sure the real (unmocked) code actually works.
         info = PlatformInfo(sys, platform, Executive())
         self.assertNotEquals(info.os_name, '')
-        self.assertNotEquals(info.os_version, '')
+        if info.is_mac() or info.is_win():
+            self.assertIsNotNone(info.os_version)
         self.assertNotEquals(info.display_name(), '')
         self.assertTrue(info.is_mac() or info.is_win() or info.is_linux() or info.is_freebsd())
         self.assertIsNotNone(info.terminal_width())
@@ -132,37 +133,6 @@ class TestPlatformInfo(unittest.TestCase):
 
         self.assertRaises(AssertionError, self.make_info, fake_sys('vms'))
 
-    def test_os_version(self):
-        self.assertRaises(AssertionError, self.make_info, fake_sys('darwin'), fake_platform('10.4.3'))
-        self.assertEqual(self.make_info(fake_sys('darwin'), fake_platform('10.5.1')).os_version, 'leopard')
-        self.assertEqual(self.make_info(fake_sys('darwin'), fake_platform('10.6.1')).os_version, 'snowleopard')
-        self.assertEqual(self.make_info(fake_sys('darwin'), fake_platform('10.7.1')).os_version, 'lion')
-        self.assertEqual(self.make_info(fake_sys('darwin'), fake_platform('10.8.1')).os_version, 'mountainlion')
-        self.assertEqual(self.make_info(fake_sys('darwin'), fake_platform('10.9.0')).os_version, 'mavericks')
-        self.assertEqual(self.make_info(fake_sys('darwin'), fake_platform('10.10.0')).os_version, 'yosemite')
-        self.assertEqual(self.make_info(fake_sys('darwin'), fake_platform('10.11.0')).os_version, 'elcapitan')
-        self.assertEqual(self.make_info(fake_sys('darwin'), fake_platform('10.12.0')).os_version, 'sierra')
-        self.assertEqual(self.make_info(fake_sys('darwin'), fake_platform('10.13.0')).os_version, 'highsierra')
-        self.assertEqual(self.make_info(fake_sys('darwin'), fake_platform('10.14.0')).os_version, 'future')
-
-        self.assertEqual(self.make_info(fake_sys('linux2'), fake_platform('', '10.4')).os_version, None)
-
-        self.assertEqual(self.make_info(fake_sys('freebsd8'), fake_platform('', '8.3-PRERELEASE')).os_version, None)
-        self.assertEqual(self.make_info(fake_sys('freebsd9'), fake_platform('', '9.0-RELEASE')).os_version, None)
-
-        self.assertRaises(AssertionError, self.make_info, fake_sys('win32'), fake_platform(win_version_string='5.0.1234'))
-        self.assertEqual(self.make_info(fake_sys('win32'), fake_platform(win_version_string='10.0.14393')).os_version, 'win10')
-        self.assertEqual(self.make_info(fake_sys('win32'), fake_platform(win_version_string='6.2.1234')).os_version, '8')
-        self.assertEqual(self.make_info(fake_sys('win32'), fake_platform(win_version_string='6.1.7600')).os_version, '7sp0')
-        self.assertEqual(self.make_info(fake_sys('win32'), fake_platform(win_version_string='6.0.1234')).os_version, 'vista')
-        self.assertEqual(self.make_info(fake_sys('win32'), fake_platform(win_version_string='5.1.1234')).os_version, 'xp')
-
-        self.assertRaises(AssertionError, self.make_info, fake_sys('win32'), executive=fake_executive('5.0.1234'))
-        self.assertEqual(self.make_info(fake_sys('cygwin'), executive=fake_executive('6.2.1234')).os_version, '8')
-        self.assertEqual(self.make_info(fake_sys('cygwin'), executive=fake_executive('6.1.7600')).os_version, '7sp0')
-        self.assertEqual(self.make_info(fake_sys('cygwin'), executive=fake_executive('6.0.1234')).os_version, 'vista')
-        self.assertEqual(self.make_info(fake_sys('cygwin'), executive=fake_executive('5.1.1234')).os_version, 'xp')
-
     def test_display_name(self):
         info = self.make_info(fake_sys('darwin'))
         self.assertNotEquals(info.display_name(), '')
index a6dc0da4e89fa6c2a661d78f2485122606b1c597..882966190968fbb349c35530e1b7f9bdc5e15ad6 100644 (file)
@@ -37,6 +37,11 @@ class Version(object):
             result[i] = int(val[i])
         return result
 
+    @staticmethod
+    def from_name(name):
+        from version_name_map import VersionNameMap
+        return VersionNameMap.map().from_name(name)[1]
+
     def __init__(self, major=0, minor=0, tiny=0, micro=0, nano=0):
         self.major = int(major)
         self.minor = int(minor)
@@ -111,6 +116,8 @@ class Version(object):
         return result
 
     def __cmp__(self, other):
+        if other is None:
+            return 1
         for i in xrange(len(self)):
             if cmp(self[i], other[i]):
                 return cmp(self[i], other[i])
index 6a62125ec1c57be785885bb52e5b6e426ba1cbbb..48ea129d3cc4ea86b4bff1098c0bc3c001a6c845 100644 (file)
@@ -35,6 +35,9 @@ class VersionNameMap(object):
     @staticmethod
     @memoized
     def map(platform=None):
+        from webkitpy.port.config import apple_additions
+        if apple_additions():
+            return apple_additions().version_name_mapping(platform)
         return VersionNameMap(platform=platform)
 
     def __init__(self, platform=None):
@@ -72,6 +75,9 @@ class VersionNameMap(object):
             'linux': {},
         }
 
+        # wincairo uses the same versions as Windows
+        self.mapping[PUBLIC_TABLE]['wincairo'] = self.mapping[PUBLIC_TABLE]['win']
+
     @classmethod
     def _automap_to_major_version(cls, prefix, minimum=Version(1), maximum=Version(1)):
         result = {}
index e9efdffa970514d0ea8a7ef1f544558198f0f216..f9b286419d019c21255a6238b7152737dc155dc3 100644 (file)
@@ -130,3 +130,4 @@ class VersionTestCase(unittest.TestCase):
         self.assertGreater(Version(1, 2, 4), Version(1, 2, 3))
         self.assertGreater(Version(1, 3, 2), Version(1, 2, 3))
         self.assertGreater(Version(2, 1, 1), Version(1, 2, 3))
+        self.assertNotEqual(Version(1, 2, 3), None)
index f70aa180e417b982e4b14d897be66ae4b75311b8..e04ab12295199d56a9293f3feb677947a07172d9 100644 (file)
@@ -31,7 +31,7 @@ import itertools
 
 class TestConfiguration(object):
     def __init__(self, version, architecture, build_type):
-        self.version = version
+        self.version = version.lower().replace(' ', '') if version is not None else ''
         self.architecture = architecture
         self.build_type = build_type
 
index e1050f0d8fc5e0a22fd904a26007100d1a2558d7..07595d27a07af544db38fbfb5f2f9c42c9693357 100644 (file)
@@ -474,7 +474,7 @@ Bug(y) [ Win Mac Debug ] failures/expected/foo.html [ Crash ]
 
         actual_expectations = expectations.remove_configuration_from_test('failures/expected/foo.html', test_config)
 
-        self.assertEqual("""Bug(x) [ Linux Vista Win7 Release ] failures/expected/foo.html [ Failure ]
+        self.assertEqual("""Bug(x) [ 7SP0 Linux Vista Release ] failures/expected/foo.html [ Failure ]
 Bug(y) [ Win Mac Debug ] failures/expected/foo.html [ Crash ]
 """, actual_expectations)
 
@@ -493,7 +493,7 @@ Bug(y) [ Win Debug ] failures/expected/foo.html [ Crash ]
 
         actual_expectations = expectations.remove_configuration_from_test('failures/expected/foo.html', test_config)
         actual_expectations = expectations.remove_configuration_from_test('failures/expected/foo.html', host.port_factory.get('test-win-vista', None).test_configuration())
-        actual_expectations = expectations.remove_configuration_from_test('failures/expected/foo.html', host.port_factory.get('test-win-win7', None).test_configuration())
+        actual_expectations = expectations.remove_configuration_from_test('failures/expected/foo.html', host.port_factory.get('test-win-7sp0', None).test_configuration())
 
         self.assertEqual("""Bug(y) [ Win Debug ] failures/expected/foo.html [ Crash ]
 """, actual_expectations)
index 18007f538b29a83c946689ebb3ac8cb8a6196be3..d7a9de722725ea998a324fad08937f3cb599c0dd 100644 (file)
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 import logging
-import os
 
-from webkitpy.common.system.executive import ScriptError
+from webkitpy.common.memoized import memoized
+from webkitpy.common.version_name_map import VersionNameMap
 from webkitpy.port.base import Port
+from webkitpy.port.config import apple_additions
 from webkitpy.layout_tests.models.test_configuration import TestConfiguration
 
 
@@ -40,19 +41,9 @@ _log = logging.getLogger(__name__)
 class ApplePort(Port):
     """Shared logic between all of Apple's ports."""
 
-    # This is used to represent the version of an operating system
-    # corresponding to the "mac" or "win" base LayoutTests/platform
-    # directory.  I'm not sure this concept is very useful,
-    # but it gives us a way to refer to fallback paths *only* including
-    # the base directory.
-    # This is mostly done because TestConfiguration assumes that self.version()
-    # will never return None. (None would be another way to represent this concept.)
-    # Apple supposedly has explicit "future" results which are kept in an internal repository.
-    # It's possible that Apple would want to fix this code to work better with those results.
-    FUTURE_VERSION = 'future'  # FIXME: This whole 'future' thing feels like a hack.
-
     # overridden in subclasses
-    VERSION_FALLBACK_ORDER = []
+    VERSION_MIN = None
+    VERSION_MAX = None
     ARCHITECTURES = []
     _crash_logs_to_skip_for_host = {}
 
@@ -71,9 +62,9 @@ class ApplePort(Port):
             # being run, so this won't work if you're not on mac or win (respectively).
             # If you're not on the o/s in question, you must specify a full version or -future (cf. above).
             if port_name == cls.port_name and not getattr(options, 'webkit_test_runner', False):
-                port_name = cls.port_name + '-' + host.platform.os_version
+                port_name = cls.port_name + '-' + host.platform.os_version_name().lower().replace(' ', '')
             else:
-                port_name = cls.port_name + '-' + host.platform.os_version + '-wk2'
+                port_name = cls.port_name + '-' + host.platform.os_version_name().lower().replace(' ', '') + '-wk2'
         elif getattr(options, 'webkit_test_runner', False) and  '-wk2' not in port_name:
             port_name += '-wk2'
 
@@ -103,31 +94,30 @@ class ApplePort(Port):
     def should_retry_crashes(self):
         return True
 
-    def _skipped_file_search_paths(self):
-        # We don't have a dedicated Skipped file for the most recent version of the port;
-        # we just use the one in platform/{mac,win}
-        most_recent_name = self.VERSION_FALLBACK_ORDER[-1]
-        return set(filter(lambda name: name != most_recent_name, super(ApplePort, self)._skipped_file_search_paths()))
-
     # FIXME: A more sophisticated version of this function should move to WebKitPort and replace all calls to name().
     # This is also a misleading name, since 'mac-future' gets remapped to 'mac'.
     def _port_name_with_version(self):
         return self.name().replace('-future', '').replace('-wk2', '')
 
-    def _allowed_port_names(self):
-        return self.VERSION_FALLBACK_ORDER + [self._future_port_name()]
-
-    def _future_port_name(self):
-        return self.operating_system() + "-" + self.FUTURE_VERSION
+    @memoized
+    def _allowed_versions(self):
+        if self.VERSION_MIN is None or self.VERSION_MAX is None:
+            return []
+        sorted_versions = sorted(VersionNameMap.map(self.host.platform).mapping_for_platform(platform=self.port_name.split('-')[0]).values())
+        return sorted_versions[sorted_versions.index(self.VERSION_MIN):sorted_versions.index(self.VERSION_MAX) + 1]
 
     def _generate_all_test_configurations(self):
         configurations = []
-        for port_name in self._allowed_port_names():
+        for version in self._allowed_versions():
             for build_type in self.ALL_BUILD_TYPES:
                 for architecture in self.ARCHITECTURES:
-                    configurations.append(TestConfiguration(version=self._strip_port_name_prefix(port_name), architecture=architecture, build_type=build_type))
+                    version_name = VersionNameMap.map(self.host.platform).to_name(version, platform=self.port_name.split('-')[0])
+                    configurations.append(TestConfiguration(version=version_name, architecture=architecture, build_type=build_type))
         return configurations
 
+    def _apple_baseline_path(self, platform):
+        return self._filesystem.join(apple_additions().layout_tests_path(), platform)
+
     def _path_to_helper(self):
         binary_name = 'LayoutTestHelper'
         return self._build_path(binary_name)
index 3952c1559653235c769de764e81603110b15c593..e4b881200b9874efcd976d949d619522c003bcff 100644 (file)
@@ -49,6 +49,7 @@ from webkitpy.common.memoized import memoized
 from webkitpy.common.prettypatch import PrettyPatch
 from webkitpy.common.system import path
 from webkitpy.common.system.executive import ScriptError
+from webkitpy.common.version_name_map import PUBLIC_TABLE, VersionNameMap
 from webkitpy.common.wavediff import WaveDiff
 from webkitpy.common.webkit_finder import WebKitFinder
 from webkitpy.layout_tests.models.test_configuration import TestConfiguration
@@ -99,7 +100,7 @@ class Port(object):
         self._name = port_name
 
         # These are default values that should be overridden in a subclasses.
-        self._version = ''
+        self._os_version = None
 
         # FIXME: This can be removed once default architectures for GTK and EFL EWS bots are set.
         self.did_override_architecture = False
@@ -764,13 +765,16 @@ class Port(object):
         # Subclasses should override this default implementation.
         return 'mac'
 
-    def version(self):
+    @memoized
+    def version_name(self):
         """Returns a string indicating the version of a given platform, e.g.
         'leopard' or 'xp'.
 
         This is used to help identify the exact port when parsing test
         expectations, determining search paths, and logging information."""
-        return self._version
+        if self._os_version is None:
+            return None
+        return VersionNameMap.map(self.host.platform).to_name(self._os_version, table=PUBLIC_TABLE)
 
     def get_option(self, name, default_value=None):
         return getattr(self._options, name, default_value)
@@ -1072,7 +1076,7 @@ class Port(object):
     def test_configuration(self):
         """Returns the current TestConfiguration for the port."""
         if not self._test_configuration:
-            self._test_configuration = TestConfiguration(self._version, self.architecture(), self._options.configuration.lower())
+            self._test_configuration = TestConfiguration(self.version_name(), self.architecture(), self._options.configuration.lower())
         return self._test_configuration
 
     # FIXME: Belongs on a Platform object.
index a3ee00618056ab69b2fe16826c0514fd627751b4..bcb3469f7c8c1f5b967214d25d342fee9b24add7 100644 (file)
@@ -28,6 +28,7 @@ from webkitpy.tool.mocktool import MockOptions
 from webkitpy.common.system.filesystem_mock import MockFileSystem
 from webkitpy.common.system.executive_mock import MockExecutive, MockExecutive2, MockProcess, ScriptError
 from webkitpy.common.system.systemhost_mock import MockSystemHost
+from webkitpy.common.version_name_map import VersionNameMap
 
 
 class DarwinTest(port_testcase.PortTestCase):
@@ -41,7 +42,7 @@ class DarwinTest(port_testcase.PortTestCase):
         self.assertEqual(self.make_port(options=MockOptions(guard_malloc=True)).default_timeout_ms(), 350000)
 
     def assert_name(self, port_name, os_version_string, expected):
-        host = MockSystemHost(os_name=self.os_name, os_version=os_version_string)
+        host = MockSystemHost(os_name=self.os_name, os_version=VersionNameMap.map().from_name(os_version_string)[1])
         port = self.make_port(host=host, port_name=port_name)
         self.assertEqual(expected, port.name())
 
index 651f5313eef815429e55ebce414f4e2e8e277242..d4f47801110e83796c03d856e989f93b9c78a618 100644 (file)
@@ -31,11 +31,11 @@ import unittest
 
 from webkitpy.tool.mocktool import MockOptions
 from webkitpy.common.system.systemhost_mock import MockSystemHost
+from webkitpy.common.version import Version
 
 from webkitpy.port import factory
 from webkitpy.port import gtk
 from webkitpy.port import mac
-from webkitpy.port import test
 from webkitpy.port import win
 
 
@@ -55,15 +55,15 @@ class FactoryTest(unittest.TestCase):
     def test_mac(self):
         self.assert_port(port_name='mac-lion', cls=mac.MacPort)
         self.assert_port(port_name='mac-lion-wk2', cls=mac.MacPort)
-        self.assert_port(port_name='mac', os_name='mac', os_version='lion', cls=mac.MacPort)
-        self.assert_port(port_name=None,  os_name='mac', os_version='lion', cls=mac.MacPort)
+        self.assert_port(port_name='mac', os_name='mac', os_version=Version.from_name('Lion'), cls=mac.MacPort)
+        self.assert_port(port_name=None,  os_name='mac', os_version=Version.from_name('Lion'), cls=mac.MacPort)
 
     def test_win(self):
         self.assert_port(port_name='win-xp', cls=win.WinPort)
         self.assert_port(port_name='win-xp-wk2', cls=win.WinPort)
-        self.assert_port(port_name='win', os_name='win', os_version='xp', cls=win.WinPort)
-        self.assert_port(port_name=None, os_name='win', os_version='xp', cls=win.WinPort)
-        self.assert_port(port_name=None, os_name='win', os_version='xp', options=self.webkit_options, cls=win.WinPort)
+        self.assert_port(port_name='win', os_name='win', os_version=Version.from_name('XP'), cls=win.WinPort)
+        self.assert_port(port_name=None, os_name='win', os_version=Version.from_name('XP'), cls=win.WinPort)
+        self.assert_port(port_name=None, os_name='win', os_version=Version.from_name('XP'), options=self.webkit_options, cls=win.WinPort)
 
     def test_gtk(self):
         self.assert_port(port_name='gtk', cls=gtk.GtkPort)
index 0123105e6965e3dfd402dd6e03b3f7b215ce1d32..fc7bef33972c419dc3b779ca63cd5612c3d95630 100644 (file)
@@ -168,7 +168,7 @@ class GtkPort(Port):
     def _generate_all_test_configurations(self):
         configurations = []
         for build_type in self.ALL_BUILD_TYPES:
-            configurations.append(TestConfiguration(version=self._version, architecture='x86', build_type=build_type))
+            configurations.append(TestConfiguration(version=self.version_name(), architecture='x86', build_type=build_type))
         return configurations
 
     def _path_to_driver(self):
index 03a583b67307e09c3edcb0e98c14ab1aa7338e9b..8d17ccdb36c2890dfab70d41c984773c538630b6 100644 (file)
@@ -25,6 +25,7 @@ import traceback
 
 from webkitpy.common.memoized import memoized
 from webkitpy.common.version import Version
+from webkitpy.common.version_name_map import VersionNameMap
 from webkitpy.layout_tests.models.test_configuration import TestConfiguration
 from webkitpy.port.config import apple_additions
 from webkitpy.port.darwin import DarwinPort
@@ -36,6 +37,9 @@ _log = logging.getLogger(__name__)
 class IOSPort(DarwinPort):
     port_name = "ios"
 
+    VERSION_MIN = Version(11)
+    VERSION_MAX = Version(12)
+
     def __init__(self, host, port_name, **kwargs):
         super(IOSPort, self).__init__(host, port_name, **kwargs)
         self._test_runner_process_constructor = SimulatorProcess
@@ -45,6 +49,11 @@ class IOSPort(DarwinPort):
     def _device_for_worker_number_map(self):
         raise NotImplementedError
 
+    def version_name(self):
+        if self._os_version is None:
+            return None
+        return VersionNameMap.map(self.host.platform).to_name(self._os_version, platform=IOSPort.port_name)
+
     def driver_cmd_line_for_logging(self):
         # Avoid creating/connecting to devices just for logging the commandline.
         self._printing_cmd_line = True
@@ -63,7 +72,7 @@ class IOSPort(DarwinPort):
         configurations = []
         for build_type in self.ALL_BUILD_TYPES:
             for architecture in self.ARCHITECTURES:
-                configurations.append(TestConfiguration(version=self._version, architecture=architecture, build_type=build_type))
+                configurations.append(TestConfiguration(version=self.version_name(), architecture=architecture, build_type=build_type))
         return configurations
 
     @memoized
@@ -88,22 +97,6 @@ class IOSPort(DarwinPort):
             return self._testing_device(worker_number)
         return self._current_device
 
-    def _apple_additions_path(self, name):
-        if name == 'wk2':
-            return None
-        split_name = name.split('-')
-        os_index = -1
-        for i in xrange(2):
-            if split_name[os_index] == 'wk1' or split_name[os_index] == 'wk2' or split_name[os_index] == 'simulator' or split_name[os_index] == 'device':
-                os_index -= 1
-        if split_name[os_index] != split_name[0]:
-            os_name = apple_additions().ios_os_name(split_name[os_index])
-            if not os_name:
-                return None
-            split_name[os_index] = os_name
-        name = '-'.join(split_name)
-        return self._filesystem.join(apple_additions().layout_tests_path(), name)
-
     @memoized
     def default_baseline_search_path(self):
         wk_string = 'wk1'
@@ -111,30 +104,42 @@ class IOSPort(DarwinPort):
             wk_string = 'wk2'
         # If we don't have a specified version, that means we using the port without an SDK.
         # This usually means we're doing some type of testing.In this case, don't add version fallbacks
-        fallback_names = []
+        expectations = []
+        if apple_additions() and self.ios_version():
+            apple_name = VersionNameMap.map(self.host.platform).to_name(self.ios_version(), platform=IOSPort.port_name, table='internal').lower().replace(' ', '')
+        else:
+            apple_name = None
         if self.ios_version():
-            fallback_names.append('{}-{}-{}'.format(self.port_name, self.ios_version().major, wk_string))
-            fallback_names.append('{}-{}'.format(self.port_name, self.ios_version().major))
-        fallback_names.append('{}-{}'.format(self.port_name, wk_string))
-        fallback_names.append(self.port_name)
+            if apple_name:
+                expectations.append(self._apple_baseline_path('{}-{}-{}'.format(self.port_name, apple_name, wk_string)))
+            expectations.append(self._webkit_baseline_path('{}-{}-{}'.format(self.port_name, self.ios_version().major, wk_string)))
+            if apple_name:
+                expectations.append(self._apple_baseline_path('{}-{}'.format(self.port_name, apple_name)))
+            expectations.append(self._webkit_baseline_path('{}-{}'.format(self.port_name, self.ios_version().major)))
+
+        if apple_additions():
+            expectations.append(self._apple_baseline_path('{}-{}'.format(self.port_name, wk_string)))
+        expectations.append(self._webkit_baseline_path('{}-{}'.format(self.port_name, wk_string)))
+        if apple_additions():
+            expectations.append(self._apple_baseline_path(self.port_name))
+        expectations.append(self._webkit_baseline_path(self.port_name))
+
         if self.ios_version():
-            fallback_names.append('{}-{}'.format(IOSPort.port_name, self.ios_version().major))
-        fallback_names.append('{}-{}'.format(IOSPort.port_name, wk_string))
-        fallback_names.append(IOSPort.port_name)
+            if apple_name:
+                expectations.append(self._apple_baseline_path('{}-{}'.format(IOSPort.port_name, apple_name)))
+            expectations.append(self._webkit_baseline_path('{}-{}'.format(IOSPort.port_name, self.ios_version().major)))
+
+        if apple_additions():
+            expectations.append(self._apple_baseline_path('{}-{}'.format(IOSPort.port_name, wk_string)))
+        expectations.append(self._webkit_baseline_path('{}-{}'.format(IOSPort.port_name, wk_string)))
+        if apple_additions():
+            expectations.append(self._apple_baseline_path(IOSPort.port_name))
+        expectations.append(self._webkit_baseline_path(IOSPort.port_name))
 
         if self.get_option('webkit_test_runner'):
-            fallback_names.append('wk2')
-
-        webkit_expectations = map(self._webkit_baseline_path, fallback_names)
-        if apple_additions() and getattr(apple_additions(), "layout_tests_path", None):
-            apple_expectations = map(self._apple_additions_path, fallback_names)
-            result = []
-            for i in xrange(len(webkit_expectations)):
-                if apple_expectations[i]:
-                    result.append(apple_expectations[i])
-                result.append(webkit_expectations[i])
-            return result
-        return webkit_expectations
+            expectations.append(self._webkit_baseline_path('wk2'))
+
+        return expectations
 
     def test_expectations_file_position(self):
         return 4
index fc1c91d5134de66b2c849b8e03d6f0d2037cbb20..9bce2f8d8a13c4aee0ec373a14020dd05a59d1d5 100644 (file)
@@ -109,9 +109,7 @@ class IOSDevicePort(IOSPort):
             else:
                 if device.platform.os_version != version:
                     raise RuntimeError('Multiple connected devices have different iOS versions')
-        if version:
-            return VersionNameMap.map(self.host.platform).from_name(version)[1]
-        return None
+        return version
 
     # FIXME: These need device implementations <rdar://problem/30497991>.
     def check_for_leaks(self, process_name, process_pid):
index 48225cf790e3150e10ccc9f47e1f511f8d683c96..69d49523280239748a9c2b40317c524c8990e44b 100644 (file)
@@ -31,15 +31,10 @@ from webkitpy.port import port_testcase
 
 class IOSDeviceTest(ios_testcase.IOSTest):
     os_name = 'ios'
-    os_version = ''
+    os_version = None
     port_name = 'ios-device'
     port_maker = IOSDevicePort
 
-    def make_port(self, host=None, port_name=None, options=None, os_name=None, os_version=None, **kwargs):
-        port = super(IOSDeviceTest, self).make_port(host=host, port_name=port_name, options=options, os_name=os_name, s_version=os_version, kwargs=kwargs)
-        port.set_option('version', '11.0')
-        return port
-
     def test_operating_system(self):
         self.assertEqual('ios-device', self.make_port().operating_system())
 
@@ -93,15 +88,15 @@ class IOSDeviceTest(ios_testcase.IOSTest):
     def test_layout_test_searchpath_with_apple_additions(self):
         with port_testcase.bind_mock_apple_additions():
             search_path = self.make_port().default_baseline_search_path()
-        self.assertEqual(search_path[0], '/additional_testing_path/ios-device-add-11-wk1')
+        self.assertEqual(search_path[0], '/additional_testing_path/ios-device-add-ios11-wk1')
         self.assertEqual(search_path[1], '/mock-checkout/LayoutTests/platform/ios-device-11-wk1')
-        self.assertEqual(search_path[2], '/additional_testing_path/ios-device-add-11')
+        self.assertEqual(search_path[2], '/additional_testing_path/ios-device-add-ios11')
         self.assertEqual(search_path[3], '/mock-checkout/LayoutTests/platform/ios-device-11')
         self.assertEqual(search_path[4], '/additional_testing_path/ios-device-wk1')
         self.assertEqual(search_path[5], '/mock-checkout/LayoutTests/platform/ios-device-wk1')
         self.assertEqual(search_path[6], '/additional_testing_path/ios-device')
         self.assertEqual(search_path[7], '/mock-checkout/LayoutTests/platform/ios-device')
-        self.assertEqual(search_path[8], '/additional_testing_path/ios-add-11')
+        self.assertEqual(search_path[8], '/additional_testing_path/ios-add-ios11')
         self.assertEqual(search_path[9], '/mock-checkout/LayoutTests/platform/ios-11')
         self.assertEqual(search_path[10], '/additional_testing_path/ios-wk1')
         self.assertEqual(search_path[11], '/mock-checkout/LayoutTests/platform/ios-wk1')
index 14a1f12e7348ba0f25ccdfc1b22a7b5cbdeb80f5..a783fcd7d79846a67c46c23b2996cbe295fd1f2a 100644 (file)
@@ -246,7 +246,7 @@ class IOSSimulatorPort(IOSPort):
             else:
                 self._executive.run_command(['xcrun', 'simctl', 'boot', device_udid])
 
-            if mac_os_version in ['elcapitan', 'yosemite', 'mavericks']:
+            if mac_os_version < Version.from_name('Sierra'):
                 time.sleep(2.5)
 
         if not self.use_multiple_simulator_apps():
index 2d9c52542c4921e5d3a447ef7265c82cc9a1c827..86cd35c38c4b6356f0d7b1a377f88f55a495d166 100644 (file)
 # 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 time
-
 from webkitpy.port.ios_simulator import IOSSimulatorPort
 from webkitpy.port import ios_testcase
 from webkitpy.port import port_testcase
 from webkitpy.common.system.outputcapture import OutputCapture
+from webkitpy.common.version import Version
 from webkitpy.tool.mocktool import MockOptions
 from webkitpy.common.system.executive_mock import MockExecutive2, ScriptError
 
@@ -33,12 +32,12 @@ from webkitpy.common.system.executive_mock import MockExecutive2, ScriptError
 class IOSSimulatorTest(ios_testcase.IOSTest):
     # FIXME: https://bugs.webkit.org/show_bug.cgi?id=173107
     os_name = 'mac'
-    os_version = ''
+    os_version = None
     port_name = 'ios-simulator'
     port_maker = IOSSimulatorPort
 
-    def make_port(self, host=None, port_name=None, options=None, os_name=None, os_version=None, **kwargs):
-        port = super(IOSSimulatorTest, self).make_port(host=host, port_name=port_name, options=options, os_name=os_name, s_version=os_version, kwargs=kwargs)
+    def make_port(self, host=None, port_name=None, options=None, os_name=None, os_version=Version(11), **kwargs):
+        port = super(IOSSimulatorTest, self).make_port(host=host, port_name=port_name, options=options, os_name=os_name, os_version=os_version, kwargs=kwargs)
         port.set_option('child_processes', 1)
         return port
 
@@ -92,15 +91,15 @@ class IOSSimulatorTest(ios_testcase.IOSTest):
     def test_layout_test_searchpath_with_apple_additions(self):
         with port_testcase.bind_mock_apple_additions():
             search_path = self.make_port().default_baseline_search_path()
-        self.assertEqual(search_path[0], '/additional_testing_path/ios-simulator-add-8-wk1')
-        self.assertEqual(search_path[1], '/mock-checkout/LayoutTests/platform/ios-simulator-8-wk1')
-        self.assertEqual(search_path[2], '/additional_testing_path/ios-simulator-add-8')
-        self.assertEqual(search_path[3], '/mock-checkout/LayoutTests/platform/ios-simulator-8')
+        self.assertEqual(search_path[0], '/additional_testing_path/ios-simulator-add-ios11-wk1')
+        self.assertEqual(search_path[1], '/mock-checkout/LayoutTests/platform/ios-simulator-11-wk1')
+        self.assertEqual(search_path[2], '/additional_testing_path/ios-simulator-add-ios11')
+        self.assertEqual(search_path[3], '/mock-checkout/LayoutTests/platform/ios-simulator-11')
         self.assertEqual(search_path[4], '/additional_testing_path/ios-simulator-wk1')
         self.assertEqual(search_path[5], '/mock-checkout/LayoutTests/platform/ios-simulator-wk1')
         self.assertEqual(search_path[6], '/additional_testing_path/ios-simulator')
         self.assertEqual(search_path[7], '/mock-checkout/LayoutTests/platform/ios-simulator')
-        self.assertEqual(search_path[8], '/additional_testing_path/ios-add-8')
-        self.assertEqual(search_path[9], '/mock-checkout/LayoutTests/platform/ios-8')
+        self.assertEqual(search_path[8], '/additional_testing_path/ios-add-ios11')
+        self.assertEqual(search_path[9], '/mock-checkout/LayoutTests/platform/ios-11')
         self.assertEqual(search_path[10], '/additional_testing_path/ios-wk1')
         self.assertEqual(search_path[11], '/mock-checkout/LayoutTests/platform/ios-wk1')
index aaa5ea941ea1892fb782fac928d9d40584009c7e..5402121e41ab0357c3ab76ebcc1748eede4de1c1 100644 (file)
 # 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.
 
+from webkitpy.common.version import Version
 from webkitpy.port import darwin_testcase
-from webkitpy.tool.mocktool import MockOptions
 
 
 class IOSTest(darwin_testcase.DarwinTest):
     disable_setup = True
 
+    def make_port(self, host=None, port_name=None, options=None, os_name=None, os_version=Version(11), **kwargs):
+        port = super(IOSTest, self).make_port(host=host, port_name=port_name, options=options, os_name=os_name, os_version=None, kwargs=kwargs)
+        port.set_option('version', str(os_version))
+        return port
+
     def test_driver_name(self):
         self.assertEqual(self.make_port().driver_name(), 'DumpRenderTree.app')
 
index 42fad97fd64e0a6ccba91a68fb16834aa843d50c..a0efd91bc4ee5a9e3bb0258e3c16ed34c289f790 100644 (file)
 
 import logging
 import os
-import time
 import re
 
 from webkitpy.common.memoized import memoized
 from webkitpy.common.system.executive import ScriptError
+from webkitpy.common.version import Version
+from webkitpy.common.version_name_map import VersionNameMap
 from webkitpy.port.config import apple_additions
 from webkitpy.port.darwin import DarwinPort
 
@@ -43,7 +44,9 @@ _log = logging.getLogger(__name__)
 class MacPort(DarwinPort):
     port_name = "mac"
 
-    VERSION_FALLBACK_ORDER = ['mac-snowleopard', 'mac-lion', 'mac-mountainlion', 'mac-mavericks', 'mac-yosemite', 'mac-elcapitan', 'mac-sierra', 'mac-highsierra']
+    VERSION_MIN = Version(10, 6)
+    VERSION_MAX = Version(10, 14)
+
     SDK = 'macosx'
 
     ARCHITECTURES = ['x86_64', 'x86']
@@ -52,66 +55,62 @@ class MacPort(DarwinPort):
 
     def __init__(self, host, port_name, **kwargs):
         DarwinPort.__init__(self, host, port_name, **kwargs)
-        self._os_version = port_name.split('-')[1] if port_name.split('-') > 1 else self.host.platform.os_version
+        if port_name.split('-') > 1:
+            self._os_version = VersionNameMap.map(host.platform).from_name(port_name.split('-')[1])[1]
+        else:
+            self._os_version = self.host.platform.os_version
 
     def _build_driver_flags(self):
         return ['ARCHS=i386'] if self.architecture() == 'x86' else []
 
-    def _apple_additions_path(self, name):
-        if name == 'wk2':
-            return None
-        split_name = name.split('-')
-        os_index = -1
-        if split_name[-1] == 'wk1' or split_name[-1] == 'wk2':
-            os_index = -2
-        if split_name[os_index] != split_name[0]:
-            os_name = apple_additions().mac_os_name(split_name[os_index])
-            if not os_name:
-                return None
-            split_name[os_index] = os_name
-        name = '-'.join(split_name)
-        return self._filesystem.join(apple_additions().layout_tests_path(), name)
-
     @memoized
     def default_baseline_search_path(self):
-        mac_version = 'mac-{}'.format(self._os_version)
-        if mac_version.endswith(self.FUTURE_VERSION) or mac_version not in self.VERSION_FALLBACK_ORDER:
-            version_fallback = [mac_version]
+        version_name_map = VersionNameMap.map(self.host.platform)
+        if self._os_version < self.VERSION_MIN or self._os_version > self.VERSION_MAX:
+            version_fallback = [self._os_version]
         else:
-            version_fallback = self.VERSION_FALLBACK_ORDER[self.VERSION_FALLBACK_ORDER.index(mac_version):-1]
+            sorted_versions = sorted(version_name_map.mapping_for_platform().values())
+            version_fallback = sorted_versions[sorted_versions.index(self._os_version):-1]
         wk_string = 'wk1'
         if self.get_option('webkit_test_runner'):
             wk_string = 'wk2'
 
-        fallback_names = []
+        expectations = []
         for version in version_fallback:
-            fallback_names.append('{}-{}'.format(version, wk_string))
-            fallback_names.append(version)
-        fallback_names = fallback_names + [
-            '{}-{}'.format(self.port_name, wk_string),
-            self.port_name,
-        ]
+            version_name = version_name_map.to_name(version).lower().replace(' ', '')
+            if apple_additions():
+                apple_name = version_name_map.to_name(version, table='internal')
+            else:
+                apple_name = None
+            if apple_name:
+                expectations.append(self._apple_baseline_path('mac-{}-{}'.format(apple_name.lower().replace(' ', ''), wk_string)))
+            expectations.append(self._webkit_baseline_path('mac-{}-{}'.format(version_name, wk_string)))
+            if apple_name:
+                expectations.append(self._apple_baseline_path('mac-{}'.format(apple_name.lower().replace(' ', ''))))
+            expectations.append(self._webkit_baseline_path('mac-{}'.format(version_name)))
+
+        if apple_additions():
+            expectations.append(self._apple_baseline_path('{}-{}'.format(self.port_name, wk_string)))
+        expectations.append(self._webkit_baseline_path('{}-{}'.format(self.port_name, wk_string)))
+        if apple_additions():
+            expectations.append(self._apple_baseline_path('{}'.format(self.port_name)))
+        expectations.append(self._webkit_baseline_path(self.port_name))
+
         if self.get_option('webkit_test_runner'):
-            fallback_names.append('wk2')
-
-        webkit_expectations = map(self._webkit_baseline_path, fallback_names)
-        if apple_additions() and getattr(apple_additions(), "layout_tests_path", None):
-            apple_expectations = map(self._apple_additions_path, fallback_names)
-            result = []
-            for i in xrange(len(webkit_expectations)):
-                if apple_expectations[i]:
-                    result.append(apple_expectations[i])
-                result.append(webkit_expectations[i])
-            return result
-        return webkit_expectations
+            expectations.append(self._webkit_baseline_path('wk2'))
+        return expectations
 
+    @memoized
     def configuration_specifier_macros(self):
-        return {
-            "highsierra+": ["highsierra", "future"],
-            "sierra+": ["sierra", "highsierra", "future"],
-            "elcapitan+": ["elcapitan", "sierra", "highsierra", "future"],
-            "yosemite+": ["yosemite", "elcapitan", "sierra", "highsierra", "future"],
-        }
+        map = {}
+        version_name_map = VersionNameMap.map(self.host.platform)
+        sorted_versions = sorted(version_name_map.mapping_for_platform().values())
+        for version in sorted_versions:
+            list = []
+            for newer in sorted_versions[sorted_versions.index(version):]:
+                list.append(version_name_map.to_name(newer, platform=self.port_name).lower().replace(' ', ''))
+            map[version_name_map.to_name(version, platform=self.port_name).lower().replace(' ', '') + '+'] = list
+        return map
 
     def setup_environ_for_server(self, server_name=None):
         env = super(MacPort, self).setup_environ_for_server(server_name)
index a88190ed9a2f26c46bdee003663b5618db11f1af..b2d82990b01e5827ddcb34a7d27467f23b3ca257 100644 (file)
 # (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 time
-
 from webkitpy.port.mac import MacPort
 from webkitpy.port import darwin_testcase
 from webkitpy.port import port_testcase
 from webkitpy.common.system.outputcapture import OutputCapture
 from webkitpy.tool.mocktool import MockOptions
 from webkitpy.common.system.executive_mock import MockExecutive, MockExecutive2, ScriptError
+from webkitpy.common.version import Version
 
 
 class MacTest(darwin_testcase.DarwinTest):
     os_name = 'mac'
-    os_version = 'lion'
+    os_version = Version.from_name('Lion')
     port_name = 'mac-lion'
     port_maker = MacPort
 
     def test_version(self):
         port = self.make_port()
-        self.assertTrue(port.version())
+        self.assertIsNotNone(port.version_name())
 
     def test_versions(self):
         # Note: these tests don't need to be exhaustive as long as we get path coverage.
index 91087b7e6b30667feec428ce1576a5ca69db6399..cc828ac7e99115c5c843429e0768652610e97967 100644 (file)
@@ -78,6 +78,7 @@ class TestWebKitPort(Port):
 
 @contextmanager
 def bind_mock_apple_additions():
+    from webkitpy.common.version_name_map import PUBLIC_TABLE, VersionNameMap
 
     class MockAppleAdditions(object):
 
@@ -93,11 +94,23 @@ def bind_mock_apple_additions():
         def mac_os_name(name):
             return 'add-{}'.format(name)
 
+        @staticmethod
+        def version_name_mapping(platform=None):
+            result = VersionNameMap(platform)
+            result.mapping['internal'] = {}
+            for platform in result.mapping[PUBLIC_TABLE]:
+                result.mapping['internal'][platform] = {}
+                for name, version in result.mapping[PUBLIC_TABLE][platform].iteritems():
+                    result.mapping['internal'][platform]['add-' + name] = version
+            return result
+
     # apple_additions is a memoized function. Take advantage of this fact and manipulate the cache
     # to temporarily return a mocked result
     apple_additions._results_cache[()] = MockAppleAdditions
+    VersionNameMap.map._results_cache = {}
     yield
     apple_additions._results_cache[()] = None
+    VersionNameMap.map._results_cache = {}
 
 
 class PortTestCase(unittest.TestCase):
index 929a403aeb6f988705502c1da127afaa1907a278..334e24b1e5ae11fcef0bf6bcaba0c9c34801ec3c 100644 (file)
 # (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 sys
 import time
 
 from webkitpy.port import Port, Driver, DriverOutput
 from webkitpy.layout_tests.models.test_configuration import TestConfiguration
-from webkitpy.common.system.filesystem_mock import MockFileSystem
 from webkitpy.common.system.crashlogs import CrashLogs
+from webkitpy.common.version_name_map import PUBLIC_TABLE, VersionNameMap
 
 
 # This sets basic expectations for a test. Each individual expectation
@@ -243,7 +242,7 @@ layer at (0,0) size 800x34
 
     # For testing test are properly included from platform directories.
     tests.add('platform/test-mac-leopard/http/test.html')
-    tests.add('platform/test-win-win7/http/test.html')
+    tests.add('platform/test-win-7sp0/http/test.html')
 
     # For --no-http tests, test that platform specific HTTP tests are properly skipped.
     tests.add('platform/test-snow-leopard/http/test.html')
@@ -357,7 +356,7 @@ class TestPort(Port):
     ALL_BASELINE_VARIANTS = (
         'test-linux-x86_64',
         'test-mac-snowleopard', 'test-mac-leopard',
-        'test-win-vista', 'test-win-win7', 'test-win-xp',
+        'test-win-vista', 'test-win-7sp0', 'test-win-xp',
     )
 
     @classmethod
@@ -373,21 +372,16 @@ class TestPort(Port):
         self._expectations_path = LAYOUT_TEST_DIR + '/platform/test/TestExpectations'
         self._results_directory = None
 
-        self._operating_system = 'mac'
-        if self._name.startswith('test-win'):
-            self._operating_system = 'win'
-        elif self._name.startswith('test-linux'):
-            self._operating_system = 'linux'
-
-        version_map = {
-            'test-win-xp': 'xp',
-            'test-win-win7': 'win7',
-            'test-win-vista': 'vista',
-            'test-mac-leopard': 'leopard',
-            'test-mac-snowleopard': 'snowleopard',
-            'test-linux-x86_64': 'lucid',
-        }
-        self._version = version_map[self._name]
+        self._operating_system = self._name.split('-')[1]
+        if self._operating_system == 'linux':
+            self._os_version = None
+        else:
+            self._os_version = VersionNameMap.map(self.host.platform).from_name(self._name.split('-')[2])[1]
+
+    def version_name(self):
+        if self._os_version is None:
+            return None
+        return VersionNameMap.map(self.host.platform).to_name(self._os_version, platform=self._operating_system, table=PUBLIC_TABLE)
 
     def default_pixel_tests(self):
         return True
@@ -401,10 +395,10 @@ class TestPort(Port):
         search_paths = {
             'test-mac-snowleopard': ['test-mac-snowleopard'],
             'test-mac-leopard': ['test-mac-leopard', 'test-mac-snowleopard'],
-            'test-win-win7': ['test-win-win7'],
-            'test-win-vista': ['test-win-vista', 'test-win-win7'],
-            'test-win-xp': ['test-win-xp', 'test-win-vista', 'test-win-win7'],
-            'test-linux-x86_64': ['test-linux', 'test-win-win7'],
+            'test-win-7sp0': ['test-win-7sp0'],
+            'test-win-vista': ['test-win-vista', 'test-win-7sp0'],
+            'test-win-xp': ['test-win-xp', 'test-win-vista', 'test-win-7sp0'],
+            'test-linux-x86_64': ['test-linux'],
         }
         return [self._webkit_baseline_path(d) for d in search_paths[self.name()]]
 
@@ -514,7 +508,7 @@ class TestPort(Port):
                 ('snowleopard', 'x86'),
                 ('xp', 'x86'),
                 ('vista', 'x86'),
-                ('win7', 'x86'),
+                ('7sp0', 'x86'),
                 ('lucid', 'x86'),
                 ('lucid', 'x86_64'))
 
@@ -523,7 +517,7 @@ class TestPort(Port):
 
     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']}
+        return {'mac': ['leopard', 'snowleopard'], 'win': ['xp', 'vista', '7sp0'], 'linux': ['lucid']}
 
     def all_baseline_variants(self):
         return self.ALL_BASELINE_VARIANTS
index e4839d4f6a2e57579a6691c9e1180de985b747a9..58399500c3f76b5ac32c3e08e4c7be89fea3143f 100644 (file)
@@ -37,8 +37,9 @@ import time
 
 from webkitpy.common.system.crashlogs import CrashLogs
 from webkitpy.common.system.systemhost import SystemHost
-from webkitpy.common.system.executive import ScriptError, Executive
+from webkitpy.common.system.executive import Executive
 from webkitpy.common.system.path import abspath_to_uri, cygpath
+from webkitpy.common.version import Version
 from webkitpy.common.version_name_map import VersionNameMap
 from webkitpy.port.apple import ApplePort
 from webkitpy.port.config import apple_additions
@@ -56,7 +57,8 @@ except ImportError:
 class WinPort(ApplePort):
     port_name = "win"
 
-    VERSION_FALLBACK_ORDER = ["win-xp", "win-vista", "win-7sp0", "win-win10", "win"]
+    VERSION_MIN = Version(5, 1)
+    VERSION_MAX = Version(10)
 
     ARCHITECTURES = ['x86', 'x86_64']
 
@@ -87,6 +89,13 @@ class WinPort(ApplePort):
     previous_error_reporting_values = {}
     previous_wow64_error_reporting_values = {}
 
+    def __init__(self, host, port_name, **kwargs):
+        ApplePort.__init__(self, host, port_name, **kwargs)
+        if port_name.split('-') > 1:
+            self._os_version = VersionNameMap.map(host.platform).from_name(port_name.split('-')[1])[1]
+        else:
+            self._os_version = self.host.platform.os_version
+
     def do_text_results_differ(self, expected_text, actual_text):
         # Sanity was restored in WK2, so we don't need this hack there.
         if self.get_option('webkit_test_runner'):
@@ -102,11 +111,15 @@ class WinPort(ApplePort):
         return expected_text != actual_text
 
     def default_baseline_search_path(self):
-        name = self._name.replace('-wk2', '')
-        if name.endswith(self.FUTURE_VERSION):
-            fallback_names = [self.port_name]
+        version_name_map = VersionNameMap.map(self.host.platform)
+        if self._os_version < self.VERSION_MIN or self._os_version > self.VERSION_MAX:
+            fallback_versions = [self._os_version]
         else:
-            fallback_names = self.VERSION_FALLBACK_ORDER[self.VERSION_FALLBACK_ORDER.index(name):-1] + [self.port_name]
+            sorted_versions = sorted(version_name_map.mapping_for_platform(platform=self.port_name).values())
+            fallback_versions = sorted_versions[sorted_versions.index(self._os_version):]
+        fallback_names = ['win-' + version_name_map.to_name(version, platform=self.port_name).lower().replace(' ', '') for version in fallback_versions]
+        fallback_names.append('win')
+
         # FIXME: The AppleWin port falls back to AppleMac for some results.  Eventually we'll have a shared 'apple' port.
         if self.get_option('webkit_test_runner'):
             fallback_names.insert(0, 'win-wk2')
@@ -438,17 +451,13 @@ class WinCairoPort(WinPort):
 
     TEST_PATH_SEPARATOR = os.sep
 
-    VERSION_FALLBACK_ORDER = ["wincairo-" + os_name.lower() for os_name in VersionNameMap.map().names()]
-
     def default_baseline_search_path(self):
-        name = self._name.replace('-wk2', '')
-        if name.endswith(self.FUTURE_VERSION):
-            fallback_names = []
+        version_name_map = VersionNameMap.map(self.host.platform)
+        if self._os_version < self.VERSION_MIN or self._os_version > self.VERSION_MAX:
+            fallback_versions = [self._os_version]
         else:
-            assert name in self.VERSION_FALLBACK_ORDER
-            fallback_names = self.VERSION_FALLBACK_ORDER[self.VERSION_FALLBACK_ORDER.index(name):]
-        fallback_names.append(self.port_name)
+            sorted_versions = sorted(version_name_map.mapping_for_platform(platform=self.port_name).values())
+            fallback_versions = sorted_versions[sorted_versions.index(self._os_version):]
+        fallback_names = ['wincairo-' + version_name_map.to_name(version, platform=self.port_name).lower().replace(' ', '') for version in fallback_versions]
+        fallback_names.append('wincairo')
         return map(self._webkit_baseline_path, fallback_names)
-
-    def _future_port_name(self):
-        return self.port_name + "-" + self.FUTURE_VERSION
index 1b4c0b3bb81533ac5fc9b4b17c5555552fa24f7b..8aa456b62dfd02a699193e3872b4ac43b83de5dc 100644 (file)
@@ -29,6 +29,8 @@
 from webkitpy.common.system.executive_mock import MockExecutive
 from webkitpy.common.system.outputcapture import OutputCapture
 from webkitpy.common.system.systemhost_mock import MockSystemHost
+from webkitpy.common.version import Version
+from webkitpy.common.version_name_map import PUBLIC_TABLE, VersionNameMap
 from webkitpy.port import port_testcase
 from webkitpy.port.win import WinPort
 from webkitpy.tool.mocktool import MockOptions
@@ -36,7 +38,7 @@ from webkitpy.tool.mocktool import MockOptions
 
 class WinPortTest(port_testcase.PortTestCase):
     os_name = 'win'
-    os_version = 'xp'
+    os_version = Version.from_name('XP')
     port_name = 'win-xp'
     port_maker = WinPort
 
@@ -58,24 +60,24 @@ class WinPortTest(port_testcase.PortTestCase):
         self.assertEqual(port.baseline_search_path(), absolute_search_paths)
 
     def test_baseline_search_path(self):
-        self._assert_search_path(['win-xp', 'win-vista', 'win-7sp0', 'win-win10', 'win', 'mac'], 'xp')
-        self._assert_search_path(['win-vista', 'win-7sp0', 'win-win10', 'win', 'mac'], 'vista')
-        self._assert_search_path(['win-7sp0', 'win-win10', 'win', 'mac'], '7sp0')
+        self._assert_search_path(['win-xp', 'win-vista', 'win-7sp0', 'win-8', 'win-8.1', 'win-win10', 'win', 'mac'], Version.from_name('XP'))
+        self._assert_search_path(['win-vista', 'win-7sp0', 'win-8', 'win-8.1', 'win-win10', 'win', 'mac'], Version.from_name('Vista'))
+        self._assert_search_path(['win-7sp0', 'win-8', 'win-8.1', 'win-win10', 'win', 'mac'], Version.from_name('7sp0'))
 
-        self._assert_search_path(['win-wk2', 'win-xp', 'win-vista', 'win-7sp0', 'win-win10', 'win', 'mac-wk2', 'mac'], 'xp', use_webkit2=True)
-        self._assert_search_path(['win-wk2', 'win-vista', 'win-7sp0', 'win-win10', 'win', 'mac-wk2', 'mac'], 'vista', use_webkit2=True)
-        self._assert_search_path(['win-wk2', 'win-7sp0', 'win-win10', 'win', 'mac-wk2', 'mac'], '7sp0', use_webkit2=True)
+        self._assert_search_path(['win-wk2', 'win-xp', 'win-vista', 'win-7sp0', 'win-8', 'win-8.1', 'win-win10', 'win', 'mac-wk2', 'mac'], Version.from_name('XP'), use_webkit2=True)
+        self._assert_search_path(['win-wk2', 'win-vista', 'win-7sp0', 'win-8', 'win-8.1', 'win-win10', 'win', 'mac-wk2', 'mac'], Version.from_name('Vista'), use_webkit2=True)
+        self._assert_search_path(['win-wk2', 'win-7sp0', 'win-8', 'win-8.1', 'win-win10', 'win', 'mac-wk2', 'mac'], Version.from_name('7sp0'), use_webkit2=True)
 
     def _assert_version(self, port_name, expected_version):
         host = MockSystemHost(os_name='win', os_version=expected_version)
         port = WinPort(host, port_name=port_name)
-        self.assertEqual(port.version(), expected_version)
+        self.assertEqual(port.version_name(), VersionNameMap.map().to_name(expected_version, platform='win', table=PUBLIC_TABLE))
 
     def test_versions(self):
-        self._assert_version('win-xp', 'xp')
-        self._assert_version('win-vista', 'vista')
-        self._assert_version('win-7sp0', '7sp0')
-        self.assertRaises(AssertionError, self._assert_version, 'win-me', 'xp')
+        self._assert_version('win-xp', Version.from_name('XP'))
+        self._assert_version('win-vista', Version.from_name('Vista'))
+        self._assert_version('win-7sp0', Version.from_name('7sp0'))
+        self.assertRaises(AssertionError, self._assert_version, 'win-me', Version.from_name('Vista'))
 
     def test_compare_text(self):
         expected = "EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification\nfoo\nEDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification\n"
index e7dde0034daa842525ba776fc51b1c418dbd3d7a..7803409daa9b04df8d874996465569267e28fe91 100644 (file)
@@ -82,7 +82,7 @@ class WPEPort(Port):
     def _generate_all_test_configurations(self):
         configurations = []
         for build_type in self.ALL_BUILD_TYPES:
-            configurations.append(TestConfiguration(version=self._version, architecture='x86', build_type=build_type))
+            configurations.append(TestConfiguration(version=self.version_name(), architecture='x86', build_type=build_type))
         return configurations
 
     def _path_to_driver(self):
index 9f5b71fdf5d4a5b8dc9006702e4262378200769c..42eef66ef9edb9526583d0174c3b2fcffb0c117d 100644 (file)
@@ -187,7 +187,7 @@ class PrintExpectationsTest(unittest.TestCase):
                        'failures/expected/image.html [ ImageOnlyFailure ]\n'
                        'failures/expected/text.html [ Failure ]\n'
                        '\n'
-                       '// For test-win-win7\n'
+                       '// For test-win-7sp0\n'
                        'failures/expected/image.html [ ImageOnlyFailure ]\n'
                        'failures/expected/text.html [ Failure ]\n'
                        '\n'
@@ -281,7 +281,7 @@ class PrintBaselinesTest(unittest.TestCase):
                            'passes/text-expected.png\n'
                            'passes/text-expected.txt\n'
                            '\n'
-                           '// For test-win-win7\n'
+                           '// For test-win-7sp0\n'
                            'passes/text-expected.png\n'
                            'passes/text-expected.txt\n'
                            '\n'
index 09624b467b8d4473ba6938da05429270d6d29798..308999bcaba3ee952617287d6940011d6baf38e4 100644 (file)
@@ -35,14 +35,12 @@ import sys
 import time
 import traceback
 
-from datetime import datetime
 from optparse import make_option
 from StringIO import StringIO
 
 from webkitpy.common.config.committervalidator import CommitterValidator
 from webkitpy.common.config.ports import DeprecatedPort
 from webkitpy.common.net.bugzilla import Attachment
-from webkitpy.common.net.statusserver import StatusServer
 from webkitpy.common.system.executive import ScriptError
 from webkitpy.tool.bot.botinfo import BotInfo
 from webkitpy.tool.bot.commitqueuetask import CommitQueueTask, CommitQueueTaskDelegate
@@ -272,7 +270,7 @@ class PatchProcessingQueue(AbstractPatchQueue):
     def _new_port_name_from_old(self, port_name, platform):
         # ApplePort.determine_full_port_name asserts if the name doesn't include version.
         if port_name == 'mac':
-            return 'mac-' + platform.os_version
+            return 'mac-' + platform.os_version_name().lower().replace(' ', '')
         if port_name == 'win':
             return 'win-future'
         return port_name