Skip to content

Commit cfcef44

Browse files
authored
Merge pull request #59286 from DougGregor/back-deploy-concurrency-on-newer-os
Make back-deployed concurrency library testable on OS's that have the library built-in
2 parents de2394d + b43e864 commit cfcef44

File tree

9 files changed

+50
-22
lines changed

9 files changed

+50
-22
lines changed

test/Concurrency/Backdeploy/linking.swift

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,13 @@
11
// RUN: %empty-directory(%t)
2-
// RUN: %target-build-swift -target x86_64-apple-macosx12 %s -o %t/linking_direct
3-
// RUN: %target-build-swift -target x86_64-apple-macosx11 %s -o %t/linking_rpath
4-
// RUN: %target-build-swift -target x86_64-apple-macosx10.10 %s -o %t/linking_rpath_old
2+
// RUN: %target-build-swift -target %target-cpu-apple-macosx12 %s -o %t/linking_direct
3+
// RUN: %target-build-swift -target %target-cpu-apple-macosx11 %s -o %t/linking_rpath
4+
// RUN: %target-build-swift -target %target-cpu-apple-macosx10.10 %s -o %t/linking_rpath_old
55

66
// RUN: otool -L %t/linking_direct | %FileCheck -check-prefix CHECK-DIRECT %s
77
// RUN: otool -L %t/linking_rpath | %FileCheck -check-prefix CHECK-RPATH %s
88
// RUN: otool -L %t/linking_rpath_old | %FileCheck -check-prefix CHECK-RPATH %s
99

10-
// RUN: %target-build-swift -disable-autolinking-runtime-compatibility-concurrency -target x86_64-apple-ios15.0-macabi %s -o %t/linking_direct
11-
// RUN: %target-build-swift -disable-autolinking-runtime-compatibility-concurrency -target x86_64-apple-ios14.0-macabi %s -o %t/linking_rpath
12-
13-
// RUN: otool -L %t/linking_direct | %FileCheck -check-prefix CHECK-DIRECT %s
14-
// RUN: otool -L %t/linking_rpath | %FileCheck -check-prefix CHECK-RPATH %s
15-
1610
// REQUIRES: OS=macosx
17-
// REQUIRES: CPU=x86_64
18-
// REQUIRES: maccatalyst_support
1911

2012
// CHECK-DIRECT: /usr/lib/swift/libswift_Concurrency.dylib
2113
// CHECK-RPATH: @rpath/libswift_Concurrency.dylib
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: %target-build-swift -target %target-cpu-apple-macosx12 %s -o %t/linking_direct
3+
// RUN: %target-build-swift -target %target-cpu-apple-macosx11 %s -o %t/linking_rpath
4+
// RUN: %target-build-swift -target %target-cpu-apple-macosx10.10 %s -o %t/linking_rpath_old
5+
6+
// RUN: otool -L %t/linking_direct | %FileCheck -check-prefix CHECK-DIRECT %s
7+
// RUN: otool -L %t/linking_rpath | %FileCheck -check-prefix CHECK-RPATH %s
8+
// RUN: otool -L %t/linking_rpath_old | %FileCheck -check-prefix CHECK-RPATH %s
9+
10+
// RUN: %target-build-swift -disable-autolinking-runtime-compatibility-concurrency -target %target-cpu-apple-ios15.0-macabi %s -o %t/linking_direct
11+
// RUN: %target-build-swift -disable-autolinking-runtime-compatibility-concurrency -target %target-cpu-apple-ios14.0-macabi %s -o %t/linking_rpath
12+
13+
// RUN: otool -L %t/linking_direct | %FileCheck -check-prefix CHECK-DIRECT %s
14+
// RUN: otool -L %t/linking_rpath | %FileCheck -check-prefix CHECK-RPATH %s
15+
16+
// REQUIRES: OS=macosx
17+
// REQUIRES: maccatalyst_support
18+
19+
// CHECK-DIRECT: /usr/lib/swift/libswift_Concurrency.dylib
20+
// CHECK-RPATH: @rpath/libswift_Concurrency.dylib
21+
22+
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
23+
public struct X {
24+
public func f() async -> Int { return 0 }
25+
public func g() async -> Int {
26+
await f()
27+
}
28+
}

test/Concurrency/Backdeploy/mangling.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
// RUN: %empty-directory(%t)
2-
// RUN: %target-swift-frontend %s -target x86_64-apple-macosx12.0 -module-name main -emit-ir -o %t/new.ir
2+
// RUN: %target-swift-frontend %s -target %target-cpu-apple-macosx12.0 -module-name main -emit-ir -o %t/new.ir
33
// RUN: %FileCheck %s --check-prefix=NEW < %t/new.ir
4-
// RUN: %target-swift-frontend %s -target x86_64-apple-macosx10.15 -module-name main -emit-ir -o %t/old.ir -disable-availability-checking
4+
// RUN: %target-swift-frontend %s -target %target-cpu-apple-macosx10.15 -module-name main -emit-ir -o %t/old.ir -disable-availability-checking
55
// RUN: %FileCheck %s --check-prefix=OLD < %t/old.ir
66

77
// Check that we add extra type metadata accessors for new kinds of functions
88
// when back-deploying. These are used instead of using demangling cache
99
// variables since old runtimes cannot synthesize type metadata based on the
1010
// new mangling.
1111

12-
// RUN: %target-build-swift -target x86_64-apple-macosx10.15 %s -o %t/test_mangling -Xfrontend -disable-availability-checking
12+
// RUN: %target-build-swift -target %target-cpu-apple-macosx10.15 %s -o %t/test_mangling -Xfrontend -disable-availability-checking
1313
// RUN: %target-run %t/test_mangling
1414

15-
// REQUIRES: CPU=x86_64
15+
// REQUIRESx: CPU=x86_64
1616
// REQUIRES: OS=macosx
1717
// REQUIRES: executable_test
1818
// REQUIRES: concurrency_runtime

test/Concurrency/Backdeploy/objc_actor.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
// RUN: %empty-directory(%t)
2-
// RUN: %target-build-swift -target x86_64-apple-macosx10.15 %s -o %t/test_backdeploy -Xfrontend -parse-as-library
2+
// RUN: %target-build-swift -target %target-cpu-apple-macosx11 %s -o %t/test_backdeploy -Xfrontend -parse-as-library
33
// RUN: %target-run %t/test_backdeploy
44

5-
// REQUIRES: CPU=x86_64
65
// REQUIRES: OS=macosx
76
// REQUIRES: executable_test
87
// REQUIRES: concurrency_runtime

test/Concurrency/Runtime/exclusivity.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// REQUIRES: concurrency_runtime
77
// UNSUPPORTED: back_deployment_runtime
88
// UNSUPPORTED: OS=wasi
9-
// UNSUPPORTED: use_os_stdlib
9+
// UNSUPPORTED: back_deploy_concurrency
1010

1111
// This test makes sure that:
1212
//

test/Concurrency/Runtime/exclusivity_custom_executors.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,11 @@
66
// rdar://76038845
77
// UNSUPPORTED: back_deployment_runtime
88
// REQUIRES: concurrency_runtime
9+
// UNSUPPORTED: back_deploy_concurrency
910

1011
// Crash expectations can't be implemented on WASI/WebAssembly.
1112
// UNSUPPORTED: OS=wasi
1213

13-
// UNSUPPORTED: use_os_stdlib
14-
1514
// This test makes sure that we properly save/restore access when we
1615
// synchronously launch a task from a serial executor. The access from the task
1716
// should be merged into the already created access set while it runs and then

test/Concurrency/async_task_base_priority.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
// rdar://76038845
88
// REQUIRES: concurrency_runtime
99
// UNSUPPORTED: back_deployment_runtime
10+
// UNSUPPORTED: back_deploy_concurrency
1011

1112
import StdlibUnittest
1213
import Dispatch

test/Concurrency/async_task_priority.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
// rdar://76038845
1212
// REQUIRES: concurrency_runtime
1313
// UNSUPPORTED: back_deployment_runtime
14+
// UNSUPPORTED: back_deploy_concurrency
1415

1516
import Darwin
1617
@preconcurrency import Dispatch

test/lit.cfg

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1808,7 +1808,8 @@ if back_deployment_runtime is not None:
18081808

18091809
concurrency_back_deploy_path = ''
18101810
if run_vendor == 'apple':
1811-
if 'back_deploy_concurrency' in config.available_features:
1811+
if 'back_deploy_concurrency' in lit_config.params:
1812+
config.available_features.add('back_deploy_concurrency')
18121813
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)
18131814

18141815
def os_stdlib_paths():
@@ -2097,6 +2098,13 @@ if 'concurrency' in config.available_features:
20972098
config.available_features.add('concurrency_runtime')
20982099
elif 'back_deploy_concurrency' in config.available_features and run_vers >= concurrency_back_deploy_version:
20992100
config.available_features.add('concurrency_runtime')
2101+
elif 'back_deploy_concurrency' in config.available_features:
2102+
print('Disabled concurrency runtime tests because run version',
2103+
run_vers, "< back deploy version",
2104+
concurrency_back_deploy_version)
2105+
else:
2106+
print('Disable concurrency runtime tests because run version',
2107+
run_vers, 'is too old and back-deployment is not enabled')
21002108
else:
21012109
config.available_features.add('concurrency_runtime')
21022110

@@ -2121,7 +2129,7 @@ elif not kIsWindows:
21212129
if 'use_os_stdlib' in lit_config.params:
21222130
config.available_features.add('use_os_stdlib')
21232131

2124-
target_stdlib_path = os_stdlib_paths() + [concurrency_back_deploy_path] + target_stdlib_path
2132+
target_stdlib_path = [concurrency_back_deploy_path] + os_stdlib_paths() + target_stdlib_path
21252133

21262134
lit_config.note('Testing with the standard libraries in the OS')
21272135
elif 'back_deployment_runtime' in lit_config.params:

0 commit comments

Comments
 (0)