Skip to content

Commit 9b21742

Browse files
committed
[Distributed] Adjust accessor tests to match Windows/Linux section name correctly
1 parent 151bae1 commit 9b21742

4 files changed

+419
-60
lines changed
Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: %target-swift-frontend-emit-module -emit-module-path %t/FakeDistributedActorSystems.swiftmodule -module-name FakeDistributedActorSystems -disable-availability-checking %S/Inputs/FakeDistributedActorSystems.swift
3+
// RUN: %target-swift-frontend -emit-irgen -module-name distributed_actor_accessors -enable-experimental-distributed -disable-availability-checking -I %t 2>&1 %s | %IRGenFileCheck %s
4+
5+
// UNSUPPORTED: back_deploy_concurrency
6+
// REQUIRES: concurrency
7+
// REQUIRES: distributed
8+
9+
// REQUIRES: OS=windows-msvc
10+
11+
import _Distributed
12+
import FakeDistributedActorSystems
13+
14+
@available(SwiftStdlib 5.5, *)
15+
typealias DefaultDistributedActorSystem = FakeActorSystem
16+
17+
enum SimpleE : Codable {
18+
case a
19+
}
20+
21+
enum E : Codable {
22+
case a, b, c
23+
}
24+
25+
enum IndirectE : Codable {
26+
case empty
27+
indirect case test(_: Int)
28+
}
29+
30+
final class Obj : Codable, Sendable {
31+
let x: Int
32+
33+
init(x: Int) {
34+
self.x = x
35+
}
36+
}
37+
38+
struct LargeStruct : Codable {
39+
var a: Int
40+
var b: Int
41+
var c: String
42+
var d: Double
43+
}
44+
45+
@available(SwiftStdlib 5.6, *)
46+
public distributed actor MyActor {
47+
distributed func simple1(_: Int) {
48+
}
49+
50+
// `String` would be a direct result as a struct type
51+
distributed func simple2(_: Int) -> String {
52+
return ""
53+
}
54+
55+
// `String` is an object that gets exploded into two parameters
56+
distributed func simple3(_: String) -> Int {
57+
return 42
58+
}
59+
60+
// Enum with a single case are special because they have an empty
61+
// native schema so they are dropped from parameters/result.
62+
distributed func single_case_enum(_ e: SimpleE) -> SimpleE {
63+
return e
64+
}
65+
66+
distributed func with_indirect_enums(_: IndirectE, _: Int) -> IndirectE {
67+
return .empty
68+
}
69+
70+
// Combination of multiple arguments, reference type and indirect result
71+
//
72+
// Note: Tuple types cannot be used here is either position because they
73+
// cannot conform to protocols.
74+
distributed func complex(_: [Int], _: Obj, _: String?, _: LargeStruct) -> LargeStruct {
75+
fatalError()
76+
}
77+
}
78+
79+
@available(SwiftStdlib 5.6, *)
80+
public distributed actor MyOtherActor {
81+
distributed func empty() {
82+
}
83+
}
84+
85+
86+
/// ---> Let's check that distributed accessors and thunks are emitted as accessible functions
87+
88+
/// -> `MyActor.simple1`
89+
// CHECK: @"$s27distributed_actor_accessors7MyActorC7simple1yySiFTEHF" = private constant
90+
// CHECK-SAME: @"symbolic Si___________pIetMHygzo_ 27distributed_actor_accessors7MyActorC s5ErrorP"
91+
// CHECK-SAME: (%swift.async_func_pointer* @"$s27distributed_actor_accessors7MyActorC7simple1yySiFTETFTu" to i64)
92+
// CHECK-SAME: , section ".sw5acfn$B", {{.*}}
93+
94+
/// -> `MyActor.simple2`
95+
// CHECK: @"$s27distributed_actor_accessors7MyActorC7simple2ySSSiFTEHF" = private constant
96+
// CHECK-SAME: @"symbolic Si_____SS______pIetMHygozo_ 27distributed_actor_accessors7MyActorC s5ErrorP"
97+
// CHECK-SAME: (%swift.async_func_pointer* @"$s27distributed_actor_accessors7MyActorC7simple2ySSSiFTETFTu" to i64
98+
// CHECK-SAME: , section ".sw5acfn$B", {{.*}}
99+
100+
/// -> `MyActor.simple3`
101+
// CHECK: @"$s27distributed_actor_accessors7MyActorC7simple3ySiSSFTEHF" = private constant
102+
// CHECK-SAME: @"symbolic SS_____Si______pIetMHggdzo_ 27distributed_actor_accessors7MyActorC s5ErrorP"
103+
// CHECK-SAME: (%swift.async_func_pointer* @"$s27distributed_actor_accessors7MyActorC7simple3ySiSSFTETFTu" to i64)
104+
// CHECK-SAME: , section ".sw5acfn$B", {{.*}}
105+
106+
/// -> `MyActor.single_case_enum`
107+
// CHECK: @"$s27distributed_actor_accessors7MyActorC16single_case_enumyAA7SimpleEOAFFTEHF" = private constant
108+
// CHECK-SAME: @"symbolic __________AA______pIetMHygdzo_ 27distributed_actor_accessors7SimpleEO AA7MyActorC s5ErrorP"
109+
// CHECK-SAME: (%swift.async_func_pointer* @"$s27distributed_actor_accessors7MyActorC16single_case_enumyAA7SimpleEOAFFTETFTu" to i64)
110+
// CHECK-SAME: , section ".sw5acfn$B", {{.*}}
111+
112+
/// -> `MyActor.with_indirect_enums`
113+
// CHECK: @"$s27distributed_actor_accessors7MyActorC19with_indirect_enumsyAA9IndirectEOAF_SitFTEHF" = private constant
114+
// CHECK-SAME: @"symbolic _____Si_____AA______pIetMHgygozo_ 27distributed_actor_accessors9IndirectEO AA7MyActorC s5ErrorP"
115+
// CHECK-SAME: (%swift.async_func_pointer* @"$s27distributed_actor_accessors7MyActorC19with_indirect_enumsyAA9IndirectEOAF_SitFTETFTu" to i64
116+
// CHECK-SAME: , section ".sw5acfn$B", {{.*}}
117+
118+
/// -> `MyActor.complex`
119+
// CHECK: @"$s27distributed_actor_accessors7MyActorC7complexyAA11LargeStructVSaySiG_AA3ObjCSSSgAFtFTEHF" = private constant
120+
// CHECK-SAME: @"symbolic SaySiG_____SSSg__________AD______pIetMHgggngrzo_ 27distributed_actor_accessors3ObjC AA11LargeStructV AA7MyActorC s5ErrorP"
121+
// CHECK-SAME: (%swift.async_func_pointer* @"$s27distributed_actor_accessors7MyActorC7complexyAA11LargeStructVSaySiG_AA3ObjCSSSgAFtFTETFTu" to i64)
122+
// CHECK-SAME: , section ".sw5acfn$B", {{.*}}
123+
124+
/// -> `MyOtherActor.empty`
125+
// CHECK: @"$s27distributed_actor_accessors12MyOtherActorC5emptyyyFTEHF" = private constant
126+
// CHECK-SAME: @"symbolic ___________pIetMHgzo_ 27distributed_actor_accessors12MyOtherActorC s5ErrorP"
127+
// CHECK-SAME: (%swift.async_func_pointer* @"$s27distributed_actor_accessors12MyOtherActorC5emptyyyFTETFTu" to i64)
128+
// CHECK-SAME: , section ".sw5acfn$B", {{.*}}
129+
130+
// CHECK: @llvm.used = appending global [{{.*}} x i8*] [
131+
// CHECK-SAME: @"$s27distributed_actor_accessors7MyActorC7simple1yySiFTEHF"
132+
// CHECK-SAME: @"$s27distributed_actor_accessors7MyActorC7simple2ySSSiFTEHF"
133+
// CHECK-SAME: @"$s27distributed_actor_accessors7MyActorC7simple3ySiSSFTEHF"
134+
// CHECK-SAME: @"$s27distributed_actor_accessors7MyActorC16single_case_enumyAA7SimpleEOAFFTEHF"
135+
// CHECK-SAME: @"$s27distributed_actor_accessors7MyActorC19with_indirect_enumsyAA9IndirectEOAF_SitFTEHF"
136+
// CHECK-SAME: @"$s27distributed_actor_accessors7MyActorC7complexyAA11LargeStructVSaySiG_AA3ObjCSSSgAFtFTEHF"
137+
// CHECK-SAME: @"$s27distributed_actor_accessors12MyOtherActorC5emptyyyFTEHF"
138+
// CHECK-SAME: ], section "llvm.metadata"
Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: %target-swift-frontend-emit-module -emit-module-path %t/FakeDistributedActorSystems.swiftmodule -module-name FakeDistributedActorSystems -disable-availability-checking %S/Inputs/FakeDistributedActorSystems.swift
3+
// RUN: %target-swift-frontend -emit-irgen -module-name distributed_actor_accessors -enable-experimental-distributed -disable-availability-checking -I %t 2>&1 %s | %IRGenFileCheck %s
4+
5+
// UNSUPPORTED: back_deploy_concurrency
6+
// REQUIRES: concurrency
7+
// REQUIRES: distributed
8+
9+
// REQUIRES: OS=linux-gnu
10+
11+
import _Distributed
12+
import FakeDistributedActorSystems
13+
14+
@available(SwiftStdlib 5.5, *)
15+
typealias DefaultDistributedActorSystem = FakeActorSystem
16+
17+
enum SimpleE : Codable {
18+
case a
19+
}
20+
21+
enum E : Codable {
22+
case a, b, c
23+
}
24+
25+
enum IndirectE : Codable {
26+
case empty
27+
indirect case test(_: Int)
28+
}
29+
30+
final class Obj : Codable, Sendable {
31+
let x: Int
32+
33+
init(x: Int) {
34+
self.x = x
35+
}
36+
}
37+
38+
struct LargeStruct : Codable {
39+
var a: Int
40+
var b: Int
41+
var c: String
42+
var d: Double
43+
}
44+
45+
@available(SwiftStdlib 5.6, *)
46+
public distributed actor MyActor {
47+
distributed func simple1(_: Int) {
48+
}
49+
50+
// `String` would be a direct result as a struct type
51+
distributed func simple2(_: Int) -> String {
52+
return ""
53+
}
54+
55+
// `String` is an object that gets exploded into two parameters
56+
distributed func simple3(_: String) -> Int {
57+
return 42
58+
}
59+
60+
// Enum with a single case are special because they have an empty
61+
// native schema so they are dropped from parameters/result.
62+
distributed func single_case_enum(_ e: SimpleE) -> SimpleE {
63+
return e
64+
}
65+
66+
distributed func with_indirect_enums(_: IndirectE, _: Int) -> IndirectE {
67+
return .empty
68+
}
69+
70+
// Combination of multiple arguments, reference type and indirect result
71+
//
72+
// Note: Tuple types cannot be used here is either position because they
73+
// cannot conform to protocols.
74+
distributed func complex(_: [Int], _: Obj, _: String?, _: LargeStruct) -> LargeStruct {
75+
fatalError()
76+
}
77+
}
78+
79+
@available(SwiftStdlib 5.6, *)
80+
public distributed actor MyOtherActor {
81+
distributed func empty() {
82+
}
83+
}
84+
85+
86+
/// ---> Let's check that distributed accessors and thunks are emitted as accessible functions
87+
88+
/// -> `MyActor.simple1`
89+
// CHECK: @"$s27distributed_actor_accessors7MyActorC7simple1yySiFTEHF" = private constant
90+
// CHECK-SAME: @"symbolic Si___________pIetMHygzo_ 27distributed_actor_accessors7MyActorC s5ErrorP"
91+
// CHECK-SAME: (%swift.async_func_pointer* @"$s27distributed_actor_accessors7MyActorC7simple1yySiFTETFTu" to i64)
92+
// CHECK-SAME: , section "swift5_accessible_functions", {{.*}}
93+
94+
/// -> `MyActor.simple2`
95+
// CHECK: @"$s27distributed_actor_accessors7MyActorC7simple2ySSSiFTEHF" = private constant
96+
// CHECK-SAME: @"symbolic Si_____SS______pIetMHygozo_ 27distributed_actor_accessors7MyActorC s5ErrorP"
97+
// CHECK-SAME: (%swift.async_func_pointer* @"$s27distributed_actor_accessors7MyActorC7simple2ySSSiFTETFTu" to i64)
98+
// CHECK-SAME: , section "swift5_accessible_functions", {{.*}}
99+
100+
/// -> `MyActor.simple3`
101+
// CHECK: @"$s27distributed_actor_accessors7MyActorC7simple3ySiSSFTEHF" = private constant
102+
// CHECK-SAME: @"symbolic SS_____Si______pIetMHggdzo_ 27distributed_actor_accessors7MyActorC s5ErrorP"
103+
// CHECK-SAME: (%swift.async_func_pointer* @"$s27distributed_actor_accessors7MyActorC7simple3ySiSSFTETFTu" to i64)
104+
// CHECK-SAME: , section "swift5_accessible_functions", {{.*}}
105+
106+
/// -> `MyActor.single_case_enum`
107+
// CHECK: @"$s27distributed_actor_accessors7MyActorC16single_case_enumyAA7SimpleEOAFFTEHF" = private constant
108+
// CHECK-SAME: @"symbolic __________AA______pIetMHygdzo_ 27distributed_actor_accessors7SimpleEO AA7MyActorC s5ErrorP"
109+
// CHECK-SAME: (%swift.async_func_pointer* @"$s27distributed_actor_accessors7MyActorC16single_case_enumyAA7SimpleEOAFFTETFTu" to i64)
110+
// CHECK-SAME: , section "swift5_accessible_functions", {{.*}}
111+
112+
/// -> `MyActor.with_indirect_enums`
113+
// CHECK: @"$s27distributed_actor_accessors7MyActorC19with_indirect_enumsyAA9IndirectEOAF_SitFTEHF" = private constant
114+
// CHECK-SAME: @"symbolic _____Si_____AA______pIetMHgygozo_ 27distributed_actor_accessors9IndirectEO AA7MyActorC s5ErrorP"
115+
// CHECK-SAME: (%swift.async_func_pointer* @"$s27distributed_actor_accessors7MyActorC19with_indirect_enumsyAA9IndirectEOAF_SitFTETFTu" to i64)
116+
// CHECK-SAME: , section "swift5_accessible_functions", {{.*}}
117+
118+
/// -> `MyActor.complex`
119+
// CHECK: @"$s27distributed_actor_accessors7MyActorC7complexyAA11LargeStructVSaySiG_AA3ObjCSSSgAFtFTEHF" = private constant
120+
// CHECK-SAME: @"symbolic SaySiG_____SSSg__________AD______pIetMHgggngrzo_ 27distributed_actor_accessors3ObjC AA11LargeStructV AA7MyActorC s5ErrorP"
121+
// CHECK-SAME: (%swift.async_func_pointer* @"$s27distributed_actor_accessors7MyActorC7complexyAA11LargeStructVSaySiG_AA3ObjCSSSgAFtFTETFTu" to i64)
122+
// CHECK-SAME: , section "swift5_accessible_functions", {{.*}}
123+
124+
/// -> `MyOtherActor.empty`
125+
// CHECK: @"$s27distributed_actor_accessors12MyOtherActorC5emptyyyFTEHF" = private constant
126+
// CHECK-SAME: @"symbolic ___________pIetMHgzo_ 27distributed_actor_accessors12MyOtherActorC s5ErrorP"
127+
// CHECK-SAME: (%swift.async_func_pointer* @"$s27distributed_actor_accessors12MyOtherActorC5emptyyyFTETFTu" to i64)
128+
// CHECK-SAME: , section "swift5_accessible_functions", {{.*}}
129+
130+
// CHECK: @llvm.compiler.used = appending global [{{.*}} x i8*] [
131+
// CHECK-SAME: @"$s27distributed_actor_accessors7MyActorC7simple1yySiFTEHF"
132+
// CHECK-SAME: @"$s27distributed_actor_accessors7MyActorC7simple2ySSSiFTEHF"
133+
// CHECK-SAME: @"$s27distributed_actor_accessors7MyActorC7simple3ySiSSFTEHF"
134+
// CHECK-SAME: @"$s27distributed_actor_accessors7MyActorC16single_case_enumyAA7SimpleEOAFFTEHF"
135+
// CHECK-SAME: @"$s27distributed_actor_accessors7MyActorC19with_indirect_enumsyAA9IndirectEOAF_SitFTEHF"
136+
// CHECK-SAME: @"$s27distributed_actor_accessors7MyActorC7complexyAA11LargeStructVSaySiG_AA3ObjCSSSgAFtFTEHF"
137+
// CHECK-SAME: @"$s27distributed_actor_accessors12MyOtherActorC5emptyyyFTEHF"
138+
// CHECK-SAME: ], section "llvm.metadata"

0 commit comments

Comments
 (0)