tests: add import statements to workaround linker errors in all relevant tests.

This is needed if we compile StdlibUnittest with -sil-serialize-all
So far I added the imports only in files which needed them. But this may change, depending on the optimizer (inlining).
Adding them in all files doesn't harm and avoids confusion if someone makes an unrelated change which would result in such a linker error.
This commit is contained in:
Erik Eckstein
2016-01-21 09:01:51 -08:00
parent 63713e044e
commit adef0368bb
40 changed files with 347 additions and 0 deletions

View File

@@ -5,6 +5,14 @@
import Foundation
import StdlibUnittest
// Also import modules which are used by StdlibUnittest internally. This
// workaround is needed to link all required libraries in case we compile
// StdlibUnittest with -sil-serialize-all.
import SwiftPrivate
#if _runtime(_ObjC)
import ObjectiveC
#endif
let BoolTests = TestSuite("Bool")
BoolTests.test("Init with NSNumber") {

View File

@@ -21,6 +21,14 @@ import Swift
import SwiftShims
import StdlibUnittest
// Also import modules which are used by StdlibUnittest internally. This
// workaround is needed to link all required libraries in case we compile
// StdlibUnittest with -sil-serialize-all.
import SwiftPrivate
#if _runtime(_ObjC)
import ObjectiveC
#endif
#if _runtime(_ObjC)
import Foundation
#endif

View File

@@ -2,6 +2,14 @@
import StdlibUnittest
// Also import modules which are used by StdlibUnittest internally. This
// workaround is needed to link all required libraries in case we compile
// StdlibUnittest with -sil-serialize-all.
import SwiftPrivate
#if _runtime(_ObjC)
import ObjectiveC
#endif
//
// Check that CollectionType.SubSequence is constrained to CollectionType.
//

View File

@@ -4,6 +4,15 @@
// REQUIRES: objc_interop
import StdlibUnittest
// Also import modules which are used by StdlibUnittest internally. This
// workaround is needed to link all required libraries in case we compile
// StdlibUnittest with -sil-serialize-all.
import SwiftPrivate
#if _runtime(_ObjC)
import ObjectiveC
#endif
import Foundation
var DarwinBooleanAPI = TestSuite("DarwinBooleanAPI")

View File

@@ -18,6 +18,14 @@ import SwiftExperimental
import Foundation
import StdlibUnittest
// Also import modules which are used by StdlibUnittest internally. This
// workaround is needed to link all required libraries in case we compile
// StdlibUnittest with -sil-serialize-all.
import SwiftPrivate
#if _runtime(_ObjC)
import ObjectiveC
#endif
// Check that the generic parameters are called 'Key' and 'Value'.
protocol TestProtocol1 {}

View File

@@ -7,6 +7,14 @@ import Dispatch
import Foundation
import StdlibUnittest
// Also import modules which are used by StdlibUnittest internally. This
// workaround is needed to link all required libraries in case we compile
// StdlibUnittest with -sil-serialize-all.
import SwiftPrivate
#if _runtime(_ObjC)
import ObjectiveC
#endif
defer { runAllTests() }
var DispatchAPI = TestSuite("DispatchAPI")

View File

@@ -3,6 +3,15 @@
// REQUIRES: objc_interop
import StdlibUnittest
// Also import modules which are used by StdlibUnittest internally. This
// workaround is needed to link all required libraries in case we compile
// StdlibUnittest with -sil-serialize-all.
import SwiftPrivate
#if _runtime(_ObjC)
import ObjectiveC
#endif
import Foundation
import CoreLocation
import Darwin

View File

@@ -16,6 +16,15 @@
// XFAIL: linux
import StdlibUnittest
// Also import modules which are used by StdlibUnittest internally. This
// workaround is needed to link all required libraries in case we compile
// StdlibUnittest with -sil-serialize-all.
import SwiftPrivate
#if _runtime(_ObjC)
import ObjectiveC
#endif
import Foundation
// Check that `NonObjectiveCBase` can be subclassed and the subclass can be

View File

@@ -4,6 +4,15 @@
// REQUIRES: objc_interop
import StdlibUnittest
// Also import modules which are used by StdlibUnittest internally. This
// workaround is needed to link all required libraries in case we compile
// StdlibUnittest with -sil-serialize-all.
import SwiftPrivate
#if _runtime(_ObjC)
import ObjectiveC
#endif
import Foundation
var NSArrayAPI = TestSuite("NSArrayAPI")

View File

@@ -4,6 +4,15 @@
// REQUIRES: objc_interop
import StdlibUnittest
// Also import modules which are used by StdlibUnittest internally. This
// workaround is needed to link all required libraries in case we compile
// StdlibUnittest with -sil-serialize-all.
import SwiftPrivate
#if _runtime(_ObjC)
import ObjectiveC
#endif
import Foundation
var tests = TestSuite("NSDictionary")

View File

@@ -4,6 +4,15 @@
// REQUIRES: objc_interop
import StdlibUnittest
// Also import modules which are used by StdlibUnittest internally. This
// workaround is needed to link all required libraries in case we compile
// StdlibUnittest with -sil-serialize-all.
import SwiftPrivate
#if _runtime(_ObjC)
import ObjectiveC
#endif
import Foundation
var NSEnumeratorAPI = TestSuite("NSEnumeratorAPI")

View File

@@ -4,6 +4,15 @@
// REQUIRES: objc_interop
import StdlibUnittest
// Also import modules which are used by StdlibUnittest internally. This
// workaround is needed to link all required libraries in case we compile
// StdlibUnittest with -sil-serialize-all.
import SwiftPrivate
#if _runtime(_ObjC)
import ObjectiveC
#endif
import Foundation
var NSSetAPI = TestSuite("NSSetAPI")

View File

@@ -11,6 +11,15 @@
//
import StdlibUnittest
// Also import modules which are used by StdlibUnittest internally. This
// workaround is needed to link all required libraries in case we compile
// StdlibUnittest with -sil-serialize-all.
import SwiftPrivate
#if _runtime(_ObjC)
import ObjectiveC
#endif
import Foundation
import StdlibUnittestFoundationExtras

View File

@@ -16,6 +16,15 @@
// REQUIRES: objc_interop
import StdlibUnittest
// Also import modules which are used by StdlibUnittest internally. This
// workaround is needed to link all required libraries in case we compile
// StdlibUnittest with -sil-serialize-all.
import SwiftPrivate
#if _runtime(_ObjC)
import ObjectiveC
#endif
import Foundation
var nsValueBridging = TestSuite("NSValueBridging")

View File

@@ -8,6 +8,15 @@
import Swift
import StdlibUnittest
// Also import modules which are used by StdlibUnittest internally. This
// workaround is needed to link all required libraries in case we compile
// StdlibUnittest with -sil-serialize-all.
import SwiftPrivate
#if _runtime(_ObjC)
import ObjectiveC
#endif
import Foundation
import CoreGraphics
import SwiftShims

View File

@@ -5,6 +5,15 @@
// UNSUPPORTED: OS=watchos
import StdlibUnittest
// Also import modules which are used by StdlibUnittest internally. This
// workaround is needed to link all required libraries in case we compile
// StdlibUnittest with -sil-serialize-all.
import SwiftPrivate
#if _runtime(_ObjC)
import ObjectiveC
#endif
import SceneKit
// SceneKit is only available on iOS 8.0 and above and on OS X 10.8 and above.

View File

@@ -15,6 +15,14 @@
import Swift
import StdlibUnittest
// Also import modules which are used by StdlibUnittest internally. This
// workaround is needed to link all required libraries in case we compile
// StdlibUnittest with -sil-serialize-all.
import SwiftPrivate
#if _runtime(_ObjC)
import ObjectiveC
#endif
var UnicodeInternals = TestSuite("UnicodeInternals")
UnicodeInternals.test("copy") {

View File

@@ -20,6 +20,14 @@
import StdlibUnittest
// Also import modules which are used by StdlibUnittest internally. This
// workaround is needed to link all required libraries in case we compile
// StdlibUnittest with -sil-serialize-all.
import SwiftPrivate
#if _runtime(_ObjC)
import ObjectiveC
#endif
import FakeUnavailableObjCFramework
import Foundation

View File

@@ -11,6 +11,15 @@
// RUN: %target-run %t/main
import StdlibUnittest
// Also import modules which are used by StdlibUnittest internally. This
// workaround is needed to link all required libraries in case we compile
// StdlibUnittest with -sil-serialize-all.
import SwiftPrivate
#if _runtime(_ObjC)
import ObjectiveC
#endif
import resilient_class
import resilient_struct

View File

@@ -3,6 +3,14 @@
import StdlibUnittest
// Also import modules which are used by StdlibUnittest internally. This
// workaround is needed to link all required libraries in case we compile
// StdlibUnittest with -sil-serialize-all.
import SwiftPrivate
#if _runtime(_ObjC)
import ObjectiveC
#endif
enum ClericalErrorDomain: ErrorType {
case MisplacedDocument(name: String)
case AccidentallyErasedTape(fromMinute: Double, toMinute: Double)

View File

@@ -10,6 +10,15 @@
// RUN: %target-run %t/main
import StdlibUnittest
// Also import modules which are used by StdlibUnittest internally. This
// workaround is needed to link all required libraries in case we compile
// StdlibUnittest with -sil-serialize-all.
import SwiftPrivate
#if _runtime(_ObjC)
import ObjectiveC
#endif
import resilient_enum
import resilient_struct

View File

@@ -7,6 +7,15 @@
// RUN: %target-run %t/main
import StdlibUnittest
// Also import modules which are used by StdlibUnittest internally. This
// workaround is needed to link all required libraries in case we compile
// StdlibUnittest with -sil-serialize-all.
import SwiftPrivate
#if _runtime(_ObjC)
import ObjectiveC
#endif
import resilient_global
import resilient_struct

View File

@@ -5,6 +5,15 @@
// RUN: %target-run %t/main
import StdlibUnittest
// Also import modules which are used by StdlibUnittest internally. This
// workaround is needed to link all required libraries in case we compile
// StdlibUnittest with -sil-serialize-all.
import SwiftPrivate
#if _runtime(_ObjC)
import ObjectiveC
#endif
import resilient_struct
var ResilientStructTestSuite = TestSuite("ResilientStruct")

View File

@@ -1304,6 +1304,14 @@ public func transform<C : CollectionType>(c: C)
import StdlibUnittest
// Also import modules which are used by StdlibUnittest internally. This
// workaround is needed to link all required libraries in case we compile
// StdlibUnittest with -sil-serialize-all.
import SwiftPrivate
#if _runtime(_ObjC)
import ObjectiveC
#endif
var t = TestSuite("t")
t.test("fusion/map+reduce") {

View File

@@ -5,6 +5,15 @@
// UNSUPPORTED: OS=watchos
import StdlibUnittest
// Also import modules which are used by StdlibUnittest internally. This
// workaround is needed to link all required libraries in case we compile
// StdlibUnittest with -sil-serialize-all.
import SwiftPrivate
#if _runtime(_ObjC)
import ObjectiveC
#endif
import CoreMedia
var CoreMediaTests = TestSuite("CoreMedia")

View File

@@ -5,6 +5,15 @@
// UNSUPPORTED: OS=watchos
import StdlibUnittest
// Also import modules which are used by StdlibUnittest internally. This
// workaround is needed to link all required libraries in case we compile
// StdlibUnittest with -sil-serialize-all.
import SwiftPrivate
#if _runtime(_ObjC)
import ObjectiveC
#endif
import CoreMedia
var CMTimeTests = TestSuite("CMTime")

View File

@@ -12,6 +12,15 @@
import Darwin
import StdlibUnittest
// Also import modules which are used by StdlibUnittest internally. This
// workaround is needed to link all required libraries in case we compile
// StdlibUnittest with -sil-serialize-all.
import SwiftPrivate
#if _runtime(_ObjC)
import ObjectiveC
#endif
import Foundation
import StdlibUnittestFoundationExtras

View File

@@ -5,6 +5,15 @@
// UNSUPPORTED: OS=watchos
import StdlibUnittest
// Also import modules which are used by StdlibUnittest internally. This
// workaround is needed to link all required libraries in case we compile
// StdlibUnittest with -sil-serialize-all.
import SwiftPrivate
#if _runtime(_ObjC)
import ObjectiveC
#endif
import GameplayKit
// GameplayKit is only available on iOS 9.0 and above, OS X 10.11 and above, and

View File

@@ -5,6 +5,15 @@
import Swift
import StdlibUnittest
// Also import modules which are used by StdlibUnittest internally. This
// workaround is needed to link all required libraries in case we compile
// StdlibUnittest with -sil-serialize-all.
import SwiftPrivate
#if _runtime(_ObjC)
import ObjectiveC
#endif
import Glibc
var GlibcTestSuite = TestSuite("Glibc")

View File

@@ -6,6 +6,14 @@
import ObjectiveC
import StdlibUnittest
// Also import modules which are used by StdlibUnittest internally. This
// workaround is needed to link all required libraries in case we compile
// StdlibUnittest with -sil-serialize-all.
import SwiftPrivate
#if _runtime(_ObjC)
import ObjectiveC
#endif
var ObjectiveCTests = TestSuite("ObjectiveC")
class NSObjectWithCustomHashable : NSObject {

View File

@@ -54,6 +54,15 @@
import OpenCL
import StdlibUnittest
// Also import modules which are used by StdlibUnittest internally. This
// workaround is needed to link all required libraries in case we compile
// StdlibUnittest with -sil-serialize-all.
import SwiftPrivate
#if _runtime(_ObjC)
import ObjectiveC
#endif
import Foundation
import Darwin

View File

@@ -5,6 +5,15 @@
// UNSUPPORTED: OS=watchos
import StdlibUnittest
// Also import modules which are used by StdlibUnittest internally. This
// workaround is needed to link all required libraries in case we compile
// StdlibUnittest with -sil-serialize-all.
import SwiftPrivate
#if _runtime(_ObjC)
import ObjectiveC
#endif
import SceneKit
// SceneKit is only available on iOS 8.0 and above and on OS X 10.8 and above.

View File

@@ -11,6 +11,15 @@
// XFAIL: linux
import StdlibUnittest
// Also import modules which are used by StdlibUnittest internally. This
// workaround is needed to link all required libraries in case we compile
// StdlibUnittest with -sil-serialize-all.
import SwiftPrivate
#if _runtime(_ObjC)
import ObjectiveC
#endif
import Foundation
// For experimental Set operators

View File

@@ -9,6 +9,14 @@
import StdlibUnittest
// Also import modules which are used by StdlibUnittest internally. This
// workaround is needed to link all required libraries in case we compile
// StdlibUnittest with -sil-serialize-all.
import SwiftPrivate
#if _runtime(_ObjC)
import ObjectiveC
#endif
var TestSuiteFails = TestSuite("TestSuiteFails")
TestSuiteFails.test("fails") {

View File

@@ -3,6 +3,14 @@
import StdlibUnittest
// Also import modules which are used by StdlibUnittest internally. This
// workaround is needed to link all required libraries in case we compile
// StdlibUnittest with -sil-serialize-all.
import SwiftPrivate
#if _runtime(_ObjC)
import ObjectiveC
#endif
//
// Test OS version parsing
//

View File

@@ -2,6 +2,14 @@
import StdlibUnittest
// Also import modules which are used by StdlibUnittest internally. This
// workaround is needed to link all required libraries in case we compile
// StdlibUnittest with -sil-serialize-all.
import SwiftPrivate
#if _runtime(_ObjC)
import ObjectiveC
#endif
struct S1 {}
struct S2 {}

View File

@@ -6,6 +6,15 @@
import SwiftPrivate
import StdlibUnittest
// Also import modules which are used by StdlibUnittest internally. This
// workaround is needed to link all required libraries in case we compile
// StdlibUnittest with -sil-serialize-all.
import SwiftPrivate
#if _runtime(_ObjC)
import ObjectiveC
#endif
import Foundation
var UTF16APIs = TestSuite("UTF16APIs")

View File

@@ -4,6 +4,15 @@
import SwiftPrivate
import StdlibUnittest
// Also import modules which are used by StdlibUnittest internally. This
// workaround is needed to link all required libraries in case we compile
// StdlibUnittest with -sil-serialize-all.
import SwiftPrivate
#if _runtime(_ObjC)
import ObjectiveC
#endif
import Foundation
@_silgen_name("random") func random() -> UInt32

View File

@@ -5,6 +5,15 @@
// REQUIRES: OS=watchos
import StdlibUnittest
// Also import modules which are used by StdlibUnittest internally. This
// workaround is needed to link all required libraries in case we compile
// StdlibUnittest with -sil-serialize-all.
import SwiftPrivate
#if _runtime(_ObjC)
import ObjectiveC
#endif
import WatchKit
var WatchKitTests = TestSuite("WatchKit")

View File

@@ -11,6 +11,15 @@
// XFAIL: OS=watchos
import StdlibUnittest
// Also import modules which are used by StdlibUnittest internally. This
// workaround is needed to link all required libraries in case we compile
// StdlibUnittest with -sil-serialize-all.
import SwiftPrivate
#if _runtime(_ObjC)
import ObjectiveC
#endif
import XCTest
var XCTestTestSuite = TestSuite("XCTest")