@@ -620,7 +620,7 @@ final class SwiftDriverTests: XCTestCase {
620
620
XCTAssertJobInvocationMatches ( jobs [ 0 ] , . flag( " -file-compilation-dir " ) , . path( VirtualPath . lookup ( path) ) )
621
621
}
622
622
623
- let workingDirectory = AbsolutePath ( " /tmp " )
623
+ let workingDirectory = try AbsolutePath ( validating : " /tmp " )
624
624
try assertNoDriverDiagnostics ( args: " swiftc " , " foo.swift " , " -g " , " -c " , " -working-directory " , workingDirectory. nativePathString ( escaped: false ) ) { driver in
625
625
let jobs = try driver. planBuild ( )
626
626
let path = try VirtualPath . intern ( path: workingDirectory. nativePathString ( escaped: false ) )
@@ -1735,7 +1735,7 @@ final class SwiftDriverTests: XCTestCase {
1735
1735
let manyArgs = ( 1 ... 20000 ) . map { " -DTEST_ \( $0) " }
1736
1736
// Needs response file
1737
1737
do {
1738
- let source = AbsolutePath ( " /foo.swift " )
1738
+ let source = try AbsolutePath ( validating : " /foo.swift " )
1739
1739
var driver = try Driver ( args: [ " swift " ] + manyArgs + [ source. nativePathString ( escaped: false ) ] )
1740
1740
let jobs = try driver. planBuild ( )
1741
1741
XCTAssertEqual ( jobs. count, 1 )
@@ -1767,7 +1767,7 @@ final class SwiftDriverTests: XCTestCase {
1767
1767
1768
1768
// Forced response file
1769
1769
do {
1770
- let source = AbsolutePath ( " /foo.swift " )
1770
+ let source = try AbsolutePath ( validating : " /foo.swift " )
1771
1771
var driver = try Driver ( args: [ " swift " ] + [ source. nativePathString ( escaped: false ) ] )
1772
1772
let jobs = try driver. planBuild ( )
1773
1773
XCTAssertEqual ( jobs. count, 1 )
@@ -3143,7 +3143,7 @@ final class SwiftDriverTests: XCTestCase {
3143
3143
3144
3144
3145
3145
func testIndexFileEntryInSupplementaryFileOutputMap( ) throws {
3146
- let workingDirectory = AbsolutePath ( " /tmp " )
3146
+ let workingDirectory = try AbsolutePath ( validating : " /tmp " )
3147
3147
var driver1 = try Driver ( args: [
3148
3148
" swiftc " , " foo1.swift " , " foo2.swift " , " foo3.swift " , " foo4.swift " , " foo5.swift " ,
3149
3149
" -index-file " , " -index-file-path " , " foo5.swift " , " -o " , " /tmp/t.o " ,
@@ -3894,7 +3894,7 @@ final class SwiftDriverTests: XCTestCase {
3894
3894
XCTAssertEqual ( plannedJobs. count, 2 )
3895
3895
XCTAssertEqual ( plannedJobs [ 0 ] . kind, . compile)
3896
3896
XCTAssertEqual ( plannedJobs [ 1 ] . kind, . link)
3897
- try XCTAssertJobInvocationMatches ( plannedJobs [ 0 ] , . flag( " -default-isolation " ) , " MainActor " )
3897
+ XCTAssertJobInvocationMatches ( plannedJobs [ 0 ] , . flag( " -default-isolation " ) , " MainActor " )
3898
3898
}
3899
3899
3900
3900
func testImmediateMode( ) throws {
@@ -6835,9 +6835,9 @@ final class SwiftDriverTests: XCTestCase {
6835
6835
6836
6836
// 32-bit iOS jobs under Embedded should be allowed regardless of OS version
6837
6837
do {
6838
- try Driver ( args: [ " swiftc " , " -c " , " -target " , " armv7-apple-ios8 " , " -enable-experimental-feature " , " Embedded " , " foo.swift " ] )
6839
- try Driver ( args: [ " swiftc " , " -c " , " -target " , " armv7-apple-ios12.1 " , " -enable-experimental-feature " , " Embedded " , " foo.swift " ] )
6840
- try Driver ( args: [ " swiftc " , " -c " , " -target " , " armv7-apple-ios16 " , " -enable-experimental-feature " , " Embedded " , " foo.swift " ] )
6838
+ let _ = try Driver ( args: [ " swiftc " , " -c " , " -target " , " armv7-apple-ios8 " , " -enable-experimental-feature " , " Embedded " , " foo.swift " ] )
6839
+ let _ = try Driver ( args: [ " swiftc " , " -c " , " -target " , " armv7-apple-ios12.1 " , " -enable-experimental-feature " , " Embedded " , " foo.swift " ] )
6840
+ let _ = try Driver ( args: [ " swiftc " , " -c " , " -target " , " armv7-apple-ios16 " , " -enable-experimental-feature " , " Embedded " , " foo.swift " ] )
6841
6841
}
6842
6842
6843
6843
do {
@@ -7136,7 +7136,7 @@ final class SwiftDriverTests: XCTestCase {
7136
7136
}
7137
7137
7138
7138
do {
7139
- let workingDirectory = AbsolutePath ( " /foo/bar " )
7139
+ let workingDirectory = try AbsolutePath ( validating : " /foo/bar " )
7140
7140
7141
7141
// Inputs with relative paths with -working-directory flag should prefix all inputs
7142
7142
var driver = try Driver ( args: [ " swiftc " ,
@@ -7148,9 +7148,9 @@ final class SwiftDriverTests: XCTestCase {
7148
7148
let plannedJobs = try driver. planBuild ( )
7149
7149
let compileJob = plannedJobs [ 0 ]
7150
7150
XCTAssertEqual ( compileJob. kind, . compile)
7151
- try XCTAssertJobInvocationMatches ( compileJob, . flag( " -primary-file " ) , . path( . absolute( workingDirectory. appending ( component: " foo.swift " ) ) ) )
7152
- try XCTAssertJobInvocationMatches ( compileJob, . flag( " -resource-dir " ) , . path( . absolute( workingDirectory. appending ( component: " relresourcepath " ) ) ) )
7153
- try XCTAssertJobInvocationMatches ( compileJob, . flag( " -sdk " ) , . path( . absolute( workingDirectory. appending ( component: " relsdkpath " ) ) ) )
7151
+ XCTAssertJobInvocationMatches ( compileJob, . flag( " -primary-file " ) , . path( . absolute( workingDirectory. appending ( component: " foo.swift " ) ) ) )
7152
+ XCTAssertJobInvocationMatches ( compileJob, . flag( " -resource-dir " ) , . path( . absolute( workingDirectory. appending ( component: " relresourcepath " ) ) ) )
7153
+ XCTAssertJobInvocationMatches ( compileJob, . flag( " -sdk " ) , . path( . absolute( workingDirectory. appending ( component: " relsdkpath " ) ) ) )
7154
7154
}
7155
7155
7156
7156
try withTemporaryFile { fileMapFile in
@@ -7175,7 +7175,7 @@ final class SwiftDriverTests: XCTestCase {
7175
7175
let plannedJobs = try driver. planBuild ( )
7176
7176
let compileJob = plannedJobs [ 0 ]
7177
7177
XCTAssertEqual ( compileJob. kind, . compile)
7178
- try XCTAssertJobInvocationMatches ( compileJob, . flag( " -o " ) , . path( . absolute( . init( " /tmp/foo/.build/x86_64-apple-macosx/debug/foo.build/foo.o " ) ) ) )
7178
+ try XCTAssertJobInvocationMatches ( compileJob, . flag( " -o " ) , . path( . absolute( . init( validating : " /tmp/foo/.build/x86_64-apple-macosx/debug/foo.build/foo.o " ) ) ) )
7179
7179
}
7180
7180
7181
7181
try withTemporaryFile { fileMapFile in
@@ -7185,7 +7185,7 @@ final class SwiftDriverTests: XCTestCase {
7185
7185
" diagnostics " : " /tmp/foo/.build/x86_64-apple-macosx/debug/foo.build/master.dia " ,
7186
7186
" emit-module-diagnostics " : " /tmp/foo/.build/x86_64-apple-macosx/debug/foo.build/master.emit-module.dia "
7187
7187
},
7188
- " \( AbsolutePath ( " /some/workingdir/foo.swift " ) . nativePathString ( escaped: true ) ) " : {
7188
+ " \( try AbsolutePath ( validating : " /some/workingdir/foo.swift " ) . nativePathString ( escaped: true ) ) " : {
7189
7189
" object " : " /tmp/foo/.build/x86_64-apple-macosx/debug/foo.build/foo.o "
7190
7190
}
7191
7191
}
@@ -7196,12 +7196,12 @@ final class SwiftDriverTests: XCTestCase {
7196
7196
var driver = try Driver ( args: [ " swiftc " ,
7197
7197
" -target " , " arm64-apple-ios13.1 " ,
7198
7198
" foo.swift " ,
7199
- " -working-directory " , AbsolutePath ( " /some/workingdir " ) . nativePathString ( escaped: false ) ,
7199
+ " -working-directory " , try AbsolutePath ( validating : " /some/workingdir " ) . nativePathString ( escaped: false ) ,
7200
7200
" -output-file-map " , fileMapFile. path. description] )
7201
7201
let plannedJobs = try driver. planBuild ( )
7202
7202
let compileJob = plannedJobs [ 0 ]
7203
7203
XCTAssertEqual ( compileJob. kind, . compile)
7204
- try XCTAssertJobInvocationMatches ( compileJob, . flag( " -o " ) , . path( . absolute( . init( " /tmp/foo/.build/x86_64-apple-macosx/debug/foo.build/foo.o " ) ) ) )
7204
+ try XCTAssertJobInvocationMatches ( compileJob, . flag( " -o " ) , . path( . absolute( . init( validating : " /tmp/foo/.build/x86_64-apple-macosx/debug/foo.build/foo.o " ) ) ) )
7205
7205
}
7206
7206
}
7207
7207
@@ -7593,7 +7593,7 @@ final class SwiftDriverTests: XCTestCase {
7593
7593
var env = ProcessEnv . block
7594
7594
env [ " PLATFORM_DIR " ] = " /tmp/PlatformDir/ \( platform) .platform "
7595
7595
7596
- let workingDirectory = AbsolutePath ( " /tmp " )
7596
+ let workingDirectory = try AbsolutePath ( validating : " /tmp " )
7597
7597
7598
7598
var driver = try Driver (
7599
7599
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