Beispiel #1
0
    def __init__(self, host, port_name=None, **kwargs):
        Port.__init__(self, host, port_name or TestPort.default_port_name, **kwargs)
        self._tests = unit_test_list()
        self._flakes = set()
        self._expectations_path = LAYOUT_TEST_DIR + '/platform/test/TestExpectations'
        self._results_directory = None

        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]
Beispiel #2
0
 def __init__(self, host, port_name, **kwargs):
     DarwinPort.__init__(self, host, port_name, **kwargs)
     version_name_map = VersionNameMap.map(host.platform)
     self._os_version = None
     split_port_name = port_name.split('-')
     if len(split_port_name) > 1 and split_port_name[1] != 'wk2':
         self._os_version = version_name_map.from_name(
             split_port_name[1])[1]
     elif self.host.platform.is_mac() and apple_additions():
         self._os_version = self.host.platform.os_version
     if not self._os_version:
         self._os_version = MacPort.CURRENT_VERSION
Beispiel #3
0
    def default_baseline_search_path(self):
        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:
            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]
        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(' ', '')
            if apple_additions():
                apple_name = version_name_map.to_name(version,
                                                      platform=self.port_name,
                                                      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'):
            expectations.append(self._webkit_baseline_path('wk2'))
        return expectations
Beispiel #4
0
    def default_baseline_search_path(self):
        versions_to_fallback = []
        if self.device_version() == self.CURRENT_VERSION:
            versions_to_fallback = [self.CURRENT_VERSION]
        elif self.device_version():
            temp_version = Version(self.device_version().major)
            while temp_version.major != self.CURRENT_VERSION.major:
                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:
            if apple_additions():
                apple_name = VersionNameMap.map(self.host.platform).to_name(version, platform=WatchPort.port_name, table=INTERNAL_TABLE)
                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(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=WatchPort.port_name, table=INTERNAL_TABLE)
            if apple_name:
                expectations.append(
                    self._apple_baseline_path('{}-{}'.format(WatchPort.port_name, apple_name.lower().replace(' ', ''))))
            expectations.append(self._webkit_baseline_path('{}-{}'.format(WatchPort.port_name, version.major)))

        if apple_additions():
            expectations.append(self._apple_baseline_path(WatchPort.port_name))
        expectations.append(self._webkit_baseline_path(WatchPort.port_name))

        expectations.append(self._webkit_baseline_path('wk2'))

        return expectations
Beispiel #5
0
 def __init__(self, host, port_name, **kwargs):
     DarwinPort.__init__(self, host, port_name, **kwargs)
     version_name_map = VersionNameMap.map(host.platform)
     if port_name.split('-') > 1:
         self._os_version = version_name_map.from_name(
             port_name.split('-')[1])[1]
     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]
Beispiel #6
0
 def configuration_specifier_macros(self):
     config_map = {}
     version_name_map = VersionNameMap.map(self.host.platform)
     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
Beispiel #7
0
    def default_baseline_search_path(self):
        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
Beispiel #8
0
 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:
                 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
Beispiel #9
0
 def default_baseline_search_path(self, **kwargs):
     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:
         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)
Beispiel #10
0
 def configuration_specifier_macros(self):
     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
Beispiel #11
0
    def ios_version(self):
        if self.get_option('version'):
            return Version.from_string(self.get_option('version'))

        if not apple_additions():
            raise RuntimeError(self.NO_ON_DEVICE_TESTING)

        if not self._device_for_worker_number_map():
            raise RuntimeError('No devices are available')
        version = None
        for device in self._device_for_worker_number_map():
            if not version:
                version = device.platform.os_version
            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
Beispiel #12
0
    def default_baseline_search_path(self, **kwargs):
        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:
            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')
            fallback_names.append('mac-wk2')
            # Note we do not add 'wk2' here, even though it's included in _skipped_search_paths().
        # FIXME: Perhaps we should get this list from MacPort?
        fallback_names.append('mac')
        result = map(self._webkit_baseline_path, fallback_names)
        if apple_additions() and getattr(apple_additions(), "layout_tests_path", None):
            result.insert(0, self._filesystem.join(apple_additions().layout_tests_path(), self.port_name))
        return result
Beispiel #13
0
class WinCairoPort(WinPort):
    port_name = "wincairo"

    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 = []
        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)
        return map(self._webkit_baseline_path, fallback_names)

    def _future_port_name(self):
        return self.port_name + "-" + self.FUTURE_VERSION
Beispiel #14
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)
Beispiel #15
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))
Beispiel #16
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
Beispiel #17
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
Beispiel #18
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())
Beispiel #19
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)
Beispiel #20
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)
Beispiel #21
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]
Beispiel #22
0
 def from_name(name):
     from webkitpy.common.version_name_map import VersionNameMap
     return VersionNameMap.map().from_name(name)[1]
Beispiel #23
0
 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
Beispiel #24
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)