@@ -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 {
@@ -6857,9 +6857,9 @@ final class SwiftDriverTests: XCTestCase {
6857
6857
6858
6858
// 32-bit iOS jobs under Embedded should be allowed regardless of OS version
6859
6859
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 " ] )
6863
6863
}
6864
6864
6865
6865
do {
@@ -7158,7 +7158,7 @@ final class SwiftDriverTests: XCTestCase {
7158
7158
}
7159
7159
7160
7160
do {
7161
- let workingDirectory = AbsolutePath ( " /foo/bar " )
7161
+ let workingDirectory = try AbsolutePath ( validating : " /foo/bar " )
7162
7162
7163
7163
// Inputs with relative paths with -working-directory flag should prefix all inputs
7164
7164
var driver = try Driver ( args: [ " swiftc " ,
@@ -7170,9 +7170,9 @@ final class SwiftDriverTests: XCTestCase {
7170
7170
let plannedJobs = try driver. planBuild ( )
7171
7171
let compileJob = plannedJobs [ 0 ]
7172
7172
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 " ) ) ) )
7176
7176
}
7177
7177
7178
7178
try withTemporaryFile { fileMapFile in
@@ -7197,7 +7197,7 @@ final class SwiftDriverTests: XCTestCase {
7197
7197
let plannedJobs = try driver. planBuild ( )
7198
7198
let compileJob = plannedJobs [ 0 ]
7199
7199
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 " ) ) ) )
7201
7201
}
7202
7202
7203
7203
try withTemporaryFile { fileMapFile in
@@ -7207,7 +7207,7 @@ final class SwiftDriverTests: XCTestCase {
7207
7207
" diagnostics " : " /tmp/foo/.build/x86_64-apple-macosx/debug/foo.build/master.dia " ,
7208
7208
" emit-module-diagnostics " : " /tmp/foo/.build/x86_64-apple-macosx/debug/foo.build/master.emit-module.dia "
7209
7209
},
7210
- " \( AbsolutePath ( " /some/workingdir/foo.swift " ) . nativePathString ( escaped: true ) ) " : {
7210
+ " \( try AbsolutePath ( validating : " /some/workingdir/foo.swift " ) . nativePathString ( escaped: true ) ) " : {
7211
7211
" object " : " /tmp/foo/.build/x86_64-apple-macosx/debug/foo.build/foo.o "
7212
7212
}
7213
7213
}
@@ -7218,12 +7218,12 @@ final class SwiftDriverTests: XCTestCase {
7218
7218
var driver = try Driver ( args: [ " swiftc " ,
7219
7219
" -target " , " arm64-apple-ios13.1 " ,
7220
7220
" foo.swift " ,
7221
- " -working-directory " , AbsolutePath ( " /some/workingdir " ) . nativePathString ( escaped: false ) ,
7221
+ " -working-directory " , try AbsolutePath ( validating : " /some/workingdir " ) . nativePathString ( escaped: false ) ,
7222
7222
" -output-file-map " , fileMapFile. path. description] )
7223
7223
let plannedJobs = try driver. planBuild ( )
7224
7224
let compileJob = plannedJobs [ 0 ]
7225
7225
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 " ) ) ) )
7227
7227
}
7228
7228
}
7229
7229
@@ -7615,7 +7615,7 @@ final class SwiftDriverTests: XCTestCase {
7615
7615
var env = ProcessEnv . block
7616
7616
env [ " PLATFORM_DIR " ] = " /tmp/PlatformDir/ \( platform) .platform "
7617
7617
7618
- let workingDirectory = AbsolutePath ( " /tmp " )
7618
+ let workingDirectory = try AbsolutePath ( validating : " /tmp " )
7619
7619
7620
7620
var driver = try Driver (
7621
7621
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