@@ -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 {
@@ -6927,9 +6927,9 @@ final class SwiftDriverTests: XCTestCase {
6927
6927
6928
6928
// 32-bit iOS jobs under Embedded should be allowed regardless of OS version
6929
6929
do {
6930
- try Driver ( args: [ " swiftc " , " -c " , " -target " , " armv7-apple-ios8 " , " -enable-experimental-feature " , " Embedded " , " foo.swift " ] )
6931
- try Driver ( args: [ " swiftc " , " -c " , " -target " , " armv7-apple-ios12.1 " , " -enable-experimental-feature " , " Embedded " , " foo.swift " ] )
6932
- try Driver ( args: [ " swiftc " , " -c " , " -target " , " armv7-apple-ios16 " , " -enable-experimental-feature " , " Embedded " , " foo.swift " ] )
6930
+ let _ = try Driver ( args: [ " swiftc " , " -c " , " -target " , " armv7-apple-ios8 " , " -enable-experimental-feature " , " Embedded " , " foo.swift " ] )
6931
+ let _ = try Driver ( args: [ " swiftc " , " -c " , " -target " , " armv7-apple-ios12.1 " , " -enable-experimental-feature " , " Embedded " , " foo.swift " ] )
6932
+ let _ = try Driver ( args: [ " swiftc " , " -c " , " -target " , " armv7-apple-ios16 " , " -enable-experimental-feature " , " Embedded " , " foo.swift " ] )
6933
6933
}
6934
6934
6935
6935
do {
@@ -7228,7 +7228,7 @@ final class SwiftDriverTests: XCTestCase {
7228
7228
}
7229
7229
7230
7230
do {
7231
- let workingDirectory = AbsolutePath ( " /foo/bar " )
7231
+ let workingDirectory = try AbsolutePath ( validating : " /foo/bar " )
7232
7232
7233
7233
// Inputs with relative paths with -working-directory flag should prefix all inputs
7234
7234
var driver = try Driver ( args: [ " swiftc " ,
@@ -7240,9 +7240,9 @@ final class SwiftDriverTests: XCTestCase {
7240
7240
let plannedJobs = try driver. planBuild ( )
7241
7241
let compileJob = plannedJobs [ 0 ]
7242
7242
XCTAssertEqual ( compileJob. kind, . compile)
7243
- try XCTAssertJobInvocationMatches ( compileJob, . flag( " -primary-file " ) , . path( . absolute( workingDirectory. appending ( component: " foo.swift " ) ) ) )
7244
- try XCTAssertJobInvocationMatches ( compileJob, . flag( " -resource-dir " ) , . path( . absolute( workingDirectory. appending ( component: " relresourcepath " ) ) ) )
7245
- try XCTAssertJobInvocationMatches ( compileJob, . flag( " -sdk " ) , . path( . absolute( workingDirectory. appending ( component: " relsdkpath " ) ) ) )
7243
+ XCTAssertJobInvocationMatches ( compileJob, . flag( " -primary-file " ) , . path( . absolute( workingDirectory. appending ( component: " foo.swift " ) ) ) )
7244
+ XCTAssertJobInvocationMatches ( compileJob, . flag( " -resource-dir " ) , . path( . absolute( workingDirectory. appending ( component: " relresourcepath " ) ) ) )
7245
+ XCTAssertJobInvocationMatches ( compileJob, . flag( " -sdk " ) , . path( . absolute( workingDirectory. appending ( component: " relsdkpath " ) ) ) )
7246
7246
}
7247
7247
7248
7248
try withTemporaryFile { fileMapFile in
@@ -7267,7 +7267,7 @@ final class SwiftDriverTests: XCTestCase {
7267
7267
let plannedJobs = try driver. planBuild ( )
7268
7268
let compileJob = plannedJobs [ 0 ]
7269
7269
XCTAssertEqual ( compileJob. kind, . compile)
7270
- try XCTAssertJobInvocationMatches ( compileJob, . flag( " -o " ) , . path( . absolute( . init( " /tmp/foo/.build/x86_64-apple-macosx/debug/foo.build/foo.o " ) ) ) )
7270
+ try XCTAssertJobInvocationMatches ( compileJob, . flag( " -o " ) , . path( . absolute( . init( validating : " /tmp/foo/.build/x86_64-apple-macosx/debug/foo.build/foo.o " ) ) ) )
7271
7271
}
7272
7272
7273
7273
try withTemporaryFile { fileMapFile in
@@ -7277,7 +7277,7 @@ final class SwiftDriverTests: XCTestCase {
7277
7277
" diagnostics " : " /tmp/foo/.build/x86_64-apple-macosx/debug/foo.build/master.dia " ,
7278
7278
" emit-module-diagnostics " : " /tmp/foo/.build/x86_64-apple-macosx/debug/foo.build/master.emit-module.dia "
7279
7279
},
7280
- " \( AbsolutePath ( " /some/workingdir/foo.swift " ) . nativePathString ( escaped: true ) ) " : {
7280
+ " \( try AbsolutePath ( validating : " /some/workingdir/foo.swift " ) . nativePathString ( escaped: true ) ) " : {
7281
7281
" object " : " /tmp/foo/.build/x86_64-apple-macosx/debug/foo.build/foo.o "
7282
7282
}
7283
7283
}
@@ -7288,12 +7288,12 @@ final class SwiftDriverTests: XCTestCase {
7288
7288
var driver = try Driver ( args: [ " swiftc " ,
7289
7289
" -target " , " arm64-apple-ios13.1 " ,
7290
7290
" foo.swift " ,
7291
- " -working-directory " , AbsolutePath ( " /some/workingdir " ) . nativePathString ( escaped: false ) ,
7291
+ " -working-directory " , try AbsolutePath ( validating : " /some/workingdir " ) . nativePathString ( escaped: false ) ,
7292
7292
" -output-file-map " , fileMapFile. path. description] )
7293
7293
let plannedJobs = try driver. planBuild ( )
7294
7294
let compileJob = plannedJobs [ 0 ]
7295
7295
XCTAssertEqual ( compileJob. kind, . compile)
7296
- try XCTAssertJobInvocationMatches ( compileJob, . flag( " -o " ) , . path( . absolute( . init( " /tmp/foo/.build/x86_64-apple-macosx/debug/foo.build/foo.o " ) ) ) )
7296
+ try XCTAssertJobInvocationMatches ( compileJob, . flag( " -o " ) , . path( . absolute( . init( validating : " /tmp/foo/.build/x86_64-apple-macosx/debug/foo.build/foo.o " ) ) ) )
7297
7297
}
7298
7298
}
7299
7299
@@ -7685,7 +7685,7 @@ final class SwiftDriverTests: XCTestCase {
7685
7685
var env = ProcessEnv . block
7686
7686
env [ " PLATFORM_DIR " ] = " /tmp/PlatformDir/ \( platform) .platform "
7687
7687
7688
- let workingDirectory = AbsolutePath ( " /tmp " )
7688
+ let workingDirectory = try AbsolutePath ( validating : " /tmp " )
7689
7689
7690
7690
var driver = try Driver (
7691
7691
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