Skip to content

Commit 578796c

Browse files
committed
[test] Update get_simulator_command for macOS 11
1 parent f69dfc2 commit 578796c

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

test/lit.cfg

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# This source file is part of the Swift.org open source project
44
#
5-
# Copyright (c) 2014 - 2020 Apple Inc. and the Swift project authors
5+
# Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
66
# Licensed under Apache License v2.0 with Runtime Library Exception
77
#
88
# See https://swift.org/LICENSE.txt for license information
@@ -81,12 +81,16 @@ def darwin_get_watchos_sim_vers():
8181
return [float(v.strip('watchOS')) for v in watchos_version_str]
8282

8383
# Returns the "prefix" command that should be prepended to the command line to
84-
# run an executable compiled for iOS or AppleTV simulator.
85-
def get_simulator_command(run_os, run_cpu, sdk_path):
86-
(name, vers, build) = darwin_get_sdk_version(sdk_path)
84+
# run an executable compiled for an iOS, tvOS, or watchOS simulator.
85+
def get_simulator_command(run_os, run_cpu):
86+
mac_ver_tuple = tuple(int(v) for v in
87+
platform.mac_ver()[0].replace('.', ' ').split())
8788
if run_os == 'ios':
8889
if run_cpu == "i386":
89-
if min(darwin_get_ios_sim_vers()) > 10.3:
90+
if mac_ver_tuple >= (11,):
91+
print("ERROR: The 32-bit iOS simulator is unavailable on macOS 11.0+")
92+
sys.exit(1)
93+
elif min(darwin_get_ios_sim_vers()) > 10.3:
9094
print("ERROR: Your system does not have a 32-bit iOS simulator installed.")
9195
print("INFO: 1. Install iOS 10.3 or older simulator (Xcode -> Preferences -> Components -> Simulators).")
9296
print("INFO: 2. Create a 32-bit iPhone 5 device. Run:")
@@ -1012,7 +1016,7 @@ if run_vendor == 'apple':
10121016
# segmentation faults)
10131017
config.target_run = (
10141018
"%s %s " %
1015-
(xcrun_prefix, get_simulator_command(run_os, run_cpu, config.variant_sdk)))
1019+
(xcrun_prefix, get_simulator_command(run_os, run_cpu)))
10161020

10171021
(sw_vers_name, sw_vers_vers, sw_vers_build) = \
10181022
darwin_get_sdk_version(config.variant_sdk)

0 commit comments

Comments
 (0)