@@ -1473,7 +1473,7 @@ final class SwiftDriverTests: XCTestCase {
1473
1473
let sampleOutputFileMap = OutputFileMap ( entries: pathyEntries)
1474
1474
1475
1475
try withTemporaryFile { file in
1476
- try sampleOutputFileMap. store ( fileSystem: localFileSystem, file: file. path, diagnosticEngine : DiagnosticsEngine ( ) )
1476
+ try sampleOutputFileMap. store ( fileSystem: localFileSystem, file: file. path)
1477
1477
let contentsForDebugging = try localFileSystem. readFileContents ( file. path) . cString
1478
1478
_ = contentsForDebugging
1479
1479
let recoveredOutputFileMap = try OutputFileMap . load ( fileSystem: localFileSystem, file: . absolute( file. path) , diagnosticEngine: DiagnosticsEngine ( ) )
@@ -8275,6 +8275,56 @@ final class SwiftDriverTests: XCTestCase {
8275
8275
XCTAssertTrue ( jobs [ 0 ] . commandLine. contains ( subsequence: featureArgs. map { Job . ArgTemplate. flag ( $0) } ) )
8276
8276
}
8277
8277
}
8278
+
8279
+ func testSupplementaryOutputFileMapUsage( ) throws {
8280
+ // Ensure filenames are escaped properly when using a supplementary output file map
8281
+ try withTemporaryDirectory { path in
8282
+ try localFileSystem. changeCurrentWorkingDirectory ( to: path)
8283
+ let moduleCachePath = path. appending ( component: " ModuleCache " )
8284
+ try localFileSystem. createDirectory ( moduleCachePath)
8285
+ let one = path. appending ( component: " one.swift " )
8286
+ let two = path. appending ( component: " needs to escape spaces.swift " )
8287
+ let three = path. appending ( component: #"another"one.swift"# )
8288
+ let four = path. appending ( component: " 4.swift " )
8289
+ try localFileSystem. writeFileContents ( one, bytes:
8290
+ """
8291
+ public struct A {}
8292
+ """
8293
+ )
8294
+ try localFileSystem. writeFileContents ( two, bytes:
8295
+ """
8296
+ struct B {}
8297
+ """
8298
+ )
8299
+ try localFileSystem. writeFileContents ( three, bytes:
8300
+ """
8301
+ struct C {}
8302
+ """
8303
+ )
8304
+ try localFileSystem. writeFileContents ( four, bytes:
8305
+ """
8306
+ struct D {}
8307
+ """
8308
+ )
8309
+
8310
+ let sdkArgumentsForTesting = ( try ? Driver . sdkArgumentsForTesting ( ) ) ?? [ ]
8311
+ let invocationArguments = [ " swiftc " ,
8312
+ " -v " , " -save-temps " ,
8313
+ " -parse-as-library " ,
8314
+ " -emit-library " ,
8315
+ " -driver-filelist-threshold " , " 0 " ,
8316
+ " -module-cache-path " , moduleCachePath. nativePathString ( escaped: true ) ,
8317
+ " -working-directory " , path. nativePathString ( escaped: true ) ,
8318
+ one. nativePathString ( escaped: true ) ,
8319
+ two. nativePathString ( escaped: true ) ,
8320
+ three. nativePathString ( escaped: true ) ,
8321
+ four. nativePathString ( escaped: true ) ] + sdkArgumentsForTesting
8322
+ var driver = try Driver ( args: invocationArguments)
8323
+ let jobs = try driver. planBuild ( )
8324
+ try driver. run ( jobs: jobs)
8325
+ XCTAssertFalse ( driver. diagnosticEngine. hasErrors)
8326
+ }
8327
+ }
8278
8328
}
8279
8329
8280
8330
func assertString(
0 commit comments