Skip to content

Commit cd2946b

Browse files
committed
Disable test on windows since %env not supported
1 parent 1b2f8c3 commit cd2946b

File tree

1 file changed

+178
-0
lines changed

1 file changed

+178
-0
lines changed
Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
// RUN: %empty-directory(%t/src)
2+
// RUN: split-file %s %t/src
3+
4+
/// Build the fake actor systems lib
5+
// RUN: %target-build-swift \
6+
// RUN: -target %target-swift-6.0-abi-triple \
7+
// RUN: -parse-as-library -emit-library \
8+
// RUN: -emit-module-path %t/FakeDistributedActorSystems.swiftmodule \
9+
// RUN: -module-name FakeDistributedActorSystems \
10+
// RUN: %S/../Inputs/FakeDistributedActorSystems.swift \
11+
// RUN: -enable-library-evolution \
12+
// RUN: -Xfrontend -validate-tbd-against-ir=all \
13+
// RUN: -o %t/%target-library-name(FakeDistributedActorSystems)
14+
15+
/// Build the Lib
16+
// RUN: %target-build-swift \
17+
// RUN: -target %target-swift-6.0-abi-triple \
18+
// RUN: -parse-as-library -emit-library \
19+
// RUN: -emit-module-path %t/ResilientAPILib.swiftmodule \
20+
// RUN: -module-name ResilientAPILib \
21+
// RUN: -I %t \
22+
// RUN: -L %t \
23+
// RUN: -plugin-path %swift-plugin-dir \
24+
// RUN: %t/src/ResilientAPILib.swift \
25+
// RUN: -lFakeDistributedActorSystems \
26+
// RUN: -enable-library-evolution \
27+
// RUN: -Xfrontend -validate-tbd-against-ir=all \
28+
// RUN: -o %t/%target-library-name(ResilientAPILib)
29+
30+
/// Build the ActorLib
31+
// RUN: %target-build-swift \
32+
// RUN: -target %target-swift-6.0-abi-triple \
33+
// RUN: -parse-as-library -emit-library \
34+
// RUN: -emit-module-path %t/ResilientImplLib.swiftmodule \
35+
// RUN: -module-name ResilientImplLib \
36+
// RUN: -I %t \
37+
// RUN: -L %t \
38+
// RUN: %t/src/ResilientImplLib.swift \
39+
// RUN: -lFakeDistributedActorSystems \
40+
// RUN: -lResilientAPILib \
41+
// RUN: -enable-library-evolution \
42+
// RUN: -Xfrontend -validate-tbd-against-ir=all \
43+
// RUN: -o %t/%target-library-name(ResilientImplLib)
44+
45+
/// Build the client
46+
// RUN: %target-build-swift \
47+
// RUN: -target %target-swift-6.0-abi-triple \
48+
// RUN: -parse-as-library \
49+
// RUN: -lFakeDistributedActorSystems \
50+
// RUN: -lResilientAPILib \
51+
// RUN: -lResilientImplLib \
52+
// RUN: -module-name main \
53+
// RUN: -I %t \
54+
// RUN: -L %t \
55+
// RUN: %s \
56+
// RUN: -enable-library-evolution \
57+
// RUN: -Xfrontend -validate-tbd-against-ir=all \
58+
// RUN: -o %t/a.out
59+
60+
// Sign the main binary and all libraries
61+
// RUN: %target-codesign %t/a.out
62+
// RUN: %target-codesign %t/%target-library-name(FakeDistributedActorSystems)
63+
// RUN: %target-codesign %t/%target-library-name(ResilientAPILib)
64+
// RUN: %target-codesign %t/%target-library-name(ResilientImplLib)
65+
66+
// Run and verify output
67+
// RUN: %env-SWIFT_DUMP_ACCESSIBLE_FUNCTIONS=true %target-run %t/a.out \
68+
// RUN: %t/%target-library-name(FakeDistributedActorSystems) \
69+
// RUN: %t/%target-library-name(ResilientAPILib) \
70+
// RUN: %t/%target-library-name(ResilientImplLib) \
71+
// RUN: 2>&1 \
72+
// RUN: | %FileCheck %s --color --dump-input=always
73+
74+
// REQUIRES: executable_test
75+
// REQUIRES: concurrency
76+
// REQUIRES: distributed
77+
78+
// Locating the built libraries failed on Linux (construction of test case),
79+
// but we primarily care about macOS in this test
80+
// UNSUPPORTED: OS=linux-gnu
81+
82+
// %env does not seem to work on Windows
83+
// UNSUPPORTED: OS=windows-msvc
84+
85+
// UNSUPPORTED: use_os_stdlib
86+
// UNSUPPORTED: back_deployment_runtime
87+
// UNSUPPORTED: remote_run || device_run
88+
89+
90+
// FIXME: Also reproduces the following issue rdar://128284016
91+
//<unknown>:0: error: symbol '$s15ResilientAPILib30ServiceProtocolP8getArray2a12a2SayAA8ResponseVGSaySiG_SSSgtYaKFTj' (dispatch thunk of ResilientAPILib.ServiceProtocol.getArray(a1: Swift.Array<Swift.Int>, a2: Swift.Optional<Swift.String>) async throws -> Swift.Array<ResilientAPILib.Response>) is in generated IR file, but not in TBD file
92+
93+
//<unknown>:0: error: symbol '$s15ResilientAPILib30ServiceProtocolP8getArray2a12a2SayAA8ResponseVGSaySiG_SSSgtYaKFTjTu' (async function pointer to dispatch thunk of ResilientAPILib.ServiceProtocol.getArray(a1: Swift.Array<Swift.Int>, a2: Swift.Optional<Swift.String>) async throws -> Swift.Array<ResilientAPILib.Response>) is in generated IR file, but not in TBD file
94+
95+
//--- ResilientAPILib.swift
96+
97+
import Distributed
98+
import FakeDistributedActorSystems
99+
100+
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
101+
public struct Response: Codable {}
102+
103+
@Resolvable
104+
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
105+
public protocol ServiceProtocol: DistributedActor where ActorSystem == FakeRoundtripActorSystem {
106+
distributed func getArray(a1: [Int], a2: String?) -> [Response]
107+
}
108+
109+
//--- ResilientImplLib.swift
110+
111+
import ResilientAPILib
112+
113+
import Distributed
114+
import FakeDistributedActorSystems
115+
116+
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
117+
public distributed actor ServiceImpl: ServiceProtocol {
118+
public typealias ActorSystem = FakeRoundtripActorSystem
119+
120+
public distributed func getArray(a1: [Int], a2: String?) -> [Response] {
121+
[]
122+
}
123+
}
124+
125+
//--- Main.swift
126+
127+
import ResilientAPILib
128+
import ResilientImplLib
129+
130+
import Distributed
131+
import FakeDistributedActorSystems
132+
133+
@main
134+
struct Main {
135+
static func main() async throws {
136+
if #available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) {
137+
let system = FakeRoundtripActorSystem()
138+
139+
let real: any ServiceProtocol = ServiceImpl(actorSystem: system)
140+
141+
let proxy: any ServiceProtocol =
142+
try $ServiceProtocol.resolve(id: real.id, using: system)
143+
144+
// just in order to see if we crash and trigger the accessible funcs printout
145+
_ = try await proxy.getArray(a1: [], a2: "")
146+
147+
// === We expect records for accessible functions from other modules as well,
148+
// and especially we want to see records for the `$` macro generated stubs,
149+
// including
150+
151+
// CHECK: ==== Accessible Function Records ====
152+
// CHECK: Record name: $s16ResilientImplLib07ServiceB0C8getArray2a12a2Say0A6APILib8ResponseVGSaySiG_SSSgtYaKFTE
153+
// CHECK: Demangled: distributed thunk ResilientImplLib.ServiceImpl.getArray(a1: Swift.Array<Swift.Int>, a2: Swift.Optional<Swift.String>) async throws -> Swift.Array<ResilientAPILib.Response>
154+
155+
// CHECK: Record name: $s15ResilientAPILib15ServiceProtocolPAA11Distributed01_E9ActorStubRzrlE8getArray2a12a2SayAA8ResponseVGSaySiG_SSSgtYaKFTE
156+
// CHECK: Demangled: distributed thunk (extension in ResilientAPILib):ResilientAPILib.ServiceProtocol< where A: Distributed._DistributedActorStub>.getArray(a1: Swift.Array<Swift.Int>, a2: Swift.Optional<Swift.String>) async throws -> Swift.Array<ResilientAPILib.Response>
157+
158+
// CHECK: Record name: $s15ResilientAPILib16$ServiceProtocolC8getArray2a12a2SayAA8ResponseVGSaySiG_SSSgtYaKFTE
159+
// CHECK: Demangled: distributed thunk ResilientAPILib.$ServiceProtocol.getArray(a1: Swift.Array<Swift.Int>, a2: Swift.Optional<Swift.String>) async throws -> Swift.Array<ResilientAPILib.Response>
160+
161+
// CHECK: Record name: $s4main15ServiceProtocolPAA11Distributed01_D9ActorStubRzrlE8getArray2a12a2SayAA8ResponseVGSaySiG_SSSgtYaKFTE
162+
// CHECK: Demangled: distributed thunk (extension in main):main.ServiceProtocol< where A: Distributed._DistributedActorStub>.getArray(a1: Swift.Array<Swift.Int>, a2: Swift.Optional<Swift.String>) async throws -> Swift.Array<main.Response>
163+
164+
// CHECK: Record name: $s4main11ServiceImplC8getArray2a12a2SayAA8ResponseVGSaySiG_SSSgtYaKFTE
165+
// CHECK: Demangled: distributed thunk main.ServiceImpl.getArray(a1: Swift.Array<Swift.Int>, a2: Swift.Optional<Swift.String>) async throws -> Swift.Array<main.Response>
166+
167+
// CHECK: Record name: $s4main16$ServiceProtocolC8getArray2a12a2SayAA8ResponseVGSaySiG_SSSgtYaKFTE
168+
// CHECK: Demangled: distributed thunk main.$ServiceProtocol.getArray(a1: Swift.Array<Swift.Int>, a2: Swift.Optional<Swift.String>) async throws -> Swift.Array<main.Response>
169+
170+
// We expect these to be the exact records we get, no other ones:
171+
// CHECK: Record count: 6
172+
173+
// CHECK: ==== End of Accessible Function Records ====
174+
175+
print("DONE") // CHECK: DONE
176+
}
177+
}
178+
}

0 commit comments

Comments
 (0)