Example #1
0
 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)
Example #2
0
    def default_baseline_search_path(self):
        wk_string = 'wk1'
        if self.get_option('webkit_test_runner'):
            wk_string = 'wk2'

        versions_to_fallback = []
        if self.ios_version().major == self.CURRENT_VERSION.major:
            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 = []
        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(
                        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.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)))
        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))

        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.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)))
        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'):
            expectations.append(self._webkit_baseline_path('wk2'))

        return expectations
Example #3
0
 def assert_name(self, port_name, os_version_string, expected):
     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())
Example #4
0
 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_name(), VersionNameMap.map().to_name(expected_version, platform='win', table=PUBLIC_TABLE))
Example #5
0
 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)
Example #6
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)
Example #7
0
File: win.py Project: zszyj/webkit
 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
Example #8
0
 def from_name(name):
     from webkitpy.common.version_name_map import VersionNameMap
     return VersionNameMap.map().from_name(name)[1]
Example #9
0
 def _allowed_versions(self):
     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)
Example #10
0
    def default_baseline_search_path(self, **kwargs):
        versions_to_fallback = []
        version_name_map = VersionNameMap.map(self.host.platform)

        if self._os_version == self.CURRENT_VERSION:
            versions_to_fallback = [self.CURRENT_VERSION]
        else:
            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 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_TABLE)

            if apple_name:
                expectations.append(
                    self._apple_baseline_path('mac-{}-{}'.format(
                        apple_name.lower().replace(' ', ''), 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(' ', ''))))
            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)))
        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'):
            expectations.append(self._webkit_baseline_path('wk2'))
        return expectations
 def test_mac_version_by_name(self):
     map = VersionNameMap()
     self.assertEqual(('mac', Version(10, 15)), map.from_name('Catalina'))
     self.assertEqual(('mac', Version(10, 15)), map.from_name('catalina'))
     self.assertEqual(('mac', Version(10, 14)), map.from_name('Mojave'))
     self.assertEqual(('mac', Version(10, 14)), map.from_name('mojave'))
     self.assertEqual(('mac', Version(10, 13)),
                      map.from_name('High Sierra'))
     self.assertEqual(('mac', Version(10, 13)),
                      map.from_name('high sierra'))
     self.assertEqual(('mac', Version(10, 13)), map.from_name('highsierra'))
     self.assertEqual(('mac', Version(10, 12)), map.from_name('Sierra'))
     self.assertEqual(('mac', Version(10, 12)), map.from_name('sierra'))
     self.assertEqual(('mac', Version(10, 11)), map.from_name('El Capitan'))
     self.assertEqual(('mac', Version(10, 11)), map.from_name('elcapitan'))
     self.assertEqual(('mac', Version(10, 11)), map.from_name('el Capitan'))
 def test_default_system_platform(self):
     host = SystemHost()
     map = VersionNameMap(platform=host.platform)
     self.assertEqual(map.default_system_platform, host.platform.os_name)
Example #13
0
 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]
Example #14
0
    def default_baseline_search_path(self):
        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
        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():
            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():
            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'):
            expectations.append(self._webkit_baseline_path('wk2'))

        return expectations
Example #15
0
    def default_baseline_search_path(self, device_type=None):
        wk_string = 'wk1'
        if self.get_option('webkit_test_runner'):
            wk_string = 'wk2'

        versions_to_fallback = []
        if self.device_version().major == self.CURRENT_VERSION.major:
            versions_to_fallback = [self.CURRENT_VERSION]
        elif self.device_version():
            temp_version = Version(self.device_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

        runtime_type = 'simulator' if 'simulator' in self.SDK else 'device'
        hardware_family = device_type.hardware_family.lower(
        ) if device_type and device_type.hardware_family else None
        hardware_type = device_type.hardware_type.lower(
        ) if device_type and device_type.hardware_type else None

        base_variants = []
        if hardware_family and hardware_type:
            base_variants.append(u'{}-{}-{}'.format(hardware_family,
                                                    hardware_type,
                                                    runtime_type))
        if hardware_family:
            base_variants.append(u'{}-{}'.format(hardware_family,
                                                 runtime_type))
        base_variants.append(u'{}-{}'.format(IOSPort.port_name, runtime_type))
        if hardware_family and hardware_type:
            base_variants.append(u'{}-{}'.format(hardware_family,
                                                 hardware_type))
        if hardware_family:
            base_variants.append(hardware_family)
        base_variants.append(IOSPort.port_name)

        expectations = []
        for variant in base_variants:
            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(u'{}-{}-{}'.format(
                            variant,
                            apple_name.lower().replace(' ', ''), wk_string)))
                expectations.append(
                    self._webkit_baseline_path(u'{}-{}-{}'.format(
                        variant, version.major, wk_string)))
                if apple_name:
                    expectations.append(
                        self._apple_baseline_path(u'{}-{}'.format(
                            variant,
                            apple_name.lower().replace(' ', ''))))
                expectations.append(
                    self._webkit_baseline_path(u'{}-{}'.format(
                        variant, version.major)))

            if apple_additions():
                expectations.append(
                    self._apple_baseline_path(u'{}-{}'.format(
                        variant, wk_string)))
            expectations.append(
                self._webkit_baseline_path(u'{}-{}'.format(variant,
                                                           wk_string)))
            if apple_additions():
                expectations.append(self._apple_baseline_path(variant))
            expectations.append(self._webkit_baseline_path(variant))

        if self.get_option('webkit_test_runner'):
            expectations.append(self._webkit_baseline_path('wk2'))

        return expectations