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 Foundation
import StdlibUnittest 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") let BoolTests = TestSuite("Bool")
BoolTests.test("Init with NSNumber") { BoolTests.test("Init with NSNumber") {

View File

@@ -21,6 +21,14 @@ import Swift
import SwiftShims import SwiftShims
import StdlibUnittest 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) #if _runtime(_ObjC)
import Foundation import Foundation
#endif #endif

View File

@@ -2,6 +2,14 @@
import StdlibUnittest 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. // Check that CollectionType.SubSequence is constrained to CollectionType.
// //

View File

@@ -4,6 +4,15 @@
// REQUIRES: objc_interop // REQUIRES: objc_interop
import StdlibUnittest 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 Foundation
var DarwinBooleanAPI = TestSuite("DarwinBooleanAPI") var DarwinBooleanAPI = TestSuite("DarwinBooleanAPI")

View File

@@ -18,6 +18,14 @@ import SwiftExperimental
import Foundation import Foundation
import StdlibUnittest 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'. // Check that the generic parameters are called 'Key' and 'Value'.
protocol TestProtocol1 {} protocol TestProtocol1 {}

View File

@@ -7,6 +7,14 @@ import Dispatch
import Foundation import Foundation
import StdlibUnittest 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() } defer { runAllTests() }
var DispatchAPI = TestSuite("DispatchAPI") var DispatchAPI = TestSuite("DispatchAPI")

View File

@@ -3,6 +3,15 @@
// REQUIRES: objc_interop // REQUIRES: objc_interop
import StdlibUnittest 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 Foundation
import CoreLocation import CoreLocation
import Darwin import Darwin

View File

@@ -16,6 +16,15 @@
// XFAIL: linux // XFAIL: linux
import StdlibUnittest 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 Foundation
// Check that `NonObjectiveCBase` can be subclassed and the subclass can be // Check that `NonObjectiveCBase` can be subclassed and the subclass can be

View File

@@ -4,6 +4,15 @@
// REQUIRES: objc_interop // REQUIRES: objc_interop
import StdlibUnittest 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 Foundation
var NSArrayAPI = TestSuite("NSArrayAPI") var NSArrayAPI = TestSuite("NSArrayAPI")

View File

@@ -4,6 +4,15 @@
// REQUIRES: objc_interop // REQUIRES: objc_interop
import StdlibUnittest 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 Foundation
var tests = TestSuite("NSDictionary") var tests = TestSuite("NSDictionary")

View File

@@ -4,6 +4,15 @@
// REQUIRES: objc_interop // REQUIRES: objc_interop
import StdlibUnittest 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 Foundation
var NSEnumeratorAPI = TestSuite("NSEnumeratorAPI") var NSEnumeratorAPI = TestSuite("NSEnumeratorAPI")

View File

@@ -4,6 +4,15 @@
// REQUIRES: objc_interop // REQUIRES: objc_interop
import StdlibUnittest 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 Foundation
var NSSetAPI = TestSuite("NSSetAPI") var NSSetAPI = TestSuite("NSSetAPI")

View File

@@ -11,6 +11,15 @@
// //
import StdlibUnittest 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 Foundation
import StdlibUnittestFoundationExtras import StdlibUnittestFoundationExtras

View File

@@ -16,6 +16,15 @@
// REQUIRES: objc_interop // REQUIRES: objc_interop
import StdlibUnittest 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 Foundation
var nsValueBridging = TestSuite("NSValueBridging") var nsValueBridging = TestSuite("NSValueBridging")

View File

@@ -8,6 +8,15 @@
import Swift import Swift
import StdlibUnittest 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 Foundation
import CoreGraphics import CoreGraphics
import SwiftShims import SwiftShims

View File

@@ -5,6 +5,15 @@
// UNSUPPORTED: OS=watchos // UNSUPPORTED: OS=watchos
import StdlibUnittest 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 import SceneKit
// SceneKit is only available on iOS 8.0 and above and on OS X 10.8 and above. // 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 Swift
import StdlibUnittest 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") var UnicodeInternals = TestSuite("UnicodeInternals")
UnicodeInternals.test("copy") { UnicodeInternals.test("copy") {

View File

@@ -20,6 +20,14 @@
import StdlibUnittest 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 FakeUnavailableObjCFramework
import Foundation import Foundation

View File

@@ -11,6 +11,15 @@
// RUN: %target-run %t/main // RUN: %target-run %t/main
import StdlibUnittest 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_class
import resilient_struct import resilient_struct

View File

@@ -3,6 +3,14 @@
import StdlibUnittest 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 { enum ClericalErrorDomain: ErrorType {
case MisplacedDocument(name: String) case MisplacedDocument(name: String)
case AccidentallyErasedTape(fromMinute: Double, toMinute: Double) case AccidentallyErasedTape(fromMinute: Double, toMinute: Double)

View File

@@ -10,6 +10,15 @@
// RUN: %target-run %t/main // RUN: %target-run %t/main
import StdlibUnittest 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_enum
import resilient_struct import resilient_struct

View File

@@ -7,6 +7,15 @@
// RUN: %target-run %t/main // RUN: %target-run %t/main
import StdlibUnittest 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_global
import resilient_struct import resilient_struct

View File

@@ -5,6 +5,15 @@
// RUN: %target-run %t/main // RUN: %target-run %t/main
import StdlibUnittest 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 import resilient_struct
var ResilientStructTestSuite = TestSuite("ResilientStruct") var ResilientStructTestSuite = TestSuite("ResilientStruct")

View File

@@ -1304,6 +1304,14 @@ public func transform<C : CollectionType>(c: C)
import StdlibUnittest 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") var t = TestSuite("t")
t.test("fusion/map+reduce") { t.test("fusion/map+reduce") {

View File

@@ -5,6 +5,15 @@
// UNSUPPORTED: OS=watchos // UNSUPPORTED: OS=watchos
import StdlibUnittest 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 import CoreMedia
var CoreMediaTests = TestSuite("CoreMedia") var CoreMediaTests = TestSuite("CoreMedia")

View File

@@ -5,6 +5,15 @@
// UNSUPPORTED: OS=watchos // UNSUPPORTED: OS=watchos
import StdlibUnittest 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 import CoreMedia
var CMTimeTests = TestSuite("CMTime") var CMTimeTests = TestSuite("CMTime")

View File

@@ -12,6 +12,15 @@
import Darwin import Darwin
import StdlibUnittest 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 Foundation
import StdlibUnittestFoundationExtras import StdlibUnittestFoundationExtras

View File

@@ -5,6 +5,15 @@
// UNSUPPORTED: OS=watchos // UNSUPPORTED: OS=watchos
import StdlibUnittest 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 import GameplayKit
// GameplayKit is only available on iOS 9.0 and above, OS X 10.11 and above, and // 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 Swift
import StdlibUnittest 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 import Glibc
var GlibcTestSuite = TestSuite("Glibc") var GlibcTestSuite = TestSuite("Glibc")

View File

@@ -6,6 +6,14 @@
import ObjectiveC import ObjectiveC
import StdlibUnittest 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") var ObjectiveCTests = TestSuite("ObjectiveC")
class NSObjectWithCustomHashable : NSObject { class NSObjectWithCustomHashable : NSObject {

View File

@@ -54,6 +54,15 @@
import OpenCL import OpenCL
import StdlibUnittest 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 Foundation
import Darwin import Darwin

View File

@@ -5,6 +5,15 @@
// UNSUPPORTED: OS=watchos // UNSUPPORTED: OS=watchos
import StdlibUnittest 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 import SceneKit
// SceneKit is only available on iOS 8.0 and above and on OS X 10.8 and above. // 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 // XFAIL: linux
import StdlibUnittest 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 Foundation
// For experimental Set operators // For experimental Set operators

View File

@@ -9,6 +9,14 @@
import StdlibUnittest 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") var TestSuiteFails = TestSuite("TestSuiteFails")
TestSuiteFails.test("fails") { TestSuiteFails.test("fails") {

View File

@@ -3,6 +3,14 @@
import StdlibUnittest 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 // Test OS version parsing
// //

View File

@@ -2,6 +2,14 @@
import StdlibUnittest 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 S1 {}
struct S2 {} struct S2 {}

View File

@@ -6,6 +6,15 @@
import SwiftPrivate import SwiftPrivate
import StdlibUnittest 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 Foundation
var UTF16APIs = TestSuite("UTF16APIs") var UTF16APIs = TestSuite("UTF16APIs")

View File

@@ -4,6 +4,15 @@
import SwiftPrivate import SwiftPrivate
import StdlibUnittest 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 Foundation
@_silgen_name("random") func random() -> UInt32 @_silgen_name("random") func random() -> UInt32

View File

@@ -5,6 +5,15 @@
// REQUIRES: OS=watchos // REQUIRES: OS=watchos
import StdlibUnittest 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 import WatchKit
var WatchKitTests = TestSuite("WatchKit") var WatchKitTests = TestSuite("WatchKit")

View File

@@ -11,6 +11,15 @@
// XFAIL: OS=watchos // XFAIL: OS=watchos
import StdlibUnittest 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 import XCTest
var XCTestTestSuite = TestSuite("XCTest") var XCTestTestSuite = TestSuite("XCTest")