Remove concept of 'future'
authorjbedard@apple.com <jbedard@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 28 Feb 2018 02:05:59 +0000 (02:05 +0000)
committerjbedard@apple.com <jbedard@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 28 Feb 2018 02:05:59 +0000 (02:05 +0000)
https://bugs.webkit.org/show_bug.cgi?id=183184
<rdar://problem/37958594>

Reviewed by Aakash Jain.

Remove concept of 'future' from expectations and instead
use a system of inheritance centered around the current version
of an OS for Mac and iOS.

Inheritance works like so:

| ....
V Future
> High Sierra (mac)
^ mac-sierra
| mac-elcapitan
| ....

This does not change expectation inheritance for any currently running
configurations, it generalizes the logic already used.

* Scripts/webkitpy/common/version_name_map.py:
(VersionNameMap.__init__): Remove all future versions.
(VersionNameMap.mapping_for_platform): Return empty dicts instead of
asserting.
* Scripts/webkitpy/port/apple.py:
(ApplePort):
(ApplePort._allowed_versions): Return all available versions.
(ApplePort._generate_all_test_configurations): Instead of picking from a set
of allowed versions, assume that every specified version is allowed.
(ApplePort._port_name_with_version): Deleted.
* Scripts/webkitpy/port/darwin.py: Add CURRENT_VERSION overridden by subclasses.
(DarwinPort):
* Scripts/webkitpy/port/ios.py:
(IOSPort):
(IOSPort.default_baseline_search_path): Use system of inheritance centered around
the current version.
* Scripts/webkitpy/port/mac.py:
(MacPort):
(MacPort.__init__): Use current version by default.
(MacPort.default_baseline_search_path): Use system of inheritance centered around
the current version.
(MacPort.configuration_specifier_macros): Use the same set of version names
supported in default_baseline_search_path.
* Scripts/webkitpy/port/mac_unittest.py:
(MacTest.test_versions): Remove 'future' tests.

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

Tools/ChangeLog
Tools/Scripts/webkitpy/common/version_name_map.py
Tools/Scripts/webkitpy/port/apple.py
Tools/Scripts/webkitpy/port/darwin.py
Tools/Scripts/webkitpy/port/ios.py
Tools/Scripts/webkitpy/port/mac.py
Tools/Scripts/webkitpy/port/mac_unittest.py
Tools/Scripts/webkitpy/port/port_testcase.py

index 9f1c915..88cc06e 100644 (file)
@@ -1,3 +1,53 @@
+2018-02-27  Jonathan Bedard  <jbedard@apple.com>
+
+        Remove concept of 'future'
+        https://bugs.webkit.org/show_bug.cgi?id=183184
+        <rdar://problem/37958594>
+
+        Reviewed by Aakash Jain.
+
+        Remove concept of 'future' from expectations and instead
+        use a system of inheritance centered around the current version
+        of an OS for Mac and iOS.
+
+        Inheritance works like so:
+
+        | ....
+        V Future
+        > High Sierra (mac)
+        ^ mac-sierra
+        | mac-elcapitan
+        | ....
+
+        This does not change expectation inheritance for any currently running
+        configurations, it generalizes the logic already used.
+
+        * Scripts/webkitpy/common/version_name_map.py:
+        (VersionNameMap.__init__): Remove all future versions.
+        (VersionNameMap.mapping_for_platform): Return empty dicts instead of
+        asserting.
+        * Scripts/webkitpy/port/apple.py:
+        (ApplePort):
+        (ApplePort._allowed_versions): Return all available versions.
+        (ApplePort._generate_all_test_configurations): Instead of picking from a set
+        of allowed versions, assume that every specified version is allowed.
+        (ApplePort._port_name_with_version): Deleted.
+        * Scripts/webkitpy/port/darwin.py: Add CURRENT_VERSION overridden by subclasses.
+        (DarwinPort):
+        * Scripts/webkitpy/port/ios.py:
+        (IOSPort):
+        (IOSPort.default_baseline_search_path): Use system of inheritance centered around
+        the current version.
+        * Scripts/webkitpy/port/mac.py:
+        (MacPort):
+        (MacPort.__init__): Use current version by default.
+        (MacPort.default_baseline_search_path): Use system of inheritance centered around
+        the current version.
+        (MacPort.configuration_specifier_macros): Use the same set of version names
+        supported in default_baseline_search_path.
+        * Scripts/webkitpy/port/mac_unittest.py:
+        (MacTest.test_versions): Remove 'future' tests.
+
 2018-02-27  Michael Catanzaro  <mcatanzaro@igalia.com>
 
         Unreviewed GTK test gardening
index b3bdd38..6caed38 100644 (file)
@@ -27,6 +27,7 @@ from webkitpy.common.version import Version
 
 
 PUBLIC_TABLE = 'public'
+INTERNAL_TABLE = 'internal'
 
 
 class VersionNameMap(object):
@@ -58,11 +59,10 @@ class VersionNameMap(object):
                 'El Capitan': Version(10, 11),
                 'Sierra': Version(10, 12),
                 'High Sierra': Version(10, 13),
-                'Future': Version(10, 14),
             },
-            'ios': self._automap_to_major_version('iOS', minimum=Version(10), maximum=Version(12)),
-            'tvos': self._automap_to_major_version('tvOS', minimum=Version(10), maximum=Version(12)),
-            'watchos': self._automap_to_major_version('watchOS', minimum=Version(1), maximum=Version(5)),
+            'ios': self._automap_to_major_version('iOS', minimum=Version(10), maximum=Version(11)),
+            'tvos': self._automap_to_major_version('tvOS', minimum=Version(10), maximum=Version(11)),
+            'watchos': self._automap_to_major_version('watchOS', minimum=Version(1), maximum=Version(4)),
             'win': {
                 'Win10': Version(10),
                 '8.1': Version(6, 3),
@@ -143,6 +143,4 @@ class VersionNameMap(object):
     def mapping_for_platform(self, platform=None, table=PUBLIC_TABLE):
         """return proper os_name: os_version mapping for platform"""
         platform = self.default_system_platform if platform is None else platform
-        assert table in self.mapping
-        assert platform in self.mapping[table]
-        return self.mapping[table][platform]
+        return self.mapping.get(table, {}).get(platform, {})
index d7a9de7..ac89b7c 100644 (file)
@@ -33,6 +33,7 @@ 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
+from webkitpy.common.version_name_map import PUBLIC_TABLE, INTERNAL_TABLE
 
 
 _log = logging.getLogger(__name__)
@@ -42,8 +43,6 @@ class ApplePort(Port):
     """Shared logic between all of Apple's ports."""
 
     # overridden in subclasses
-    VERSION_MIN = None
-    VERSION_MAX = None
     ARCHITECTURES = []
     _crash_logs_to_skip_for_host = {}
 
@@ -94,25 +93,22 @@ class ApplePort(Port):
     def should_retry_crashes(self):
         return True
 
-    # 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', '')
-
     @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]
+        versions = set()
+        for table in [PUBLIC_TABLE, INTERNAL_TABLE]:
+            versions.update(VersionNameMap.map(self.host.platform).mapping_for_platform(platform=self.port_name.split('-')[0], table=table).values())
+        return sorted(versions)
 
     def _generate_all_test_configurations(self):
         configurations = []
         for version in self._allowed_versions():
             for build_type in self.ALL_BUILD_TYPES:
                 for architecture in self.ARCHITECTURES:
-                    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))
+                    for table in [PUBLIC_TABLE, INTERNAL_TABLE]:
+                        version_name = VersionNameMap.map(self.host.platform).to_name(version, platform=self.port_name.split('-')[0], table=table)
+                        if version_name:
+                            configurations.append(TestConfiguration(version=version_name, architecture=architecture, build_type=build_type))
         return configurations
 
     def _apple_baseline_path(self, platform):
index 9709341..7833f2e 100644 (file)
@@ -36,6 +36,7 @@ _log = logging.getLogger(__name__)
 
 class DarwinPort(ApplePort):
 
+    CURRENT_VERSION = None
     SDK = None
 
     def __init__(self, host, port_name, **kwargs):
index 8ec6de4..067a7e6 100644 (file)
@@ -25,7 +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.common.version_name_map import VersionNameMap, INTERNAL_TABLE
 from webkitpy.layout_tests.models.test_configuration import TestConfiguration
 from webkitpy.port.config import apple_additions
 from webkitpy.port.darwin import DarwinPort
@@ -37,8 +37,7 @@ _log = logging.getLogger(__name__)
 class IOSPort(DarwinPort):
     port_name = "ios"
 
-    VERSION_MIN = Version(11)
-    VERSION_MAX = Version(12)
+    CURRENT_VERSION = Version(11)
 
     def __init__(self, host, port_name, **kwargs):
         super(IOSPort, self).__init__(host, port_name, **kwargs)
@@ -95,20 +94,31 @@ class IOSPort(DarwinPort):
         wk_string = 'wk1'
         if self.get_option('webkit_test_runner'):
             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
+
+        versions_to_fallback = []
+        if self.ios_version() == self.CURRENT_VERSION:
+            versions_to_fallback = [self.CURRENT_VERSION]
+        elif self.ios_version():
+            temp_version = Version(self.ios_version().major)
+            while temp_version != self.CURRENT_VERSION:
+                versions_to_fallback.append(Version.from_iterable(temp_version))
+                if temp_version < self.CURRENT_VERSION:
+                    temp_version.major += 1
+                else:
+                    temp_version.major -= 1
+
         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:
+        for version in versions_to_fallback:
             apple_name = None
-        if self.ios_version():
+            if apple_additions():
+                apple_name = VersionNameMap.map(self.host.platform).to_name(version, platform=IOSPort.port_name, table=INTERNAL_TABLE)
+
             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)))
+                expectations.append(self._apple_baseline_path('{}-{}-{}'.format(self.port_name, apple_name.lower().replace(' ', ''), wk_string)))
+            expectations.append(self._webkit_baseline_path('{}-{}-{}'.format(self.port_name, 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)))
+                expectations.append(self._apple_baseline_path('{}-{}'.format(self.port_name, apple_name.lower().replace(' ', ''))))
+            expectations.append(self._webkit_baseline_path('{}-{}'.format(self.port_name, version.major)))
 
         if apple_additions():
             expectations.append(self._apple_baseline_path('{}-{}'.format(self.port_name, wk_string)))
@@ -117,10 +127,13 @@ class IOSPort(DarwinPort):
             expectations.append(self._apple_baseline_path(self.port_name))
         expectations.append(self._webkit_baseline_path(self.port_name))
 
-        if self.ios_version():
+        for version in versions_to_fallback:
+            apple_name = None
+            if apple_additions():
+                apple_name = VersionNameMap.map(self.host.platform).to_name(version, platform=IOSPort.port_name, table=INTERNAL_TABLE)
             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)))
+                expectations.append(self._apple_baseline_path('{}-{}'.format(IOSPort.port_name, apple_name.lower().replace(' ', ''))))
+            expectations.append(self._webkit_baseline_path('{}-{}'.format(IOSPort.port_name, version.major)))
 
         if apple_additions():
             expectations.append(self._apple_baseline_path('{}-{}'.format(IOSPort.port_name, wk_string)))
index 5a530e8..a7bcabd 100644 (file)
@@ -34,6 +34,7 @@ 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 PUBLIC_TABLE, INTERNAL_TABLE
 from webkitpy.common.version_name_map import VersionNameMap
 from webkitpy.port.config import apple_additions
 from webkitpy.port.darwin import DarwinPort
@@ -44,8 +45,7 @@ _log = logging.getLogger(__name__)
 class MacPort(DarwinPort):
     port_name = "mac"
 
-    VERSION_MIN = Version(10, 6)
-    VERSION_MAX = Version(10, 14)
+    CURRENT_VERSION = Version(10, 13)
 
     SDK = 'macosx'
 
@@ -61,37 +61,49 @@ class MacPort(DarwinPort):
         elif self.host.platform.is_mac():
             self._os_version = self.host.platform.os_version
         else:
-            sorted_versions = sorted(version_name_map.mapping_for_platform(platform=self.port_name).values())
-            self._os_version = sorted_versions[sorted_versions.index(self.VERSION_MAX) - 1]
+            self._os_version = MacPort.CURRENT_VERSION
+        assert self._os_version
+        assert self._os_version.major == 10
 
     def _build_driver_flags(self):
         return ['ARCHS=i386'] if self.architecture() == 'x86' else []
 
     @memoized
     def default_baseline_search_path(self):
+        versions_to_fallback = []
         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]
+
+        if self._os_version == self.CURRENT_VERSION:
+            versions_to_fallback = [self.CURRENT_VERSION]
         else:
-            sorted_versions = sorted(version_name_map.mapping_for_platform(platform=self.port_name).values())
-            version_fallback = sorted_versions[sorted_versions.index(self._os_version):-1]
+            temp_version = Version(self._os_version.major, self._os_version.minor)
+            while temp_version != self.CURRENT_VERSION:
+                versions_to_fallback.append(Version.from_iterable(temp_version))
+                if temp_version < self.CURRENT_VERSION:
+                    temp_version.minor += 1
+                else:
+                    temp_version.minor -= 1
         wk_string = 'wk1'
         if self.get_option('webkit_test_runner'):
             wk_string = 'wk2'
 
         expectations = []
-        for version in version_fallback:
-            version_name = version_name_map.to_name(version, platform=self.port_name).lower().replace(' ', '')
+        for version in versions_to_fallback:
+            version_name = version_name_map.to_name(version, platform=self.port_name)
+            if version_name:
+                standardized_version_name = version_name.lower().replace(' ', '')
+            apple_name = None
             if apple_additions():
-                apple_name = version_name_map.to_name(version, platform=self.port_name, table='internal')
-            else:
-                apple_name = None
+                apple_name = version_name_map.to_name(version, platform=self.port_name, table=INTERNAL_TABLE)
+
             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 version_name:
+                expectations.append(self._webkit_baseline_path('mac-{}-{}'.format(standardized_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 version_name:
+                expectations.append(self._webkit_baseline_path('mac-{}'.format(standardized_version_name)))
 
         if apple_additions():
             expectations.append(self._apple_baseline_path('{}-{}'.format(self.port_name, wk_string)))
@@ -106,15 +118,21 @@ class MacPort(DarwinPort):
 
     @memoized
     def configuration_specifier_macros(self):
-        map = {}
+        config_map = {}
         version_name_map = VersionNameMap.map(self.host.platform)
-        sorted_versions = sorted(version_name_map.mapping_for_platform(platform=self.port_name).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
+        for version in self._allowed_versions():
+            version_names = []
+            for newer in self._allowed_versions()[self._allowed_versions().index(version):]:
+                version_name = version_name_map.to_name(newer, platform=self.port_name)
+                if not version_name:
+                    version_name = version_name_map.to_name(newer, platform=self.port_name, table=INTERNAL_TABLE)
+                version_names.append(version_name.lower().replace(' ', ''))
+            for table in [PUBLIC_TABLE, INTERNAL_TABLE]:
+                version_name = version_name_map.to_name(version, platform=self.port_name, table=table)
+                if not version_name:
+                    continue
+                config_map[version_name.lower().replace(' ', '') + '+'] = version_names
+        return config_map
 
     def setup_environ_for_server(self, server_name=None):
         env = super(MacPort, self).setup_environ_for_server(server_name)
index b2d8299..f438920 100644 (file)
@@ -68,8 +68,6 @@ class MacTest(darwin_testcase.DarwinTest):
         self.assert_name('mac', 'highsierra', 'mac-highsierra')
         self.assert_name('mac-highsierra', 'elcapitan', 'mac-highsierra')
         self.assert_name('mac-highsierra', 'sierra', 'mac-highsierra')
-        self.assert_name('mac', 'future', 'mac-future')
-        self.assert_name('mac-future', 'future', 'mac-future')
         self.assertRaises(AssertionError, self.assert_name, 'mac-tiger', 'leopard', 'mac-leopard')
 
     def test_setup_environ_for_server(self):
index cc828ac..2913799 100644 (file)
@@ -43,6 +43,7 @@ from webkitpy.common.system.executive_mock import MockExecutive
 from webkitpy.common.system.filesystem_mock import MockFileSystem
 from webkitpy.common.system.outputcapture import OutputCapture
 from webkitpy.common.system.systemhost_mock import MockSystemHost
+from webkitpy.common.version_name_map import INTERNAL_TABLE
 from webkitpy.port.base import Port
 from webkitpy.port.config import apple_additions
 from webkitpy.port.image_diff import ImageDiffer
@@ -97,11 +98,11 @@ def bind_mock_apple_additions():
         @staticmethod
         def version_name_mapping(platform=None):
             result = VersionNameMap(platform)
-            result.mapping['internal'] = {}
+            result.mapping[INTERNAL_TABLE] = {}
             for platform in result.mapping[PUBLIC_TABLE]:
-                result.mapping['internal'][platform] = {}
+                result.mapping[INTERNAL_TABLE][platform] = {}
                 for name, version in result.mapping[PUBLIC_TABLE][platform].iteritems():
-                    result.mapping['internal'][platform]['add-' + name] = version
+                    result.mapping[INTERNAL_TABLE][platform]['add-' + name] = version
             return result
 
     # apple_additions is a memoized function. Take advantage of this fact and manipulate the cache