@@ -1132,6 +1132,8 @@ final class SwiftDriverTests: XCTestCase {
1132
1132
1133
1133
do {
1134
1134
// static linking
1135
+ // Locating relevant libraries is dependent on being a macOS host
1136
+ #if os(macOS)
1135
1137
var driver = try Driver ( args: commonArgs + [ " -emit-library " , " -static " , " -L " , " /tmp " , " -Xlinker " , " -w " , " -target " , " x86_64-apple-macosx10.9 " , " -lto=llvm-full " ] , env: env)
1136
1138
let plannedJobs = try driver. planBuild ( )
1137
1139
@@ -1161,6 +1163,7 @@ final class SwiftDriverTests: XCTestCase {
1161
1163
XCTAssertFalse ( cmd. contains ( " -lto_library " ) )
1162
1164
XCTAssertFalse ( cmd. contains ( " -syslibroot " ) )
1163
1165
XCTAssertFalse ( cmd. contains ( " -no_objc_category_merging " ) )
1166
+ #endif
1164
1167
}
1165
1168
1166
1169
do {
@@ -1186,12 +1189,15 @@ final class SwiftDriverTests: XCTestCase {
1186
1189
1187
1190
do {
1188
1191
// lto linking
1192
+ // Locating relevant libraries is dependent on being a macOS host
1193
+ #if os(macOS)
1189
1194
var driver1 = try Driver ( args: commonArgs + [ " -emit-executable " , " -target " , " x86_64-apple-macosx10.15 " , " -lto=llvm-thin " ] , env: env)
1190
1195
let plannedJobs1 = try driver1. planBuild ( )
1191
1196
XCTAssertFalse ( plannedJobs1. contains ( where: { $0. kind == . autolinkExtract } ) )
1192
1197
let linkJob1 = plannedJobs1. first ( where: { $0. kind == . link } )
1193
1198
XCTAssertTrue ( linkJob1? . tool. name. contains ( " ld " ) )
1194
1199
XCTAssertTrue ( linkJob1? . commandLine. contains ( . flag( " -lto_library " ) ) )
1200
+ #endif
1195
1201
1196
1202
var driver2 = try Driver ( args: commonArgs + [ " -emit-executable " , " -target " , " x86_64-unknown-linux " , " -lto=llvm-thin " ] , env: env)
1197
1203
let plannedJobs2 = try driver2. planBuild ( )
@@ -2377,7 +2383,10 @@ final class SwiftDriverTests: XCTestCase {
2377
2383
return
2378
2384
}
2379
2385
}
2386
+ // On non-darwin hosts, libArcLite won't be found and a warning will be emitted
2387
+ #if os(macOS)
2380
2388
try assertNoDriverDiagnostics ( args: " swiftc " , " -c " , " -target " , " x86_64-apple-macosx10.14 " , " -link-objc-runtime " , " foo.swift " )
2389
+ #endif
2381
2390
}
2382
2391
2383
2392
func testProfileArgValidation( ) throws {
@@ -3481,6 +3490,7 @@ final class SwiftDriverTests: XCTestCase {
3481
3490
}
3482
3491
3483
3492
func testLTOLibraryArg( ) throws {
3493
+ #if os(macOS)
3484
3494
do {
3485
3495
var driver = try Driver ( args: [ " swiftc " , " foo.swift " , " -lto=llvm-thin " , " -target " , " x86_64-apple-macos11.0 " ] )
3486
3496
let plannedJobs = try driver. planBuild ( )
@@ -3499,6 +3509,7 @@ final class SwiftDriverTests: XCTestCase {
3499
3509
XCTAssertEqual ( plannedJobs. map ( \. kind) , [ . compile, . link] )
3500
3510
XCTAssertFalse ( plannedJobs [ 1 ] . commandLine. contains ( " -lto_library " ) )
3501
3511
}
3512
+ #endif
3502
3513
}
3503
3514
3504
3515
func testBCasTopLevelOutput( ) throws {
0 commit comments