Skip to content

Commit 2c91c54

Browse files
authored
Allow simulator tests on Apple Silicon (#65700)
Some of the conditions in lit.cfg assume a simulator always targets Intel, but this is not true after the introduction of Apple Silicon. Rely instead on run_environment. Addresses rdar://108751951, rdar://108788348
2 parents 6a41cbd + a9501e0 commit 2c91c54

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

test/lit.cfg

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -921,8 +921,8 @@ if run_os in ('maccatalyst',):
921921
target_os_abi = 'macosx'
922922
target_os_is_maccatalyst = "TRUE"
923923
config.available_features.add("OS=ios")
924-
# macOS on ASi uses the stable ABI
925-
if run_os in ('macosx',) and run_cpu in ('arm64',):
924+
# macOS and simulators on ASi use the stable ABI
925+
if (run_os in ('macosx',) or 'simulator' in run_environment) and run_cpu in ('arm64',):
926926
target_mandates_stable_abi = "TRUE"
927927
config.available_features.add('swift_only_stable_abi')
928928
if run_os in (
@@ -1159,13 +1159,13 @@ if run_vendor == 'apple':
11591159
target_future_version = ''
11601160

11611161
# Only permit non-executable tests for ARM on Darwin unless you are on macOS
1162-
if 'arm' in run_cpu and run_os not in ('macosx',):
1162+
if 'simulator' not in run_environment and run_os not in ('macosx',):
11631163
if swift_test_mode != 'only_non_executable':
11641164
raise RuntimeError('Device tests are currently only supported when '
11651165
'the swift_test_mode is "only_non_executable". Current '
11661166
'swift_test_mode is {}.'.format(swift_test_mode))
11671167

1168-
if 'arm' in run_cpu and not (run_os == 'macosx' or run_os == 'maccatalyst'):
1168+
if 'simulator' not in run_environment and not (run_os == 'macosx' or run_os == 'maccatalyst'):
11691169
# iOS/tvOS/watchOS device
11701170
if run_os == 'ios':
11711171
lit_config.note('Testing iOS ' + config.variant_triple)
@@ -1204,7 +1204,7 @@ if run_vendor == 'apple':
12041204
(sw_vers_name, sw_vers_vers, sw_vers_build) = \
12051205
darwin_get_sdk_version(config.variant_sdk)
12061206

1207-
elif run_os == 'ios' or run_os == 'tvos' or run_os == 'watchos':
1207+
elif 'simulator' in run_environment:
12081208
# iOS/tvOS/watchOS simulator
12091209
if run_os == 'ios':
12101210
config.available_features.add('DARWIN_SIMULATOR=ios')

0 commit comments

Comments
 (0)