@@ -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 ) )
@@ -1752,7 +1752,7 @@ final class SwiftDriverTests: XCTestCase {
1752
1752
let manyArgs = ( 1 ... 20000 ) . map { " -DTEST_ \( $0) " }
1753
1753
// Needs response file
1754
1754
do {
1755
- let source = AbsolutePath ( " /foo.swift " )
1755
+ let source = try AbsolutePath ( validating : " /foo.swift " )
1756
1756
var driver = try Driver ( args: [ " swift " ] + manyArgs + [ source. nativePathString ( escaped: false ) ] )
1757
1757
let jobs = try driver. planBuild ( )
1758
1758
XCTAssertEqual ( jobs. count, 1 )
@@ -1784,7 +1784,7 @@ final class SwiftDriverTests: XCTestCase {
1784
1784
1785
1785
// Forced response file
1786
1786
do {
1787
- let source = AbsolutePath ( " /foo.swift " )
1787
+ let source = try AbsolutePath ( validating : " /foo.swift " )
1788
1788
var driver = try Driver ( args: [ " swift " ] + [ source. nativePathString ( escaped: false ) ] )
1789
1789
let jobs = try driver. planBuild ( )
1790
1790
XCTAssertEqual ( jobs. count, 1 )
@@ -3186,7 +3186,7 @@ final class SwiftDriverTests: XCTestCase {
3186
3186
3187
3187
3188
3188
func testIndexFileEntryInSupplementaryFileOutputMap( ) throws {
3189
- let workingDirectory = AbsolutePath ( " /tmp " )
3189
+ let workingDirectory = try AbsolutePath ( validating : " /tmp " )
3190
3190
var driver1 = try Driver ( args: [
3191
3191
" swiftc " , " foo1.swift " , " foo2.swift " , " foo3.swift " , " foo4.swift " , " foo5.swift " ,
3192
3192
" -index-file " , " -index-file-path " , " foo5.swift " , " -o " , " /tmp/t.o " ,
@@ -4046,7 +4046,7 @@ final class SwiftDriverTests: XCTestCase {
4046
4046
XCTAssertEqual ( plannedJobs. count, 2 )
4047
4047
XCTAssertEqual ( plannedJobs [ 0 ] . kind, . compile)
4048
4048
XCTAssertEqual ( plannedJobs [ 1 ] . kind, . link)
4049
- try XCTAssertJobInvocationMatches ( plannedJobs [ 0 ] , . flag( " -default-isolation " ) , " MainActor " )
4049
+ XCTAssertJobInvocationMatches ( plannedJobs [ 0 ] , . flag( " -default-isolation " ) , " MainActor " )
4050
4050
}
4051
4051
4052
4052
func testImmediateMode( ) throws {
@@ -7021,9 +7021,9 @@ final class SwiftDriverTests: XCTestCase {
7021
7021
7022
7022
// 32-bit iOS jobs under Embedded should be allowed regardless of OS version
7023
7023
do {
7024
- try Driver ( args: [ " swiftc " , " -c " , " -target " , " armv7-apple-ios8 " , " -enable-experimental-feature " , " Embedded " , " foo.swift " ] )
7025
- try Driver ( args: [ " swiftc " , " -c " , " -target " , " armv7-apple-ios12.1 " , " -enable-experimental-feature " , " Embedded " , " foo.swift " ] )
7026
- try Driver ( args: [ " swiftc " , " -c " , " -target " , " armv7-apple-ios16 " , " -enable-experimental-feature " , " Embedded " , " foo.swift " ] )
7024
+ let _ = try Driver ( args: [ " swiftc " , " -c " , " -target " , " armv7-apple-ios8 " , " -enable-experimental-feature " , " Embedded " , " foo.swift " ] )
7025
+ let _ = try Driver ( args: [ " swiftc " , " -c " , " -target " , " armv7-apple-ios12.1 " , " -enable-experimental-feature " , " Embedded " , " foo.swift " ] )
7026
+ let _ = try Driver ( args: [ " swiftc " , " -c " , " -target " , " armv7-apple-ios16 " , " -enable-experimental-feature " , " Embedded " , " foo.swift " ] )
7027
7027
}
7028
7028
7029
7029
do {
@@ -7322,7 +7322,7 @@ final class SwiftDriverTests: XCTestCase {
7322
7322
}
7323
7323
7324
7324
do {
7325
- let workingDirectory = AbsolutePath ( " /foo/bar " )
7325
+ let workingDirectory = try AbsolutePath ( validating : " /foo/bar " )
7326
7326
7327
7327
// Inputs with relative paths with -working-directory flag should prefix all inputs
7328
7328
var driver = try Driver ( args: [ " swiftc " ,
@@ -7334,9 +7334,9 @@ final class SwiftDriverTests: XCTestCase {
7334
7334
let plannedJobs = try driver. planBuild ( )
7335
7335
let compileJob = plannedJobs [ 0 ]
7336
7336
XCTAssertEqual ( compileJob. kind, . compile)
7337
- try XCTAssertJobInvocationMatches ( compileJob, . flag( " -primary-file " ) , . path( . absolute( workingDirectory. appending ( component: " foo.swift " ) ) ) )
7338
- try XCTAssertJobInvocationMatches ( compileJob, . flag( " -resource-dir " ) , . path( . absolute( workingDirectory. appending ( component: " relresourcepath " ) ) ) )
7339
- try XCTAssertJobInvocationMatches ( compileJob, . flag( " -sdk " ) , . path( . absolute( workingDirectory. appending ( component: " relsdkpath " ) ) ) )
7337
+ XCTAssertJobInvocationMatches ( compileJob, . flag( " -primary-file " ) , . path( . absolute( workingDirectory. appending ( component: " foo.swift " ) ) ) )
7338
+ XCTAssertJobInvocationMatches ( compileJob, . flag( " -resource-dir " ) , . path( . absolute( workingDirectory. appending ( component: " relresourcepath " ) ) ) )
7339
+ XCTAssertJobInvocationMatches ( compileJob, . flag( " -sdk " ) , . path( . absolute( workingDirectory. appending ( component: " relsdkpath " ) ) ) )
7340
7340
}
7341
7341
7342
7342
try withTemporaryFile { fileMapFile in
@@ -7361,7 +7361,7 @@ final class SwiftDriverTests: XCTestCase {
7361
7361
let plannedJobs = try driver. planBuild ( )
7362
7362
let compileJob = plannedJobs [ 0 ]
7363
7363
XCTAssertEqual ( compileJob. kind, . compile)
7364
- try XCTAssertJobInvocationMatches ( compileJob, . flag( " -o " ) , . path( . absolute( . init( " /tmp/foo/.build/x86_64-apple-macosx/debug/foo.build/foo.o " ) ) ) )
7364
+ try XCTAssertJobInvocationMatches ( compileJob, . flag( " -o " ) , . path( . absolute( . init( validating : " /tmp/foo/.build/x86_64-apple-macosx/debug/foo.build/foo.o " ) ) ) )
7365
7365
}
7366
7366
7367
7367
try withTemporaryFile { fileMapFile in
@@ -7371,7 +7371,7 @@ final class SwiftDriverTests: XCTestCase {
7371
7371
" diagnostics " : " /tmp/foo/.build/x86_64-apple-macosx/debug/foo.build/master.dia " ,
7372
7372
" emit-module-diagnostics " : " /tmp/foo/.build/x86_64-apple-macosx/debug/foo.build/master.emit-module.dia "
7373
7373
},
7374
- " \( AbsolutePath ( " /some/workingdir/foo.swift " ) . nativePathString ( escaped: true ) ) " : {
7374
+ " \( try AbsolutePath ( validating : " /some/workingdir/foo.swift " ) . nativePathString ( escaped: true ) ) " : {
7375
7375
" object " : " /tmp/foo/.build/x86_64-apple-macosx/debug/foo.build/foo.o "
7376
7376
}
7377
7377
}
@@ -7382,12 +7382,12 @@ final class SwiftDriverTests: XCTestCase {
7382
7382
var driver = try Driver ( args: [ " swiftc " ,
7383
7383
" -target " , " arm64-apple-ios13.1 " ,
7384
7384
" foo.swift " ,
7385
- " -working-directory " , AbsolutePath ( " /some/workingdir " ) . nativePathString ( escaped: false ) ,
7385
+ " -working-directory " , try AbsolutePath ( validating : " /some/workingdir " ) . nativePathString ( escaped: false ) ,
7386
7386
" -output-file-map " , fileMapFile. path. description] )
7387
7387
let plannedJobs = try driver. planBuild ( )
7388
7388
let compileJob = plannedJobs [ 0 ]
7389
7389
XCTAssertEqual ( compileJob. kind, . compile)
7390
- try XCTAssertJobInvocationMatches ( compileJob, . flag( " -o " ) , . path( . absolute( . init( " /tmp/foo/.build/x86_64-apple-macosx/debug/foo.build/foo.o " ) ) ) )
7390
+ try XCTAssertJobInvocationMatches ( compileJob, . flag( " -o " ) , . path( . absolute( . init( validating : " /tmp/foo/.build/x86_64-apple-macosx/debug/foo.build/foo.o " ) ) ) )
7391
7391
}
7392
7392
}
7393
7393
@@ -7779,7 +7779,7 @@ final class SwiftDriverTests: XCTestCase {
7779
7779
var env = ProcessEnv . block
7780
7780
env [ " PLATFORM_DIR " ] = " /tmp/PlatformDir/ \( platform) .platform "
7781
7781
7782
- let workingDirectory = AbsolutePath ( " /tmp " )
7782
+ let workingDirectory = try AbsolutePath ( validating : " /tmp " )
7783
7783
7784
7784
var driver = try Driver (
7785
7785
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