Skip to content

Commit f405ad4

Browse files
committed
Update tests
1 parent 18681c4 commit f405ad4

File tree

3 files changed

+15
-79
lines changed

3 files changed

+15
-79
lines changed

test/IRGen/package_resilience.swift

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,15 @@
11
//
2-
// Unlike its counterparts in the other *_resilience.swift files, the goal is
3-
// for the package's component modules to all be considered within the same
4-
// resilience domain. This file ensures that we use direct access to package
5-
// decls at use site as much as possible with -experimental-package-bypass-resilience.
2+
// Tests resilient access is bypassed when package optimization flags are passed.
63
//
7-
84
// RUN: %empty-directory(%t)
95
// RUN: %{python} %utils/chex.py < %s > %t/package_resilience.swift
10-
// RUN: %target-swift-frontend -package-name MyPkg -emit-module -enable-library-evolution -emit-module-path=%t/resilient_struct.swiftmodule -module-name=resilient_struct -experimental-allow-non-resilient-access %S/Inputs/package_types/resilient_struct.swift
11-
// RUN: %target-swift-frontend -package-name MyPkg -emit-module -enable-library-evolution -emit-module-path=%t/resilient_enum.swiftmodule -module-name=resilient_enum -I %t %S/Inputs/package_types/resilient_enum.swift -experimental-allow-non-resilient-access
12-
// RUN: %target-swift-frontend -package-name MyPkg -emit-module -enable-library-evolution -emit-module-path=%t/resilient_class.swiftmodule -module-name=resilient_class -I %t %S/Inputs/package_types/resilient_class.swift -experimental-allow-non-resilient-access
6+
// RUN: %target-swift-frontend -package-name MyPkg -emit-module -enable-library-evolution -emit-module-path=%t/resilient_struct.swiftmodule -module-name=resilient_struct -allow-non-resilient-access -package-cmo %S/Inputs/package_types/resilient_struct.swift
7+
// RUN: %target-swift-frontend -package-name MyPkg -emit-module -enable-library-evolution -emit-module-path=%t/resilient_enum.swiftmodule -module-name=resilient_enum -I %t %S/Inputs/package_types/resilient_enum.swift -allow-non-resilient-access -package-cmo
8+
// RUN: %target-swift-frontend -package-name MyPkg -emit-module -enable-library-evolution -emit-module-path=%t/resilient_class.swiftmodule -module-name=resilient_class -I %t %S/Inputs/package_types/resilient_class.swift -allow-non-resilient-access -package-cmo
139

14-
// RUN: %target-swift-frontend -package-name MyPkg -module-name=package_resilience -experimental-package-bypass-resilience -enable-objc-interop -I %t -emit-ir -enable-library-evolution %t/package_resilience.swift | %FileCheck %t/package_resilience.swift --check-prefixes=CHECK,CHECK-objc,CHECK-objc%target-ptrsize,CHECK-%target-ptrsize,CHECK-%target-cpu,CHECK-%target-import-type-objc-STABLE-ABI-%target-mandates-stable-abi,CHECK-%target-sdk-name -DINT=i%target-ptrsize -D#MDWORDS=7 -D#MDSIZE32=52 -D#MDSIZE64=80 -D#WORDSIZE=%target-alignment
10+
// RUN: %target-swift-frontend -package-name MyPkg -module-name=package_resilience -enable-objc-interop -I %t -emit-ir -enable-library-evolution %t/package_resilience.swift | %FileCheck %t/package_resilience.swift --check-prefixes=CHECK,CHECK-objc,CHECK-objc%target-ptrsize,CHECK-%target-ptrsize,CHECK-%target-cpu,CHECK-%target-import-type-objc-STABLE-ABI-%target-mandates-stable-abi,CHECK-%target-sdk-name -DINT=i%target-ptrsize -D#MDWORDS=7 -D#MDSIZE32=52 -D#MDSIZE64=80 -D#WORDSIZE=%target-alignment
1511

16-
// RUN: %target-swift-frontend -package-name MyPkg -module-name=package_resilience -experimental-package-bypass-resilience -disable-objc-interop -I %t -emit-ir -enable-library-evolution %t/package_resilience.swift | %FileCheck %t/package_resilience.swift --check-prefixes=CHECK,CHECK-native,CHECK-native%target-ptrsize,CHECK-%target-ptrsize,CHECK-%target-cpu,CHECK-native-STABLE-ABI-%target-mandates-stable-abi,CHECK-%target-sdk-name -DINT=i%target-ptrsize -D#MDWORDS=4 -D#MDSIZE32=40 -D#MDSIZE64=56 -D#WORDSIZE=%target-alignment
12+
// RUN: %target-swift-frontend -package-name MyPkg -module-name=package_resilience -disable-objc-interop -I %t -emit-ir -enable-library-evolution %t/package_resilience.swift | %FileCheck %t/package_resilience.swift --check-prefixes=CHECK,CHECK-native,CHECK-native%target-ptrsize,CHECK-%target-ptrsize,CHECK-%target-cpu,CHECK-native-STABLE-ABI-%target-mandates-stable-abi,CHECK-%target-sdk-name -DINT=i%target-ptrsize -D#MDWORDS=4 -D#MDSIZE32=40 -D#MDSIZE64=56 -D#WORDSIZE=%target-alignment
1713

1814
// RUN: %target-swift-frontend -package-name MyPkg -module-name=package_resilience -experimental-package-bypass-resilience -I %t -emit-ir -enable-library-evolution -O %t/package_resilience.swift -package-name MyPkg
1915

test/SILGen/package_allow_non_resilient_access.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
// RUN: -experimental-allow-non-resilient-access \
4545
// RUN: -emit-module -emit-module-path %t/Utils.swiftmodule \
4646
// RUN: 2>&1 | %FileCheck %s --check-prefix=CHECK-DIAG-1
47-
// CHECK-DIAG-1: warning: ignoring -experimental-skip-non-exportable-decls (overriden by -experimental-allow-non-resilient-access)
47+
// CHECK-DIAG-1: warning: ignoring -experimental-skip-non-exportable-decls (overriden by -allow-non-resilient-access)
4848
// RUN: llvm-bcanalyzer --dump %t/Utils.swiftmodule | %FileCheck %s --check-prefix=CHECK-ON
4949

5050
/// Override -experimental-skip-non-inlinable-function-bodies-without-types with warning
@@ -57,7 +57,7 @@
5757
// RUN: -experimental-allow-non-resilient-access \
5858
// RUN: -emit-module -emit-module-path %t/Utils.swiftmodule \
5959
// RUN: 2>&1 | %FileCheck %s --check-prefix=CHECK-DIAG-2
60-
// CHECK-DIAG-2: warning: ignoring -experimental-skip-non-inlinable-function-bodies-without-types (overriden by -experimental-allow-non-resilient-access)
60+
// CHECK-DIAG-2: warning: ignoring -experimental-skip-non-inlinable-function-bodies-without-types (overriden by -allow-non-resilient-access)
6161
// RUN: llvm-bcanalyzer --dump %t/Utils.swiftmodule | %FileCheck %s --check-prefix=CHECK-ON
6262

6363
/// Override -experimental-skip-non-inlinable-function-bodies with warning
@@ -70,7 +70,7 @@
7070
// RUN: -experimental-allow-non-resilient-access \
7171
// RUN: -emit-module -emit-module-path %t/Utils.swiftmodule \
7272
// RUN: 2>&1 | %FileCheck %s --check-prefix=CHECK-DIAG-3
73-
// CHECK-DIAG-3: warning: ignoring -experimental-skip-non-inlinable-function-bodies (overriden by -experimental-allow-non-resilient-access)
73+
// CHECK-DIAG-3: warning: ignoring -experimental-skip-non-inlinable-function-bodies (overriden by -allow-non-resilient-access)
7474
// RUN: llvm-bcanalyzer --dump %t/Utils.swiftmodule | %FileCheck %s --check-prefix=CHECK-ON
7575

7676
/// Override -experimental-skip-all-function-bodies with warning
@@ -83,7 +83,7 @@
8383
// RUN: -experimental-allow-non-resilient-access \
8484
// RUN: -emit-module -emit-module-path %t/Utils.swiftmodule \
8585
// RUN: 2>&1 | %FileCheck %s --check-prefix=CHECK-DIAG-4
86-
// CHECK-DIAG-4: warning: ignoring -experimental-skip-all-function-bodies (overriden by -experimental-allow-non-resilient-access)
86+
// CHECK-DIAG-4: warning: ignoring -experimental-skip-all-function-bodies (overriden by -allow-non-resilient-access)
8787
// RUN: llvm-bcanalyzer --dump %t/Utils.swiftmodule | %FileCheck %s --check-prefix=CHECK-ON
8888

8989
/// Override -experimental-lazy-typecheck with warning
@@ -96,7 +96,7 @@
9696
// RUN: -experimental-allow-non-resilient-access \
9797
// RUN: -emit-module -emit-module-path %t/Utils.swiftmodule \
9898
// RUN: 2>&1 | %FileCheck %s --check-prefix=CHECK-DIAG-5
99-
// CHECK-DIAG-5: warning: ignoring -experimental-lazy-typecheck (overriden by -experimental-allow-non-resilient-access)
99+
// CHECK-DIAG-5: warning: ignoring -experimental-lazy-typecheck (overriden by -allow-non-resilient-access)
100100
// RUN: llvm-bcanalyzer --dump %t/Utils.swiftmodule | %FileCheck %s --check-prefix=CHECK-ON
101101

102102
/// Override -tbd-is-installapi with warning
@@ -109,7 +109,7 @@
109109
// RUN: -experimental-allow-non-resilient-access \
110110
// RUN: -emit-module -emit-module-path %t/Utils.swiftmodule \
111111
// RUN: 2>&1 | %FileCheck %s --check-prefix=CHECK-DIAG-TBD
112-
// CHECK-DIAG-TBD: warning: ignoring -tbd-is-installapi (overriden by -experimental-allow-non-resilient-access)
112+
// CHECK-DIAG-TBD: warning: ignoring -tbd-is-installapi (overriden by -allow-non-resilient-access)
113113
// RUN: llvm-bcanalyzer --dump %t/Utils.swiftmodule | %FileCheck %s --check-prefix=CHECK-ON
114114

115115
/// Build Utils interface files.
@@ -127,10 +127,10 @@
127127
// RUN: %target-swift-frontend -compile-module-from-interface \
128128
// RUN: -module-name Utils \
129129
// RUN: -package-name mpkg \
130-
// RUN: -experimental-allow-non-resilient-access \
130+
// RUN: -allow-non-resilient-access \
131131
// RUN: %t/Utils.package.swiftinterface -o %t/Utils.swiftmodule \
132132
// RUN: 2>&1 | %FileCheck %s --check-prefix=CHECK-DIAG-INTERFACE
133-
// CHECK-DIAG-INTERFACE: warning: ignoring -experimental-allow-non-resilient-access (overriden by -compile-module-from-interface or -typecheck-module-from-interface)
133+
// CHECK-DIAG-INTERFACE: warning: ignoring -allow-non-resilient-access (overriden by -compile-module-from-interface or -typecheck-module-from-interface)
134134
// RUN: llvm-bcanalyzer --dump %t/Utils.swiftmodule | %FileCheck %s --check-prefix=CHECK-OFF
135135
// CHECK-OFF-NOT: ALLOW_NON_RESILIENT_ACCESS
136136

test/Sema/package_resilience_bypass_exhaustive_switch.swift

Lines changed: 1 addition & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
// RUN: %target-swift-frontend -typecheck %t/ClientDefault.swift -I %t -swift-version 5 -package-name mypkg -verify
1414

15-
// RUN: %target-swift-frontend -typecheck %t/ClientOptimized.swift -I %t -swift-version 5 -package-name mypkg -experimental-package-bypass-resilience -verify
15+
// RUN: %target-swift-frontend -typecheck %t/ClientDefault.swift -I %t -swift-version 5 -package-name mypkg -experimental-package-bypass-resilience -verify
1616

1717
//--- Utils.swift
1818

@@ -163,63 +163,3 @@ public func k(_ arg: FrozenPublicEnum) -> Int {
163163
}
164164
}
165165

166-
167-
//--- ClientOptimized.swift
168-
import Utils
169-
170-
// With optimization enabled to bypass resilience checks within
171-
// a package boundary, public (non-frozen) or package (non-frozen)
172-
// enums no longer require `@unknown default` in switch stmts.
173-
package func f(_ arg: PkgEnum) -> Int {
174-
switch arg { // no-warning
175-
case .one:
176-
return 1
177-
case .two(let val):
178-
return 2 + val
179-
}
180-
}
181-
182-
package func m(_ arg: FrozenPkgEnum) -> Int {
183-
switch arg { // no-warning
184-
case .one:
185-
return 1
186-
case .two(let val):
187-
return 2 + val
188-
}
189-
}
190-
191-
package func n(_ arg: FrozenUfiPkgEnum) -> Int {
192-
switch arg { // no-warning
193-
case .one:
194-
return 1
195-
case .two(let val):
196-
return 2 + val
197-
}
198-
}
199-
200-
package func g(_ arg: UfiPkgEnum) -> Int {
201-
switch arg { // no-warning
202-
case .one:
203-
return 1
204-
case .two(let val):
205-
return 2 + val
206-
}
207-
}
208-
209-
public func h(_ arg: PublicEnum) -> Int {
210-
switch arg { // no-warning
211-
case .one:
212-
return 1
213-
case .two(let val):
214-
return 2 + val
215-
}
216-
}
217-
218-
public func k(_ arg: FrozenPublicEnum) -> Int {
219-
switch arg { // no-warning
220-
case .one:
221-
return 1
222-
case .two(let val):
223-
return 2 + val
224-
}
225-
}

0 commit comments

Comments
 (0)