@@ -3296,15 +3296,31 @@ final class SwiftDriverTests: XCTestCase {
3296
3296
3297
3297
func testToolsDirectory( ) throws {
3298
3298
try withTemporaryDirectory { tmpDir in
3299
+ #if os(iOS) || os(macOS) || os(tvOS) || os(watchOS)
3299
3300
let ld = tmpDir. appending ( component: " ld " )
3300
- try localFileSystem. writeFileContents ( ld) { $0 <<< " " }
3301
+ #else
3302
+ let ld = tmpDir. appending ( component: executableName ( " clang " ) )
3303
+ #endif
3304
+ // tiny PE binary from: https://archive.is/w01DO
3305
+ let contents : [ UInt8 ] = [
3306
+ 0x4d , 0x5a , 0x00 , 0x00 , 0x50 , 0x45 , 0x00 , 0x00 , 0x4c , 0x01 , 0x01 , 0x00 ,
3307
+ 0x6a , 0x2a , 0x58 , 0xc3 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
3308
+ 0x04 , 0x00 , 0x03 , 0x01 , 0x0b , 0x01 , 0x08 , 0x00 , 0x04 , 0x00 , 0x00 , 0x00 ,
3309
+ 0x00 , 0x00 , 0x00 , 0x00 , 0x04 , 0x00 , 0x00 , 0x00 , 0x0c , 0x00 , 0x00 , 0x00 ,
3310
+ 0x04 , 0x00 , 0x00 , 0x00 , 0x0c , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x40 , 0x00 ,
3311
+ 0x04 , 0x00 , 0x00 , 0x00 , 0x04 , 0x00 , 0x00 , 0x00 , 0x04 , 0x00 , 0x00 , 0x00 ,
3312
+ 0x00 , 0x00 , 0x00 , 0x00 , 0x04 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
3313
+ 0x68 , 0x00 , 0x00 , 0x00 , 0x64 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
3314
+ 0x02
3315
+ ]
3316
+ try localFileSystem. writeFileContents ( ld) { $0 <<< contents }
3301
3317
try localFileSystem. chmod ( . executable, path: AbsolutePath ( ld. pathString) )
3302
3318
var driver = try Driver ( args: [ " swiftc " ,
3303
- " -target " , " x86_64-apple-macosx10.14 " ,
3304
3319
" -tools-directory " , tmpDir. pathString,
3305
3320
" foo.swift " ] )
3306
- let frontendJobs = try driver. planBuild ( )
3307
- XCTAssertTrue ( frontendJobs. count == 2 )
3321
+ let frontendJobs = try driver. planBuild ( ) . removingAutolinkExtractJobs ( )
3322
+ XCTAssertEqual ( frontendJobs. count, 2 )
3323
+ XCTAssertEqual ( frontendJobs [ 1 ] . kind, . link)
3308
3324
XCTAssertEqual ( frontendJobs [ 1 ] . tool. absolutePath!. pathString, ld. pathString)
3309
3325
}
3310
3326
}
0 commit comments