Skip to content

Commit a71cd56

Browse files
committed
[Test] Define concurrency_runtime feature when the concurrency runtime is there
`concurrency_runtime` covers all three cases of the concurrency runtime being available: * Build locally and we're using that version * Guaranteed available in the OS (e.g., run OS is macOS >= 12, iOS >= 15, etc.) * Available via back-deployment libraries (macOS >= 10.15, iOS >= 13, etc.)
1 parent 8cd8ca0 commit a71cd56

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

test/lit.cfg

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1899,6 +1899,38 @@ if os.path.exists(static_libswiftCore_path):
18991899
config.substitutions.append(('%target-static-stdlib-path', static_stdlib_path))
19001900
lit_config.note('using static stdlib path: %s' % static_stdlib_path)
19011901

1902+
# Determine whether the concurrency runtime is available.
1903+
if 'concurrency' in config.available_features:
1904+
if 'use_os_stdlib' not in lit_config.params:
1905+
config.available_features.add('concurrency_runtime')
1906+
elif run_vendor == 'apple':
1907+
# OS version in which concurrency was introduced
1908+
CONCURRENCY_OS_VERSION = {
1909+
'macosx': '12',
1910+
'ios': '15',
1911+
'maccatalyst': '15',
1912+
'tvos': '15',
1913+
'watchos': '8'
1914+
}
1915+
concurrency_os_version = CONCURRENCY_OS_VERSION.get(run_os, '')
1916+
1917+
# OS version to which concurrency can back-deploy
1918+
CONCURRENCY_BACK_DEPLOY_VERSION = {
1919+
'macosx': '10.15',
1920+
'ios': '13',
1921+
'maccatalyst': '13',
1922+
'tvos': '13',
1923+
'watchos': '6'
1924+
}
1925+
concurrency_back_deploy_version = CONCURRENCY_BACK_DEPLOY_VERSION.get(run_os, '')
1926+
1927+
if run_vers >= concurrency_os_version:
1928+
config.available_features.add('concurrency_runtime')
1929+
elif 'back_deploy_concurrency' in config.available_features and run_vers >= concurrency_back_deploy_version:
1930+
config.available_features.add('concurrency_runtime')
1931+
else:
1932+
config.available_features.add('concurrency_runtime')
1933+
19021934
# Set up testing with the standard libraries coming from the OS / just-built libraries
19031935
# default Swift tests to use the just-built libraries
19041936
target_stdlib_path = platform_dylib_dir
@@ -1927,7 +1959,7 @@ if not kIsWindows:
19271959
if run_os == 'maccatalyst':
19281960
os_stdlib_path = "/System/iOSSupport/usr/lib/swift:/usr/lib/swift"
19291961
if 'back_deploy_concurrency' in config.available_features:
1930-
concurrency_back_deploy_path = os.path.join(os.path.dirname(swift_obj_root), os.path.basename(swift_obj_root).replace("swift-", "backdeployconcurrency-"), 'lib', 'swift-5.5', run_os)
1962+
concurrency_back_deploy_path = os.path.join(os.path.dirname(swift_obj_root), os.path.basename(swift_obj_root).replace("swift-", "backdeployconcurrency-"), 'lib', 'swift-5.5', run_os)
19311963

19321964
all_stdlib_path = os.path.pathsep.join((os_stdlib_path, concurrency_back_deploy_path, target_stdlib_path))
19331965

0 commit comments

Comments
 (0)