Skip to content

Commit 308f39f

Browse files
committed
stdlib tests: add import statements to prevent unresolved symbols when compiling StdlibUnittest with -sil-serialize-all.
rdar://problem/18917405
1 parent 5e73426 commit 308f39f

18 files changed

+132
-0
lines changed

test/1_stdlib/ArrayTraps.swift.gyb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@
1212

1313
import StdlibUnittest
1414

15+
// Also import modules which are used by StdlibUnittest internally. This is
16+
// needed to link all required libraries in case we serialize StdlibUnittest.
17+
import SwiftPrivate
18+
#if _runtime(_ObjC)
19+
import ObjectiveC
20+
#endif
21+
1522
%{
1623
# We test for bounds-checking traps for both reading and writing
1724
# both single elements and slices of all three different array

test/1_stdlib/CharacterTraps.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@
99

1010
import StdlibUnittest
1111

12+
// Also import modules which are used by StdlibUnittest internally. This is
13+
// needed to link all required libraries in case we serialize StdlibUnittest.
14+
import SwiftPrivate
15+
#if _runtime(_ObjC)
16+
import ObjectiveC
17+
#endif
18+
19+
1220
var CharacterTraps = TestSuite("CharacterTraps")
1321

1422
CharacterTraps.test("CharacterFromEmptyString")

test/1_stdlib/DictionaryTraps.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@
1313
import StdlibUnittest
1414
import Foundation
1515

16+
// Also import modules which are used by StdlibUnittest internally. This is
17+
// needed to link all required libraries in case we serialize StdlibUnittest.
18+
import SwiftPrivate
19+
#if _runtime(_ObjC)
20+
import ObjectiveC
21+
#endif
22+
1623
struct NotBridgedKeyTy : Equatable, Hashable {
1724
init(_ value: Int) {
1825
self.value = value

test/1_stdlib/DictionaryUnchecked.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@
66

77
import StdlibUnittest
88

9+
// Also import modules which are used by StdlibUnittest internally. This is
10+
// needed to link all required libraries in case we serialize StdlibUnittest.
11+
import SwiftPrivate
12+
#if _runtime(_ObjC)
13+
import ObjectiveC
14+
#endif
15+
916
var DictionaryUnchecked = TestSuite("DictionaryUnchecked")
1017

1118
DictionaryUnchecked.test("noCseOnInit") {

test/1_stdlib/Index.swift.gyb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@
1818

1919
import StdlibUnittest
2020

21+
// Also import modules which are used by StdlibUnittest internally. This is
22+
// needed to link all required libraries in case we serialize StdlibUnittest.
23+
import SwiftPrivate
24+
#if _runtime(_ObjC)
25+
import ObjectiveC
26+
#endif
27+
2128
struct DistanceToTest {
2229
let startIndex: Int
2330
let endIndex: Int

test/1_stdlib/IntervalTraps.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@
2020

2121
import StdlibUnittest
2222

23+
// Also import modules which are used by StdlibUnittest internally. This is
24+
// needed to link all required libraries in case we serialize StdlibUnittest.
25+
import SwiftPrivate
26+
#if _runtime(_ObjC)
27+
import ObjectiveC
28+
#endif
29+
2330
var IntervalTraps = TestSuite("IntervalTraps")
2431

2532
IntervalTraps.test("HalfOpen")

test/1_stdlib/OptionalTraps.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@
1111

1212
import StdlibUnittest
1313

14+
// Also import modules which are used by StdlibUnittest internally. This is
15+
// needed to link all required libraries in case we serialize StdlibUnittest.
16+
import SwiftPrivate
17+
#if _runtime(_ObjC)
18+
import ObjectiveC
19+
#endif
20+
1421
func returnNil() -> AnyObject? {
1522
return _opaqueIdentity(nil as AnyObject?)
1623
}

test/1_stdlib/RangeTraps.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@
2020

2121
import StdlibUnittest
2222

23+
// Also import modules which are used by StdlibUnittest internally. This is
24+
// needed to link all required libraries in case we serialize StdlibUnittest.
25+
import SwiftPrivate
26+
#if _runtime(_ObjC)
27+
import ObjectiveC
28+
#endif
29+
2330
var RangeTraps = TestSuite("RangeTraps")
2431

2532
RangeTraps.test("HalfOpen")

test/1_stdlib/SetTraps.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@
1313
import StdlibUnittest
1414
import Foundation
1515

16+
// Also import modules which are used by StdlibUnittest internally. This is
17+
// needed to link all required libraries in case we serialize StdlibUnittest.
18+
import SwiftPrivate
19+
#if _runtime(_ObjC)
20+
import ObjectiveC
21+
#endif
22+
1623
struct NotBridgedKeyTy : Equatable, Hashable {
1724
init(_ value: Int) {
1825
self.value = value

test/1_stdlib/StringTraps.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@
1212
import StdlibUnittest
1313
import Foundation
1414

15+
// Also import modules which are used by StdlibUnittest internally. This is
16+
// needed to link all required libraries in case we serialize StdlibUnittest.
17+
import SwiftPrivate
18+
#if _runtime(_ObjC)
19+
import ObjectiveC
20+
#endif
21+
1522
var StringTraps = TestSuite("StringTraps")
1623

1724
StringTraps.test("startIndex/predecessor")

test/1_stdlib/tgmath_optimized.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@
88
import Darwin
99
import StdlibUnittest
1010

11+
// Also import modules which are used by StdlibUnittest internally. This is
12+
// needed to link all required libraries in case we serialize StdlibUnittest.
13+
import SwiftPrivate
14+
#if _runtime(_ObjC)
15+
import ObjectiveC
16+
#endif
17+
1118
var TGMathTestSuite = TestSuite("tgmath")
1219

1320
let minusOneDouble = Double(-1.0)

validation-test/stdlib/ArrayBridging.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@ import StdlibUnittest
1414
import Foundation
1515
import SlurpFastEnumeration
1616

17+
// Also import modules which are used by StdlibUnittest internally. This is
18+
// needed to link all required libraries in case we serialize StdlibUnittest.
19+
import SwiftPrivate
20+
import SwiftPrivatePthreadExtras
21+
#if _runtime(_ObjC)
22+
import ObjectiveC
23+
#endif
24+
1725
struct ArrayBridge_objectAtIndex_RaceTest : RaceTestWithPerTrialDataType {
1826
class RaceData {
1927
var nsa: NSArray

validation-test/stdlib/Assert.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,15 @@
1111

1212
import StdlibUnittest
1313

14+
// Also import modules which are used by StdlibUnittest internally. This is
15+
// needed to link all required libraries in case we serialize StdlibUnittest.
16+
import SwiftPrivate
17+
import SwiftPrivatePthreadExtras
18+
#if _runtime(_ObjC)
19+
import ObjectiveC
20+
#endif
21+
22+
1423
//===---
1524
// Tests.
1625
//===---

validation-test/stdlib/AtomicInt.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@
88
import SwiftPrivate
99
import StdlibUnittest
1010

11+
// Also import modules which are used by StdlibUnittest internally. This is
12+
// needed to link all required libraries in case we serialize StdlibUnittest.
13+
import SwiftPrivate
14+
import SwiftPrivatePthreadExtras
15+
#if _runtime(_ObjC)
16+
import ObjectiveC
17+
#endif
18+
1119
final class HeapBool {
1220
var value: Bool
1321
init(_ value: Bool) {

validation-test/stdlib/DictionaryBridging.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@ import StdlibUnittest
1313
import Foundation
1414
import SlurpFastEnumeration
1515

16+
// Also import modules which are used by StdlibUnittest internally. This is
17+
// needed to link all required libraries in case we serialize StdlibUnittest.
18+
import SwiftPrivate
19+
import SwiftPrivatePthreadExtras
20+
#if _runtime(_ObjC)
21+
import ObjectiveC
22+
#endif
23+
1624
struct DictionaryBridge_objectForKey_RaceTest : RaceTestWithPerTrialDataType {
1725
class RaceData {
1826
var nsd: NSDictionary

validation-test/stdlib/FixedPointArithmeticTraps.swift.gyb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@
1010

1111
import StdlibUnittest
1212

13+
// Also import modules which are used by StdlibUnittest internally. This is
14+
// needed to link all required libraries in case we serialize StdlibUnittest.
15+
import SwiftPrivate
16+
#if _runtime(_ObjC)
17+
import ObjectiveC
18+
#endif
19+
1320
// Note: in this file, we need to go through opaque functions to load
1421
// constants. This is to to check runtime behaviour and ensure the constant is
1522
// not folded.

validation-test/stdlib/FloatingPointConversionTraps.swift.gyb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@
1010

1111
import StdlibUnittest
1212

13+
// Also import modules which are used by StdlibUnittest internally. This is
14+
// needed to link all required libraries in case we serialize StdlibUnittest.
15+
import SwiftPrivate
16+
#if _runtime(_ObjC)
17+
import ObjectiveC
18+
#endif
19+
1320
%{
1421

1522
from SwiftIntTypes import *

validation-test/stdlib/HashingAvalanche.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@
55
import SwiftPrivate
66
import StdlibUnittest
77

8+
// Also import modules which are used by StdlibUnittest internally. This is
9+
// needed to link all required libraries in case we serialize StdlibUnittest.
10+
import SwiftPrivate
11+
#if _runtime(_ObjC)
12+
import ObjectiveC
13+
#endif
14+
815
var HashingTestSuite = TestSuite("Hashing")
916

1017
func avalancheTest(bits: Int, _ hashUnderTest: (UInt64) -> UInt64, _ pValue: Double) {

0 commit comments

Comments
 (0)