Skip to content

Commit 0830c36

Browse files
committed
[tests] add import statements to prevent unresolved symbols when compiling StdlibUnittest with -sil-serialize-all.
This is the second part of 308f39f. It fixes (better: works-around) linker errors when testing in optimized mode.
1 parent 40ca838 commit 0830c36

File tree

119 files changed

+958
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

119 files changed

+958
-0
lines changed

test/1_stdlib/CastTraps.swift.gyb

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

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

1625

test/1_stdlib/Character.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ import StdlibUnittest
77
import Swift
88
import SwiftPrivate
99

10+
// Also import modules which are used by StdlibUnittest internally. This
11+
// workaround is needed to link all required libraries in case we compile
12+
// StdlibUnittest with -sil-serialize-all.
13+
#if _runtime(_ObjC)
14+
import ObjectiveC
15+
#endif
16+
1017
//===---
1118
// Utilities.
1219
//===---

test/1_stdlib/ErrorHandling.swift

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

88
import StdlibUnittest
99

10+
// Also import modules which are used by StdlibUnittest internally. This
11+
// workaround is needed to link all required libraries in case we compile
12+
// StdlibUnittest with -sil-serialize-all.
13+
import SwiftPrivate
14+
#if _runtime(_ObjC)
15+
import ObjectiveC
16+
#endif
17+
1018
var NoisyCount = 0
1119

1220
class Noisy {

test/1_stdlib/ErrorType.swift

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

44
import StdlibUnittest
55

6+
// Also import modules which are used by StdlibUnittest internally. This
7+
// workaround is needed to link all required libraries in case we compile
8+
// StdlibUnittest with -sil-serialize-all.
9+
import SwiftPrivate
10+
#if _runtime(_ObjC)
11+
import ObjectiveC
12+
#endif
13+
614
var ErrorTypeTests = TestSuite("ErrorType")
715

816
var NoisyErrorLifeCount = 0

test/1_stdlib/ExistentialCollection.swift

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

1515
import StdlibUnittest
1616

17+
// Also import modules which are used by StdlibUnittest internally. This
18+
// workaround is needed to link all required libraries in case we compile
19+
// StdlibUnittest with -sil-serialize-all.
20+
import SwiftPrivate
21+
#if _runtime(_ObjC)
22+
import ObjectiveC
23+
#endif
24+
1725
// Check that the generic parameter is called 'Element'.
1826
protocol TestProtocol1 {}
1927

test/1_stdlib/Experimental.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@
44
import SwiftExperimental
55
import StdlibUnittest
66

7+
// Also import modules which are used by StdlibUnittest internally. This
8+
// workaround is needed to link all required libraries in case we compile
9+
// StdlibUnittest with -sil-serialize-all.
10+
import SwiftPrivate
11+
#if _runtime(_ObjC)
12+
import ObjectiveC
13+
#endif
14+
715
var ExperimentalTestSuite = TestSuite("Experimental")
816

917
ExperimentalTestSuite.test("ComposeOperator/SmokeTest") {

test/1_stdlib/Filter.swift

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

1515
import StdlibUnittest
1616

17+
// Also import modules which are used by StdlibUnittest internally. This
18+
// workaround is needed to link all required libraries in case we compile
19+
// StdlibUnittest with -sil-serialize-all.
20+
import SwiftPrivate
21+
#if _runtime(_ObjC)
22+
import ObjectiveC
23+
#endif
24+
1725
let FilterTests = TestSuite("Filter")
1826

1927
// Check that the generic parameter is called 'Base'.

test/1_stdlib/FloatingPoint.swift.gyb

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

11+
// Also import modules which are used by StdlibUnittest internally. This
12+
// workaround is needed to link all required libraries in case we compile
13+
// StdlibUnittest with -sil-serialize-all.
14+
import SwiftPrivate
15+
#if _runtime(_ObjC)
16+
import ObjectiveC
17+
#endif
18+
1119
#if arch(i386) || arch(x86_64)
1220

1321
struct Float80Bits : Equatable, CustomStringConvertible {

test/1_stdlib/Generator.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22
// REQUIRES: executable_test
33

44
import StdlibUnittest
5+
6+
// Also import modules which are used by StdlibUnittest internally. This
7+
// workaround is needed to link all required libraries in case we compile
8+
// StdlibUnittest with -sil-serialize-all.
9+
import SwiftPrivate
10+
#if _runtime(_ObjC)
11+
import ObjectiveC
12+
#endif
13+
514
var tests = TestSuite("Generator")
615

716
// Check to make sure we are actually getting Optionals out of this

test/1_stdlib/ImplicitlyUnwrappedOptional.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,15 @@ if c === nil {
3737
// CHECK: an empty class optional should equal nil
3838

3939
import StdlibUnittest
40+
41+
// Also import modules which are used by StdlibUnittest internally. This
42+
// workaround is needed to link all required libraries in case we compile
43+
// StdlibUnittest with -sil-serialize-all.
44+
import SwiftPrivate
45+
#if _runtime(_ObjC)
46+
import ObjectiveC
47+
#endif
48+
4049
import Swift
4150

4251
var ImplicitlyUnwrappedOptionalTests = TestSuite("ImplicitlyUnwrappedOptional")

test/1_stdlib/InputStream.swift.gyb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,15 @@
1919
// XFAIL: interpret
2020

2121
import StdlibUnittest
22+
23+
// Also import modules which are used by StdlibUnittest internally. This
24+
// workaround is needed to link all required libraries in case we compile
25+
// StdlibUnittest with -sil-serialize-all.
26+
import SwiftPrivate
27+
#if _runtime(_ObjC)
28+
import ObjectiveC
29+
#endif
30+
2231
import Swift
2332

2433
var ReadLineTestSuite = TestSuite("ReadLine")

test/1_stdlib/Interval.swift

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

1717
import StdlibUnittest
1818

19+
// Also import modules which are used by StdlibUnittest internally. This
20+
// workaround is needed to link all required libraries in case we compile
21+
// StdlibUnittest with -sil-serialize-all.
22+
import SwiftPrivate
23+
#if _runtime(_ObjC)
24+
import ObjectiveC
25+
#endif
26+
1927
// Check that the generic parameter is called 'Bound'.
2028
protocol TestProtocol1 {}
2129

test/1_stdlib/Mirror.swift

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

2222
import StdlibUnittest
2323

24+
// Also import modules which are used by StdlibUnittest internally. This
25+
// workaround is needed to link all required libraries in case we compile
26+
// StdlibUnittest with -sil-serialize-all.
27+
import SwiftPrivate
28+
#if _runtime(_ObjC)
29+
import ObjectiveC
30+
#endif
31+
2432
var mirrors = TestSuite("Mirrors")
2533

2634
extension Mirror {

test/1_stdlib/NumericParsing.swift.gyb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,14 @@ number_of_values = 23
4747

4848
import StdlibUnittest
4949

50+
// Also import modules which are used by StdlibUnittest internally. This
51+
// workaround is needed to link all required libraries in case we compile
52+
// StdlibUnittest with -sil-serialize-all.
53+
import SwiftPrivate
54+
#if _runtime(_ObjC)
55+
import ObjectiveC
56+
#endif
57+
5058
var tests = TestSuite("NumericParsing")
5159

5260
% for type in all_integer_types(word_bits):

test/1_stdlib/OptionSetTest.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@ struct PackagingOptions : OptionSetType {
3030

3131
import StdlibUnittest
3232

33+
// Also import modules which are used by StdlibUnittest internally. This
34+
// workaround is needed to link all required libraries in case we compile
35+
// StdlibUnittest with -sil-serialize-all.
36+
import SwiftPrivate
37+
#if _runtime(_ObjC)
38+
import ObjectiveC
39+
#endif
40+
3341
var tests = TestSuite("OptionSet")
3442

3543
tests.test("basics") {

test/1_stdlib/Optional.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@
44
import StdlibUnittest
55
import Swift
66

7+
// Also import modules which are used by StdlibUnittest internally. This
8+
// workaround is needed to link all required libraries in case we compile
9+
// StdlibUnittest with -sil-serialize-all.
10+
import SwiftPrivate
11+
#if _runtime(_ObjC)
12+
import ObjectiveC
13+
#endif
14+
715
let OptionalTests = TestSuite("Optional")
816

917
protocol TestProtocol1 {}

test/1_stdlib/POSIX.swift

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

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

1321
let semaphoreName = "TestSem"

test/1_stdlib/Range.swift

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

66
import StdlibUnittest
77

8+
// Also import modules which are used by StdlibUnittest internally. This
9+
// workaround is needed to link all required libraries in case we compile
10+
// StdlibUnittest with -sil-serialize-all.
11+
import SwiftPrivate
12+
#if _runtime(_ObjC)
13+
import ObjectiveC
14+
#endif
15+
816
// Check that the generic parameter is called 'Element'.
917
protocol TestProtocol1 {}
1018

test/1_stdlib/ReflectionHashing.swift

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

1212
import StdlibUnittest
1313

14+
// Also import modules which are used by StdlibUnittest internally. This
15+
// workaround is needed to link all required libraries in case we compile
16+
// StdlibUnittest with -sil-serialize-all.
17+
import SwiftPrivate
18+
#if _runtime(_ObjC)
19+
import ObjectiveC
20+
#endif
21+
1422
var Reflection = TestSuite("Reflection")
1523

1624
Reflection.test("Dictionary/Empty") {

test/1_stdlib/StaticString.swift

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

44
import StdlibUnittest
55

6+
// Also import modules which are used by StdlibUnittest internally. This
7+
// workaround is needed to link all required libraries in case we compile
8+
// StdlibUnittest with -sil-serialize-all.
9+
import SwiftPrivate
10+
#if _runtime(_ObjC)
11+
import ObjectiveC
12+
#endif
13+
614
var StaticStringTestSuite = TestSuite("StaticString")
715

816
StaticStringTestSuite.test("PointerRepresentation/ASCII/Empty") {

test/1_stdlib/Strideable.swift

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

1717
import StdlibUnittest
1818

19+
// Also import modules which are used by StdlibUnittest internally. This
20+
// workaround is needed to link all required libraries in case we compile
21+
// StdlibUnittest with -sil-serialize-all.
22+
import SwiftPrivate
23+
#if _runtime(_ObjC)
24+
import ObjectiveC
25+
#endif
26+
1927
// Check that the generic parameter is called 'Element'.
2028
protocol TestProtocol1 {}
2129

test/1_stdlib/Unmanaged.swift

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

66
import StdlibUnittest
77

8+
// Also import modules which are used by StdlibUnittest internally. This
9+
// workaround is needed to link all required libraries in case we compile
10+
// StdlibUnittest with -sil-serialize-all.
11+
import SwiftPrivate
12+
#if _runtime(_ObjC)
13+
import ObjectiveC
14+
#endif
15+
816
// Check that the generic parameter is called 'Instance'.
917
protocol TestProtocol1 {}
1018

test/1_stdlib/UnsafePointer.swift.gyb

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

66
import StdlibUnittest
77

8+
// Also import modules which are used by StdlibUnittest internally. This
9+
// workaround is needed to link all required libraries in case we compile
10+
// StdlibUnittest with -sil-serialize-all.
11+
import SwiftPrivate
12+
#if _runtime(_ObjC)
13+
import ObjectiveC
14+
#endif
15+
816
protocol TestProtocol1 {}
917

1018
// Check that the generic parameter is called 'Memory'.

test/1_stdlib/simd.swift.gyb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@
1111
import simd
1212
import StdlibUnittest
1313

14+
// Also import modules which are used by StdlibUnittest internally. This
15+
// workaround is needed to link all required libraries in case we compile
16+
// StdlibUnittest with -sil-serialize-all.
17+
import SwiftPrivate
18+
#if _runtime(_ObjC)
19+
import ObjectiveC
20+
#endif
21+
1422
% scalar_types = ['Float', 'Double', 'Int32']
1523
% float_types = ['Float', 'Double']
1624
% ctype = { 'Float':'float', 'Double':'double', 'Int32':'int' }

test/Interpreter/FunctionConversion.swift

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

1717
import StdlibUnittest
1818

19+
// Also import modules which are used by StdlibUnittest internally. This
20+
// workaround is needed to link all required libraries in case we compile
21+
// StdlibUnittest with -sil-serialize-all.
22+
import SwiftPrivate
23+
#if _runtime(_ObjC)
24+
import ObjectiveC
25+
#endif
26+
1927
var FunctionConversionTestSuite = TestSuite("FunctionConversion")
2028

2129
protocol Quilt {

test/Interpreter/SDK/Foundation_test.swift

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

10+
// Also import modules which are used by StdlibUnittest internally. This
11+
// workaround is needed to link all required libraries in case we compile
12+
// StdlibUnittest with -sil-serialize-all.
13+
import SwiftPrivate
14+
#if _runtime(_ObjC)
15+
import ObjectiveC
16+
#endif
17+
1018
// rdar://problem/18884272
1119
// Make sure that NSObject conforms to NSObjectProtocol. This
1220
// particular bug is ridiculously hard to trigger without a complete

0 commit comments

Comments
 (0)