Skip to content

Commit f8641c7

Browse files
committed
Generalize JobExecutorTests.testSaveTemps to also pass on AppleSilicon, by explicitly specifying the SDK when run on Darwin.
1 parent 1a642db commit f8641c7

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

Tests/SwiftDriverTests/JobExecutorTests.swift

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -447,13 +447,16 @@ final class JobExecutorTests: XCTestCase {
447447
}
448448
}
449449

450-
func testSaveTemps() throws {
451-
#if os(macOS) && arch(arm64)
452-
// Disabled on Apple Silicon
453-
// rdar://76609781
454-
throw XCTSkip()
450+
private func getHostToolchainSdkArg(_ executor: SwiftDriverExecutor) throws -> [String] {
451+
#if os(macOS)
452+
let toolchain = DarwinToolchain(env: ProcessEnv.vars, executor: executor)
453+
return try ["-sdk", toolchain.sdk.get().pathString]
454+
#else
455+
return []
455456
#endif
457+
}
456458

459+
func testSaveTemps() throws {
457460
do {
458461
try withTemporaryDirectory { path in
459462
let main = path.appending(component: "main.swift")
@@ -468,7 +471,7 @@ final class JobExecutorTests: XCTestCase {
468471
let outputPath = path.appending(component: "finalOutput")
469472
var driver = try Driver(args: ["swiftc", main.pathString,
470473
"-driver-filelist-threshold", "0",
471-
"-o", outputPath.pathString],
474+
"-o", outputPath.pathString] + getHostToolchainSdkArg(executor),
472475
env: ProcessEnv.vars,
473476
diagnosticsEngine: diags,
474477
fileSystem: localFileSystem,
@@ -506,7 +509,7 @@ final class JobExecutorTests: XCTestCase {
506509
var driver = try Driver(args: ["swiftc", main.pathString,
507510
"-save-temps",
508511
"-driver-filelist-threshold", "0",
509-
"-o", outputPath.pathString],
512+
"-o", outputPath.pathString] + getHostToolchainSdkArg(executor),
510513
env: ProcessEnv.vars,
511514
diagnosticsEngine: diags,
512515
fileSystem: localFileSystem,
@@ -544,7 +547,7 @@ final class JobExecutorTests: XCTestCase {
544547
var driver = try Driver(args: ["swiftc", main.pathString,
545548
"-driver-filelist-threshold", "0",
546549
"-Xfrontend", "-debug-crash-immediately",
547-
"-o", outputPath.pathString],
550+
"-o", outputPath.pathString] + getHostToolchainSdkArg(executor),
548551
env: ProcessEnv.vars,
549552
diagnosticsEngine: diags,
550553
fileSystem: localFileSystem,
@@ -564,6 +567,5 @@ final class JobExecutorTests: XCTestCase {
564567
)
565568
}
566569
}
567-
568570
}
569571
}

0 commit comments

Comments
 (0)