Skip to content

Commit b951a35

Browse files
committed
Enhance _extra_os_version function to handle special version patterns for iOS
1 parent 8710f14 commit b951a35

File tree

1 file changed

+23
-7
lines changed

1 file changed

+23
-7
lines changed

xctestrunner/simulator_control/simtype_profile.py

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,26 @@ def max_os_version(self):
9999

100100
def _extra_os_version(os_version_str):
101101
"""Extracts os version float value from a given string."""
102-
# Cut build version. E.g., cut 9.3.3 to 9.3.
103-
if os_version_str.count('.') > 1:
104-
os_version_str = os_version_str[:os_version_str.rfind('.')]
105-
# We need to round the os version string in the simulator profile. E.g.,
106-
# the maxRuntimeVersion of iPhone 5 is 10.255.255 and we could create iOS 10.3
107-
# for iPhone 5.
108-
return round(float(os_version_str), 1)
102+
# Handle Apple's special version patterns:
103+
# - x.255.255 or x.99.0 means "any version within major version x"
104+
# - 65535.255.255 means "no version limit"
105+
106+
parts = os_version_str.split('.')
107+
major = int(parts[0])
108+
109+
# Handle unlimited version (65535.x.x)
110+
if major >= 65535:
111+
return 999.99 # Return a very high version number for unlimited support
112+
113+
if len(parts) >= 2:
114+
minor = int(parts[1])
115+
116+
# Handle x.255.x or x.99.x patterns - both mean "any minor version within major x"
117+
if minor >= 99:
118+
return float(f"{major}.99")
119+
120+
# Handle normal version patterns - use major.minor
121+
return float(f"{major}.{minor}")
122+
123+
# Fallback for simple major version
124+
return float(major)

0 commit comments

Comments
 (0)