@@ -609,7 +609,7 @@ final class SwiftDriverTests: XCTestCase {
609
609
XCTAssertJobInvocationMatches ( jobs [ 0 ] , . flag( " -file-compilation-dir " ) , . path( VirtualPath . lookup ( path) ) )
610
610
}
611
611
612
- let workingDirectory = AbsolutePath ( " /tmp " )
612
+ let workingDirectory = try AbsolutePath ( validating : " /tmp " )
613
613
try assertNoDriverDiagnostics ( args: " swiftc " , " foo.swift " , " -g " , " -c " , " -working-directory " , workingDirectory. nativePathString ( escaped: false ) ) { driver in
614
614
let jobs = try driver. planBuild ( )
615
615
let path = try VirtualPath . intern ( path: workingDirectory. nativePathString ( escaped: false ) )
@@ -1741,7 +1741,7 @@ final class SwiftDriverTests: XCTestCase {
1741
1741
let manyArgs = ( 1 ... 20000 ) . map { " -DTEST_ \( $0) " }
1742
1742
// Needs response file
1743
1743
do {
1744
- let source = AbsolutePath ( " /foo.swift " )
1744
+ let source = try AbsolutePath ( validating : " /foo.swift " )
1745
1745
var driver = try Driver ( args: [ " swift " ] + manyArgs + [ source. nativePathString ( escaped: false ) ] )
1746
1746
let jobs = try driver. planBuild ( )
1747
1747
XCTAssertEqual ( jobs. count, 1 )
@@ -1773,7 +1773,7 @@ final class SwiftDriverTests: XCTestCase {
1773
1773
1774
1774
// Forced response file
1775
1775
do {
1776
- let source = AbsolutePath ( " /foo.swift " )
1776
+ let source = try AbsolutePath ( validating : " /foo.swift " )
1777
1777
var driver = try Driver ( args: [ " swift " ] + [ source. nativePathString ( escaped: false ) ] )
1778
1778
let jobs = try driver. planBuild ( )
1779
1779
XCTAssertEqual ( jobs. count, 1 )
@@ -3095,7 +3095,7 @@ final class SwiftDriverTests: XCTestCase {
3095
3095
3096
3096
3097
3097
func testIndexFileEntryInSupplementaryFileOutputMap( ) throws {
3098
- let workingDirectory = AbsolutePath ( " /tmp " )
3098
+ let workingDirectory = try AbsolutePath ( validating : " /tmp " )
3099
3099
var driver1 = try Driver ( args: [
3100
3100
" swiftc " , " foo1.swift " , " foo2.swift " , " foo3.swift " , " foo4.swift " , " foo5.swift " ,
3101
3101
" -index-file " , " -index-file-path " , " foo5.swift " , " -o " , " /tmp/t.o " ,
@@ -3955,7 +3955,7 @@ final class SwiftDriverTests: XCTestCase {
3955
3955
XCTAssertEqual ( plannedJobs. count, 2 )
3956
3956
XCTAssertEqual ( plannedJobs [ 0 ] . kind, . compile)
3957
3957
XCTAssertEqual ( plannedJobs [ 1 ] . kind, . link)
3958
- try XCTAssertJobInvocationMatches ( plannedJobs [ 0 ] , . flag( " -default-isolation " ) , " MainActor " )
3958
+ XCTAssertJobInvocationMatches ( plannedJobs [ 0 ] , . flag( " -default-isolation " ) , " MainActor " )
3959
3959
}
3960
3960
3961
3961
func testImmediateMode( ) throws {
@@ -6930,9 +6930,9 @@ final class SwiftDriverTests: XCTestCase {
6930
6930
6931
6931
// 32-bit iOS jobs under Embedded should be allowed regardless of OS version
6932
6932
do {
6933
- try Driver ( args: [ " swiftc " , " -c " , " -target " , " armv7-apple-ios8 " , " -enable-experimental-feature " , " Embedded " , " foo.swift " ] )
6934
- try Driver ( args: [ " swiftc " , " -c " , " -target " , " armv7-apple-ios12.1 " , " -enable-experimental-feature " , " Embedded " , " foo.swift " ] )
6935
- try Driver ( args: [ " swiftc " , " -c " , " -target " , " armv7-apple-ios16 " , " -enable-experimental-feature " , " Embedded " , " foo.swift " ] )
6933
+ let _ = try Driver ( args: [ " swiftc " , " -c " , " -target " , " armv7-apple-ios8 " , " -enable-experimental-feature " , " Embedded " , " foo.swift " ] )
6934
+ let _ = try Driver ( args: [ " swiftc " , " -c " , " -target " , " armv7-apple-ios12.1 " , " -enable-experimental-feature " , " Embedded " , " foo.swift " ] )
6935
+ let _ = try Driver ( args: [ " swiftc " , " -c " , " -target " , " armv7-apple-ios16 " , " -enable-experimental-feature " , " Embedded " , " foo.swift " ] )
6936
6936
}
6937
6937
6938
6938
do {
@@ -7231,7 +7231,7 @@ final class SwiftDriverTests: XCTestCase {
7231
7231
}
7232
7232
7233
7233
do {
7234
- let workingDirectory = AbsolutePath ( " /foo/bar " )
7234
+ let workingDirectory = try AbsolutePath ( validating : " /foo/bar " )
7235
7235
7236
7236
// Inputs with relative paths with -working-directory flag should prefix all inputs
7237
7237
var driver = try Driver ( args: [ " swiftc " ,
@@ -7243,9 +7243,9 @@ final class SwiftDriverTests: XCTestCase {
7243
7243
let plannedJobs = try driver. planBuild ( )
7244
7244
let compileJob = plannedJobs [ 0 ]
7245
7245
XCTAssertEqual ( compileJob. kind, . compile)
7246
- try XCTAssertJobInvocationMatches ( compileJob, . flag( " -primary-file " ) , . path( . absolute( workingDirectory. appending ( component: " foo.swift " ) ) ) )
7247
- try XCTAssertJobInvocationMatches ( compileJob, . flag( " -resource-dir " ) , . path( . absolute( workingDirectory. appending ( component: " relresourcepath " ) ) ) )
7248
- try XCTAssertJobInvocationMatches ( compileJob, . flag( " -sdk " ) , . path( . absolute( workingDirectory. appending ( component: " relsdkpath " ) ) ) )
7246
+ XCTAssertJobInvocationMatches ( compileJob, . flag( " -primary-file " ) , . path( . absolute( workingDirectory. appending ( component: " foo.swift " ) ) ) )
7247
+ XCTAssertJobInvocationMatches ( compileJob, . flag( " -resource-dir " ) , . path( . absolute( workingDirectory. appending ( component: " relresourcepath " ) ) ) )
7248
+ XCTAssertJobInvocationMatches ( compileJob, . flag( " -sdk " ) , . path( . absolute( workingDirectory. appending ( component: " relsdkpath " ) ) ) )
7249
7249
}
7250
7250
7251
7251
try withTemporaryFile { fileMapFile in
@@ -7270,7 +7270,7 @@ final class SwiftDriverTests: XCTestCase {
7270
7270
let plannedJobs = try driver. planBuild ( )
7271
7271
let compileJob = plannedJobs [ 0 ]
7272
7272
XCTAssertEqual ( compileJob. kind, . compile)
7273
- try XCTAssertJobInvocationMatches ( compileJob, . flag( " -o " ) , . path( . absolute( . init( " /tmp/foo/.build/x86_64-apple-macosx/debug/foo.build/foo.o " ) ) ) )
7273
+ try XCTAssertJobInvocationMatches ( compileJob, . flag( " -o " ) , . path( . absolute( . init( validating : " /tmp/foo/.build/x86_64-apple-macosx/debug/foo.build/foo.o " ) ) ) )
7274
7274
}
7275
7275
7276
7276
try withTemporaryFile { fileMapFile in
@@ -7280,7 +7280,7 @@ final class SwiftDriverTests: XCTestCase {
7280
7280
" diagnostics " : " /tmp/foo/.build/x86_64-apple-macosx/debug/foo.build/master.dia " ,
7281
7281
" emit-module-diagnostics " : " /tmp/foo/.build/x86_64-apple-macosx/debug/foo.build/master.emit-module.dia "
7282
7282
},
7283
- " \( AbsolutePath ( " /some/workingdir/foo.swift " ) . nativePathString ( escaped: true ) ) " : {
7283
+ " \( try AbsolutePath ( validating : " /some/workingdir/foo.swift " ) . nativePathString ( escaped: true ) ) " : {
7284
7284
" object " : " /tmp/foo/.build/x86_64-apple-macosx/debug/foo.build/foo.o "
7285
7285
}
7286
7286
}
@@ -7291,12 +7291,12 @@ final class SwiftDriverTests: XCTestCase {
7291
7291
var driver = try Driver ( args: [ " swiftc " ,
7292
7292
" -target " , " arm64-apple-ios13.1 " ,
7293
7293
" foo.swift " ,
7294
- " -working-directory " , AbsolutePath ( " /some/workingdir " ) . nativePathString ( escaped: false ) ,
7294
+ " -working-directory " , try AbsolutePath ( validating : " /some/workingdir " ) . nativePathString ( escaped: false ) ,
7295
7295
" -output-file-map " , fileMapFile. path. description] )
7296
7296
let plannedJobs = try driver. planBuild ( )
7297
7297
let compileJob = plannedJobs [ 0 ]
7298
7298
XCTAssertEqual ( compileJob. kind, . compile)
7299
- try XCTAssertJobInvocationMatches ( compileJob, . flag( " -o " ) , . path( . absolute( . init( " /tmp/foo/.build/x86_64-apple-macosx/debug/foo.build/foo.o " ) ) ) )
7299
+ try XCTAssertJobInvocationMatches ( compileJob, . flag( " -o " ) , . path( . absolute( . init( validating : " /tmp/foo/.build/x86_64-apple-macosx/debug/foo.build/foo.o " ) ) ) )
7300
7300
}
7301
7301
}
7302
7302
@@ -7688,7 +7688,7 @@ final class SwiftDriverTests: XCTestCase {
7688
7688
var env = ProcessEnv . block
7689
7689
env [ " PLATFORM_DIR " ] = " /tmp/PlatformDir/ \( platform) .platform "
7690
7690
7691
- let workingDirectory = AbsolutePath ( " /tmp " )
7691
+ let workingDirectory = try AbsolutePath ( validating : " /tmp " )
7692
7692
7693
7693
var driver = try Driver (
7694
7694
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