1 # Copyright (C) 2014-2017 Apple Inc. All rights reserved.
3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions
6 # 1. Redistributions of source code must retain the above copyright
7 # notice, this list of conditions and the following disclaimer.
8 # 2. Redistributions in binary form must reproduce the above copyright
9 # notice, this list of conditions and the following disclaimer in the
10 # documentation and/or other materials provided with the distribution.
12 # THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
13 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
14 # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
15 # DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR
16 # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
17 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
18 # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
19 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
20 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
21 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 from webkitpy.common.memoized import memoized
27 from webkitpy.common.version import Version
28 from webkitpy.common.version_name_map import VersionNameMap, INTERNAL_TABLE
29 from webkitpy.layout_tests.models.test_configuration import TestConfiguration
30 from webkitpy.port.config import apple_additions
31 from webkitpy.port.device_port import DevicePort
32 from webkitpy.port.simulator_process import SimulatorProcess
34 _log = logging.getLogger(__name__)
37 class IOSPort(DevicePort):
40 CURRENT_VERSION = Version(12)
42 def __init__(self, host, port_name, **kwargs):
43 super(IOSPort, self).__init__(host, port_name, **kwargs)
44 self._test_runner_process_constructor = SimulatorProcess
45 self._printing_cmd_line = False
47 def version_name(self):
48 if self._os_version is None:
50 return VersionNameMap.map(self.host.platform).to_name(self._os_version, platform=IOSPort.port_name)
53 def default_baseline_search_path(self):
55 if self.get_option('webkit_test_runner'):
58 versions_to_fallback = []
59 if self.ios_version().major == self.CURRENT_VERSION.major:
60 versions_to_fallback = [self.CURRENT_VERSION]
61 elif self.ios_version():
62 temp_version = Version(self.ios_version().major)
63 while temp_version != self.CURRENT_VERSION:
64 versions_to_fallback.append(Version.from_iterable(temp_version))
65 if temp_version < self.CURRENT_VERSION:
66 temp_version.major += 1
68 temp_version.major -= 1
71 for version in versions_to_fallback:
74 apple_name = VersionNameMap.map(self.host.platform).to_name(version, platform=IOSPort.port_name, table=INTERNAL_TABLE)
77 expectations.append(self._apple_baseline_path('{}-{}-{}'.format(self.port_name, apple_name.lower().replace(' ', ''), wk_string)))
78 expectations.append(self._webkit_baseline_path('{}-{}-{}'.format(self.port_name, version.major, wk_string)))
80 expectations.append(self._apple_baseline_path('{}-{}'.format(self.port_name, apple_name.lower().replace(' ', ''))))
81 expectations.append(self._webkit_baseline_path('{}-{}'.format(self.port_name, version.major)))
84 expectations.append(self._apple_baseline_path('{}-{}'.format(self.port_name, wk_string)))
85 expectations.append(self._webkit_baseline_path('{}-{}'.format(self.port_name, wk_string)))
87 expectations.append(self._apple_baseline_path(self.port_name))
88 expectations.append(self._webkit_baseline_path(self.port_name))
90 for version in versions_to_fallback:
93 apple_name = VersionNameMap.map(self.host.platform).to_name(version, platform=IOSPort.port_name, table=INTERNAL_TABLE)
95 expectations.append(self._apple_baseline_path('{}-{}'.format(IOSPort.port_name, apple_name.lower().replace(' ', ''))))
96 expectations.append(self._webkit_baseline_path('{}-{}'.format(IOSPort.port_name, version.major)))
99 expectations.append(self._apple_baseline_path('{}-{}'.format(IOSPort.port_name, wk_string)))
100 expectations.append(self._webkit_baseline_path('{}-{}'.format(IOSPort.port_name, wk_string)))
101 if apple_additions():
102 expectations.append(self._apple_baseline_path(IOSPort.port_name))
103 expectations.append(self._webkit_baseline_path(IOSPort.port_name))
105 if self.get_option('webkit_test_runner'):
106 expectations.append(self._webkit_baseline_path('wk2'))
110 def test_expectations_file_position(self):
113 def ios_version(self):
114 raise NotImplementedError