@@ -620,7 +620,7 @@ final class SwiftDriverTests: XCTestCase {
620620 XCTAssertJobInvocationMatches ( jobs [ 0 ] , . flag( " -file-compilation-dir " ) , . path( VirtualPath . lookup ( path) ) )
621621 }
622622
623- let workingDirectory = AbsolutePath ( " /tmp " )
623+ let workingDirectory = try AbsolutePath ( validating : " /tmp " )
624624 try assertNoDriverDiagnostics ( args: " swiftc " , " foo.swift " , " -g " , " -c " , " -working-directory " , workingDirectory. nativePathString ( escaped: false ) ) { driver in
625625 let jobs = try driver. planBuild ( )
626626 let path = try VirtualPath . intern ( path: workingDirectory. nativePathString ( escaped: false ) )
@@ -1735,7 +1735,7 @@ final class SwiftDriverTests: XCTestCase {
17351735 let manyArgs = ( 1 ... 20000 ) . map { " -DTEST_ \( $0) " }
17361736 // Needs response file
17371737 do {
1738- let source = AbsolutePath ( " /foo.swift " )
1738+ let source = try AbsolutePath ( validating : " /foo.swift " )
17391739 var driver = try Driver ( args: [ " swift " ] + manyArgs + [ source. nativePathString ( escaped: false ) ] )
17401740 let jobs = try driver. planBuild ( )
17411741 XCTAssertEqual ( jobs. count, 1 )
@@ -1767,7 +1767,7 @@ final class SwiftDriverTests: XCTestCase {
17671767
17681768 // Forced response file
17691769 do {
1770- let source = AbsolutePath ( " /foo.swift " )
1770+ let source = try AbsolutePath ( validating : " /foo.swift " )
17711771 var driver = try Driver ( args: [ " swift " ] + [ source. nativePathString ( escaped: false ) ] )
17721772 let jobs = try driver. planBuild ( )
17731773 XCTAssertEqual ( jobs. count, 1 )
@@ -3143,7 +3143,7 @@ final class SwiftDriverTests: XCTestCase {
31433143
31443144
31453145 func testIndexFileEntryInSupplementaryFileOutputMap( ) throws {
3146- let workingDirectory = AbsolutePath ( " /tmp " )
3146+ let workingDirectory = try AbsolutePath ( validating : " /tmp " )
31473147 var driver1 = try Driver ( args: [
31483148 " swiftc " , " foo1.swift " , " foo2.swift " , " foo3.swift " , " foo4.swift " , " foo5.swift " ,
31493149 " -index-file " , " -index-file-path " , " foo5.swift " , " -o " , " /tmp/t.o " ,
@@ -3894,7 +3894,7 @@ final class SwiftDriverTests: XCTestCase {
38943894 XCTAssertEqual ( plannedJobs. count, 2 )
38953895 XCTAssertEqual ( plannedJobs [ 0 ] . kind, . compile)
38963896 XCTAssertEqual ( plannedJobs [ 1 ] . kind, . link)
3897- try XCTAssertJobInvocationMatches ( plannedJobs [ 0 ] , . flag( " -default-isolation " ) , " MainActor " )
3897+ XCTAssertJobInvocationMatches ( plannedJobs [ 0 ] , . flag( " -default-isolation " ) , " MainActor " )
38983898 }
38993899
39003900 func testImmediateMode( ) throws {
@@ -6857,9 +6857,9 @@ final class SwiftDriverTests: XCTestCase {
68576857
68586858 // 32-bit iOS jobs under Embedded should be allowed regardless of OS version
68596859 do {
6860- try Driver ( args: [ " swiftc " , " -c " , " -target " , " armv7-apple-ios8 " , " -enable-experimental-feature " , " Embedded " , " foo.swift " ] )
6861- try Driver ( args: [ " swiftc " , " -c " , " -target " , " armv7-apple-ios12.1 " , " -enable-experimental-feature " , " Embedded " , " foo.swift " ] )
6862- try Driver ( args: [ " swiftc " , " -c " , " -target " , " armv7-apple-ios16 " , " -enable-experimental-feature " , " Embedded " , " foo.swift " ] )
6860+ let _ = try Driver ( args: [ " swiftc " , " -c " , " -target " , " armv7-apple-ios8 " , " -enable-experimental-feature " , " Embedded " , " foo.swift " ] )
6861+ let _ = try Driver ( args: [ " swiftc " , " -c " , " -target " , " armv7-apple-ios12.1 " , " -enable-experimental-feature " , " Embedded " , " foo.swift " ] )
6862+ let _ = try Driver ( args: [ " swiftc " , " -c " , " -target " , " armv7-apple-ios16 " , " -enable-experimental-feature " , " Embedded " , " foo.swift " ] )
68636863 }
68646864
68656865 do {
@@ -7158,7 +7158,7 @@ final class SwiftDriverTests: XCTestCase {
71587158 }
71597159
71607160 do {
7161- let workingDirectory = AbsolutePath ( " /foo/bar " )
7161+ let workingDirectory = try AbsolutePath ( validating : " /foo/bar " )
71627162
71637163 // Inputs with relative paths with -working-directory flag should prefix all inputs
71647164 var driver = try Driver ( args: [ " swiftc " ,
@@ -7170,9 +7170,9 @@ final class SwiftDriverTests: XCTestCase {
71707170 let plannedJobs = try driver. planBuild ( )
71717171 let compileJob = plannedJobs [ 0 ]
71727172 XCTAssertEqual ( compileJob. kind, . compile)
7173- try XCTAssertJobInvocationMatches ( compileJob, . flag( " -primary-file " ) , . path( . absolute( workingDirectory. appending ( component: " foo.swift " ) ) ) )
7174- try XCTAssertJobInvocationMatches ( compileJob, . flag( " -resource-dir " ) , . path( . absolute( workingDirectory. appending ( component: " relresourcepath " ) ) ) )
7175- try XCTAssertJobInvocationMatches ( compileJob, . flag( " -sdk " ) , . path( . absolute( workingDirectory. appending ( component: " relsdkpath " ) ) ) )
7173+ XCTAssertJobInvocationMatches ( compileJob, . flag( " -primary-file " ) , . path( . absolute( workingDirectory. appending ( component: " foo.swift " ) ) ) )
7174+ XCTAssertJobInvocationMatches ( compileJob, . flag( " -resource-dir " ) , . path( . absolute( workingDirectory. appending ( component: " relresourcepath " ) ) ) )
7175+ XCTAssertJobInvocationMatches ( compileJob, . flag( " -sdk " ) , . path( . absolute( workingDirectory. appending ( component: " relsdkpath " ) ) ) )
71767176 }
71777177
71787178 try withTemporaryFile { fileMapFile in
@@ -7197,7 +7197,7 @@ final class SwiftDriverTests: XCTestCase {
71977197 let plannedJobs = try driver. planBuild ( )
71987198 let compileJob = plannedJobs [ 0 ]
71997199 XCTAssertEqual ( compileJob. kind, . compile)
7200- try XCTAssertJobInvocationMatches ( compileJob, . flag( " -o " ) , . path( . absolute( . init( " /tmp/foo/.build/x86_64-apple-macosx/debug/foo.build/foo.o " ) ) ) )
7200+ try XCTAssertJobInvocationMatches ( compileJob, . flag( " -o " ) , . path( . absolute( . init( validating : " /tmp/foo/.build/x86_64-apple-macosx/debug/foo.build/foo.o " ) ) ) )
72017201 }
72027202
72037203 try withTemporaryFile { fileMapFile in
@@ -7207,7 +7207,7 @@ final class SwiftDriverTests: XCTestCase {
72077207 " diagnostics " : " /tmp/foo/.build/x86_64-apple-macosx/debug/foo.build/master.dia " ,
72087208 " emit-module-diagnostics " : " /tmp/foo/.build/x86_64-apple-macosx/debug/foo.build/master.emit-module.dia "
72097209 },
7210- " \( AbsolutePath ( " /some/workingdir/foo.swift " ) . nativePathString ( escaped: true ) ) " : {
7210+ " \( try AbsolutePath ( validating : " /some/workingdir/foo.swift " ) . nativePathString ( escaped: true ) ) " : {
72117211 " object " : " /tmp/foo/.build/x86_64-apple-macosx/debug/foo.build/foo.o "
72127212 }
72137213 }
@@ -7218,12 +7218,12 @@ final class SwiftDriverTests: XCTestCase {
72187218 var driver = try Driver ( args: [ " swiftc " ,
72197219 " -target " , " arm64-apple-ios13.1 " ,
72207220 " foo.swift " ,
7221- " -working-directory " , AbsolutePath ( " /some/workingdir " ) . nativePathString ( escaped: false ) ,
7221+ " -working-directory " , try AbsolutePath ( validating : " /some/workingdir " ) . nativePathString ( escaped: false ) ,
72227222 " -output-file-map " , fileMapFile. path. description] )
72237223 let plannedJobs = try driver. planBuild ( )
72247224 let compileJob = plannedJobs [ 0 ]
72257225 XCTAssertEqual ( compileJob. kind, . compile)
7226- try XCTAssertJobInvocationMatches ( compileJob, . flag( " -o " ) , . path( . absolute( . init( " /tmp/foo/.build/x86_64-apple-macosx/debug/foo.build/foo.o " ) ) ) )
7226+ try XCTAssertJobInvocationMatches ( compileJob, . flag( " -o " ) , . path( . absolute( . init( validating : " /tmp/foo/.build/x86_64-apple-macosx/debug/foo.build/foo.o " ) ) ) )
72277227 }
72287228 }
72297229
@@ -7615,7 +7615,7 @@ final class SwiftDriverTests: XCTestCase {
76157615 var env = ProcessEnv . block
76167616 env [ " PLATFORM_DIR " ] = " /tmp/PlatformDir/ \( platform) .platform "
76177617
7618- let workingDirectory = AbsolutePath ( " /tmp " )
7618+ let workingDirectory = try AbsolutePath ( validating : " /tmp " )
76197619
76207620 var driver = try Driver (
76217621 args: [ " swiftc " , " -typecheck " , " foo.swift " , " -sdk " , VirtualPath . absolute ( sdkRoot) . name, " -plugin-path " , " PluginA " , " -external-plugin-path " , " Plugin~B#Bexe " , " -load-plugin-library " , " PluginB2 " , " -plugin-path " , " PluginC " , " -working-directory " , workingDirectory. nativePathString ( escaped: false ) ] ,
0 commit comments