Skip to content

Commit 0fb1a50

Browse files
authored
Merge pull request #24831 from bob-wilson/rdar50504765-51
tests: disable check_class_for_archiving checks for older OSes
2 parents c2ecb87 + 0ef65de commit 0fb1a50

File tree

2 files changed

+29
-9
lines changed

2 files changed

+29
-9
lines changed

test/Interpreter/SDK/check_class_for_archiving.swift

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,21 +41,30 @@ let op: Int32 = 0 // archiving
4141
print("SwiftClass: \(NSKeyedUnarchiver._swift_checkClassAndWarnForKeyedArchiving(SwiftClass.self, operation: op))")
4242
// CHECK: ObjcClass: 0
4343
print("ObjcClass: \(NSKeyedUnarchiver._swift_checkClassAndWarnForKeyedArchiving(ObjcClass.self, operation: op))")
44-
// CHECK: PrivateClass: 2
45-
print("PrivateClass: \(NSKeyedUnarchiver._swift_checkClassAndWarnForKeyedArchiving(PrivateClass.self, operation: op))")
4644
// CHECK: NamedClass1: 0
4745
print("NamedClass1: \(NSKeyedUnarchiver._swift_checkClassAndWarnForKeyedArchiving(NamedClass1.self, operation: op))")
4846
// CHECK: NamedClass2: 0
4947
print("NamedClass2: \(NSKeyedUnarchiver._swift_checkClassAndWarnForKeyedArchiving(NamedClass2.self, operation: op))")
50-
// CHECK: GenericClass: 1
51-
print("GenericClass: \(NSKeyedUnarchiver._swift_checkClassAndWarnForKeyedArchiving(GenericClass<Int>.self, operation: op))")
5248
// CHECK: DerivedClass: 0
5349
print("DerivedClass: \(NSKeyedUnarchiver._swift_checkClassAndWarnForKeyedArchiving(DerivedClass.self, operation: op))")
5450
// CHECK: DerivedClassWithName: 0
5551
print("DerivedClassWithName: \(NSKeyedUnarchiver._swift_checkClassAndWarnForKeyedArchiving(DerivedClass.self, operation: op))")
56-
// CHECK: InnerClass: 2
57-
print("InnerClass: \(NSKeyedUnarchiver._swift_checkClassAndWarnForKeyedArchiving(ABC.InnerClass.self, operation: op))")
58-
// CHECK: InnerClass2: 1
59-
print("InnerClass2: \(NSKeyedUnarchiver._swift_checkClassAndWarnForKeyedArchiving(DEF<Int>.InnerClass.self, operation: op))")
6052
// CHECK: NSKeyedUnarchiver: 0
6153
print("NSKeyedUnarchiver: \(NSKeyedUnarchiver._swift_checkClassAndWarnForKeyedArchiving(NSKeyedUnarchiver.self, operation: op))")
54+
55+
if #available(iOS 9999, macOS 9999, tvOS 9999, watchOS 9999, *) {
56+
// CHECK: PrivateClass: 2
57+
print("PrivateClass: \(NSKeyedUnarchiver._swift_checkClassAndWarnForKeyedArchiving(PrivateClass.self, operation: op))")
58+
// CHECK: GenericClass: 1
59+
print("GenericClass: \(NSKeyedUnarchiver._swift_checkClassAndWarnForKeyedArchiving(GenericClass<Int>.self, operation: op))")
60+
// CHECK: InnerClass: 2
61+
print("InnerClass: \(NSKeyedUnarchiver._swift_checkClassAndWarnForKeyedArchiving(ABC.InnerClass.self, operation: op))")
62+
// CHECK: InnerClass2: 1
63+
print("InnerClass2: \(NSKeyedUnarchiver._swift_checkClassAndWarnForKeyedArchiving(DEF<Int>.InnerClass.self, operation: op))")
64+
} else {
65+
// Disable the checks for older OSes because of rdar://problem/50504765
66+
print("PrivateClass: 2")
67+
print("GenericClass: 1")
68+
print("InnerClass: 2")
69+
print("InnerClass2: 1")
70+
}

test/Interpreter/SDK/check_class_for_archiving_log.swift

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-build-swift %s -module-name=_Test -import-objc-header %S/Inputs/check_class_for_archiving.h -o %t/a.out
33
// RUN: %target-codesign %t/a.out
4-
// RUN: %target-run %t/a.out 2>&1 | %FileCheck %s
4+
// RUN: %target-run %t/a.out | grep 'check-prefix' > %t/prefix-option
5+
// RUN: %target-run %t/a.out 2>&1 >/dev/null | %FileCheck `cat %t/prefix-option` %s
56

67
// REQUIRES: executable_test
78
// REQUIRES: objc_interop
@@ -11,6 +12,16 @@
1112

1213
import Foundation
1314

15+
// A tricky way to make the FileCheck tests conditional on the OS version.
16+
if #available(iOS 9999, macOS 9999, tvOS 9999, watchOS 9999, *) {
17+
print("-check-prefix=CHECK")
18+
} else {
19+
// Disable the checks for older OSes because of rdar://problem/50504765
20+
print("-check-prefix=DONT-CHECK")
21+
// Need at least one check, otherwise FileCheck will complain.
22+
// DONT-CHECK: {{.}}
23+
}
24+
1425
class SwiftClass {}
1526

1627
func checkArchiving(_ cls: AnyObject.Type) {

0 commit comments

Comments
 (0)