Skip to content

Commit 65d6399

Browse files
committed
Fix testExplicitModuleBuildEndToEnd by passing in the SDK path explicitly.
As-is, the test is sensitive to the environment and is currently failing with: ``` ld: library not found for -lobjc ``` Passing in the sdk path explicitly should make it pass and be more resilient.
1 parent f0b22be commit 65d6399

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

Package.resolved

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Tests/SwiftDriverTests/ExplicitModuleBuildTests.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,12 +557,18 @@ final class ExplicitModuleBuildTests: XCTestCase {
557557
$0 <<< "import G;"
558558
}
559559

560+
let executor = try SwiftDriverExecutor(diagnosticsEngine: DiagnosticsEngine(handlers: [Driver.stderrDiagnosticsHandler]),
561+
processSet: ProcessSet(),
562+
fileSystem: localFileSystem,
563+
env: ProcessEnv.vars)
564+
let sdkPath = try executor.checkNonZeroExit(
565+
args: "xcrun", "-sdk", "macosx", "--show-sdk-path").spm_chomp()
560566
let packageRootPath = URL(fileURLWithPath: #file).pathComponents
561567
.prefix(while: { $0 != "Tests" }).joined(separator: "/").dropFirst()
562568
let testInputsPath = packageRootPath + "/TestInputs"
563569
let cHeadersPath : String = testInputsPath + "/ExplicitModuleBuilds/CHeaders"
564570
let swiftModuleInterfacesPath : String = testInputsPath + "/ExplicitModuleBuilds/Swift"
565-
var driver = try Driver(args: ["swiftc",
571+
var driver = try Driver(args: ["swiftc", "-sdk", sdkPath,
566572
"-I", cHeadersPath,
567573
"-I", swiftModuleInterfacesPath,
568574
"-experimental-explicit-module-build",

0 commit comments

Comments
 (0)