Skip to content

tests: disable check_class_for_archiving checks for older OSes #24815

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 17 additions & 8 deletions test/Interpreter/SDK/check_class_for_archiving.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,30 @@ let op: Int32 = 0 // archiving
print("SwiftClass: \(NSKeyedUnarchiver._swift_checkClassAndWarnForKeyedArchiving(SwiftClass.self, operation: op))")
// CHECK: ObjcClass: 0
print("ObjcClass: \(NSKeyedUnarchiver._swift_checkClassAndWarnForKeyedArchiving(ObjcClass.self, operation: op))")
// CHECK: PrivateClass: 2
print("PrivateClass: \(NSKeyedUnarchiver._swift_checkClassAndWarnForKeyedArchiving(PrivateClass.self, operation: op))")
// CHECK: NamedClass1: 0
print("NamedClass1: \(NSKeyedUnarchiver._swift_checkClassAndWarnForKeyedArchiving(NamedClass1.self, operation: op))")
// CHECK: NamedClass2: 0
print("NamedClass2: \(NSKeyedUnarchiver._swift_checkClassAndWarnForKeyedArchiving(NamedClass2.self, operation: op))")
// CHECK: GenericClass: 1
print("GenericClass: \(NSKeyedUnarchiver._swift_checkClassAndWarnForKeyedArchiving(GenericClass<Int>.self, operation: op))")
// CHECK: DerivedClass: 0
print("DerivedClass: \(NSKeyedUnarchiver._swift_checkClassAndWarnForKeyedArchiving(DerivedClass.self, operation: op))")
// CHECK: DerivedClassWithName: 0
print("DerivedClassWithName: \(NSKeyedUnarchiver._swift_checkClassAndWarnForKeyedArchiving(DerivedClass.self, operation: op))")
// CHECK: InnerClass: 2
print("InnerClass: \(NSKeyedUnarchiver._swift_checkClassAndWarnForKeyedArchiving(ABC.InnerClass.self, operation: op))")
// CHECK: InnerClass2: 1
print("InnerClass2: \(NSKeyedUnarchiver._swift_checkClassAndWarnForKeyedArchiving(DEF<Int>.InnerClass.self, operation: op))")
// CHECK: NSKeyedUnarchiver: 0
print("NSKeyedUnarchiver: \(NSKeyedUnarchiver._swift_checkClassAndWarnForKeyedArchiving(NSKeyedUnarchiver.self, operation: op))")

if #available(iOS 9999, macOS 9999, tvOS 9999, watchOS 9999, *) {
// CHECK: PrivateClass: 2
print("PrivateClass: \(NSKeyedUnarchiver._swift_checkClassAndWarnForKeyedArchiving(PrivateClass.self, operation: op))")
// CHECK: GenericClass: 1
print("GenericClass: \(NSKeyedUnarchiver._swift_checkClassAndWarnForKeyedArchiving(GenericClass<Int>.self, operation: op))")
// CHECK: InnerClass: 2
print("InnerClass: \(NSKeyedUnarchiver._swift_checkClassAndWarnForKeyedArchiving(ABC.InnerClass.self, operation: op))")
// CHECK: InnerClass2: 1
print("InnerClass2: \(NSKeyedUnarchiver._swift_checkClassAndWarnForKeyedArchiving(DEF<Int>.InnerClass.self, operation: op))")
} else {
// Disable the checks for older OSes because of rdar://problem/50504765
print("PrivateClass: 2")
print("GenericClass: 1")
print("InnerClass: 2")
print("InnerClass2: 1")
}
13 changes: 12 additions & 1 deletion test/Interpreter/SDK/check_class_for_archiving_log.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// RUN: %empty-directory(%t)
// RUN: %target-build-swift %s -module-name=_Test -import-objc-header %S/Inputs/check_class_for_archiving.h -o %t/a.out
// RUN: %target-codesign %t/a.out
// RUN: %target-run %t/a.out 2>&1 | %FileCheck %s
// RUN: %target-run %t/a.out | grep 'check-prefix' > %t/prefix-option
// RUN: %target-run %t/a.out 2>&1 >/dev/null | %FileCheck `cat %t/prefix-option` %s

// REQUIRES: executable_test
// REQUIRES: objc_interop
Expand All @@ -11,6 +12,16 @@

import Foundation

// A tricky way to make the FileCheck tests conditional on the OS version.
if #available(iOS 9999, macOS 9999, tvOS 9999, watchOS 9999, *) {
print("-check-prefix=CHECK")
} else {
// Disable the checks for older OSes because of rdar://problem/50504765
print("-check-prefix=DONT-CHECK")
// Need at least one check, otherwise FileCheck will complain.
// DONT-CHECK: {{.}}
}

class SwiftClass {}

func checkArchiving(_ cls: AnyObject.Type) {
Expand Down