@@ -26,6 +26,20 @@ final class NonincrementalCompilationTests: XCTestCase {
26
26
27
27
try XCTAssertEqual ( buildRecord. buildTime,
28
28
Date ( legacyDriverSecsAndNanos: [ 1570318779 , 32358000 ] ) )
29
+ #if os(Windows)
30
+ try XCTAssertEqual ( buildRecord. inputInfos,
31
+ [
32
+ VirtualPath ( path: " C: \\ AS \\ repos \\ swift-driver \\ sandbox \\ sandbox \\ sandbox \\ file2.swift " ) :
33
+ InputInfo ( status: . needsCascadingBuild,
34
+ previousModTime: Date ( legacyDriverSecsAndNanos: [ 1570318778 , 0 ] ) ) ,
35
+ VirtualPath ( path: " C: \\ AS \\ repos \\ swift-driver \\ sandbox \\ sandbox \\ sandbox \\ main.swift " ) :
36
+ InputInfo ( status: . upToDate,
37
+ previousModTime: Date ( legacyDriverSecsAndNanos: [ 1570083660 , 0 ] ) ) ,
38
+ VirtualPath ( path: " E: \\ gazorp.swift " ) :
39
+ InputInfo ( status: . needsNonCascadingBuild,
40
+ previousModTime: Date ( legacyDriverSecsAndNanos: [ 0 , 0 ] ) )
41
+ ] )
42
+ #else
29
43
try XCTAssertEqual ( buildRecord. inputInfos,
30
44
[
31
45
VirtualPath ( path: " /Volumes/AS/repos/swift-driver/sandbox/sandbox/sandbox/file2.swift " ) :
@@ -38,6 +52,7 @@ final class NonincrementalCompilationTests: XCTestCase {
38
52
InputInfo ( status: . needsNonCascadingBuild,
39
53
previousModTime: Date ( legacyDriverSecsAndNanos: [ 0 , 0 ] ) )
40
54
] )
55
+ #endif
41
56
}
42
57
43
58
func testBuildRecordWithoutOptionsReading( ) throws {
@@ -51,18 +66,33 @@ final class NonincrementalCompilationTests: XCTestCase {
51
66
52
67
try XCTAssertEqual ( buildRecord. buildTime,
53
68
Date ( legacyDriverSecsAndNanos: [ 1570318779 , 32358000 ] ) )
69
+ #if os(Windows)
54
70
try XCTAssertEqual ( buildRecord. inputInfos,
55
71
[
56
- VirtualPath ( path: " /Volumes/AS/ repos/ swift-driver/ sandbox/ sandbox/ sandbox/ file2.swift" ) :
72
+ VirtualPath ( path: " C: \\ repos \\ swift-driver \\ sandbox \\ sandbox \\ sandbox \\ file2.swift " ) :
57
73
InputInfo ( status: . needsCascadingBuild,
58
74
previousModTime: Date ( legacyDriverSecsAndNanos: [ 1570318778 , 0 ] ) ) ,
75
+ VirtualPath ( path: " C: \\ repos \\ swift-driver \\ sandbox \\ sandbox \\ sandbox \\ main.swift " ) :
76
+ InputInfo ( status: . upToDate,
77
+ previousModTime: Date ( legacyDriverSecsAndNanos: [ 1570083660 , 0 ] ) ) ,
78
+ VirtualPath ( path: " E: \\ gazorp.swift " ) :
79
+ InputInfo ( status: . needsNonCascadingBuild,
80
+ previousModTime: Date ( legacyDriverSecsAndNanos: [ 0 , 0 ] ) )
81
+ ] )
82
+ #else
83
+ try XCTAssertEqual ( buildRecord. inputInfos,
84
+ [
85
+ VirtualPath ( path: " /Volumes/AS/repos/swift-driver/sandbox/sandbox/sandbox/file2.swift " ) :
86
+ InputInfo ( status: . needsCascadingBuild,
87
+ previousModTime: Date ( legacyDriverSecsAndNanos: [ 1570318778 , 0 ] ) ) ,
59
88
VirtualPath ( path: " /Volumes/AS/repos/swift-driver/sandbox/sandbox/sandbox/main.swift " ) :
60
89
InputInfo ( status: . upToDate,
61
90
previousModTime: Date ( legacyDriverSecsAndNanos: [ 1570083660 , 0 ] ) ) ,
62
91
VirtualPath ( path: " /Volumes/gazorp.swift " ) :
63
92
InputInfo ( status: . needsNonCascadingBuild,
64
93
previousModTime: Date ( legacyDriverSecsAndNanos: [ 0 , 0 ] ) )
65
- ] )
94
+ ] )
95
+ #endif
66
96
}
67
97
68
98
func testReadBinarySourceFileDependencyGraph( ) throws {
@@ -151,7 +181,11 @@ final class NonincrementalCompilationTests: XCTestCase {
151
181
XCTAssertFalse ( foundEdge)
152
182
foundEdge = true
153
183
184
+ #if os(Windows)
185
+ XCTAssertEqual ( defName, " C: \\ Users \\ owenvoorhees \\ Desktop \\ hello.swiftdeps " )
186
+ #else
154
187
XCTAssertEqual ( defName, " /Users/owenvoorhees/Desktop/hello.swiftdeps " )
188
+ #endif
155
189
XCTAssertEqual ( defNode. fingerprint, " 38b457b424090ac2e595be0e5f7e3b5b " )
156
190
157
191
XCTAssertEqual ( useContext, " 5hello1AC " )
@@ -202,9 +236,15 @@ final class NonincrementalCompilationTests: XCTestCase {
202
236
func testReadAndWriteBuildRecord( ) throws {
203
237
let version = " Apple Swift version 5.1 (swiftlang-1100.0.270.13 clang-1100.0.33.7) "
204
238
let options = " abbbfbcaf36b93e58efaadd8271ff142 "
239
+ #if os(Windows)
240
+ let file2 = " C: \\ repos \\ swift-driver \\ sandbox \\ sandbox \\ sandbox \\ file2.swift "
241
+ let main = " C: \\ repos \\ swift-driver \\ sandbox \\ sandbox \\ sandbox \\ main.swift "
242
+ let gazorp = " E: \\ gazorp.swift "
243
+ #else
205
244
let file2 = " /Volumes/AS/repos/swift-driver/sandbox/sandbox/sandbox/file2.swift "
206
245
let main = " /Volumes/AS/repos/swift-driver/sandbox/sandbox/sandbox/main.swift "
207
246
let gazorp = " /Volumes/gazorp.swift "
247
+ #endif
208
248
let inputString =
209
249
"""
210
250
version: " \( version) "
@@ -712,7 +752,11 @@ final class IncrementalCompilationTests: XCTestCase {
712
752
713
753
private func replace( contentsOf name: String , with replacement: String ) {
714
754
print ( " *** replacing \( name) *** " , to: & stderrStream) ; stderrStream. flush ( )
715
- let path = try ! XCTUnwrap ( inputPathsAndContents. filter { $0. 0 . pathString. contains ( " / " + name + " .swift " ) } . first) . 0
755
+ #if os(Windows)
756
+ let path = try ! XCTUnwrap ( inputPathsAndContents. filter { $0. 0 . pathString. contains ( " \\ \( name) .swift " ) } . first) . 0
757
+ #else
758
+ let path = try ! XCTUnwrap ( inputPathsAndContents. filter { $0. 0 . pathString. contains ( " / \( name) .swift " ) } . first) . 0
759
+ #endif
716
760
let previousContents = try ! localFileSystem. readFileContents ( path) . cString
717
761
try ! localFileSystem. writeFileContents ( path) { $0 <<< replacement }
718
762
let newContents = try ! localFileSystem. readFileContents ( path) . cString
0 commit comments