From be54abc325f13a1d6d1d6d4eb941c3d040e768b1 Mon Sep 17 00:00:00 2001 From: Max Desiatov Date: Tue, 9 Sep 2025 19:23:43 +0100 Subject: [PATCH 1/3] swift test: Fix incorrect `wasmkit` arguments `wasmkit` expects executable arguments to be passed after `--` delimiter. Additionally, we need to bridge current directory to the host with the additional `--dir .` option. Fixes https://github.com/swiftlang/swift-package-manager/issues/9113 --- Sources/Commands/SwiftTestCommand.swift | 3 +++ Sources/PackageModel/SwiftSDKs/SwiftSDK.swift | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Sources/Commands/SwiftTestCommand.swift b/Sources/Commands/SwiftTestCommand.swift index 669f04dab3b..ba9573dff50 100644 --- a/Sources/Commands/SwiftTestCommand.swift +++ b/Sources/Commands/SwiftTestCommand.swift @@ -966,6 +966,9 @@ final class TestRunner { args.append(runnerPath.pathString) args.append(contentsOf: runner.extraCLIOptions) args.append(testPath.relative(to: localFileSystem.currentWorkingDirectory!).pathString) + if runner.path?.components.last == "wasmkit" { + args.append("--") + } args.append(contentsOf: self.additionalArguments) } else { #if os(macOS) diff --git a/Sources/PackageModel/SwiftSDKs/SwiftSDK.swift b/Sources/PackageModel/SwiftSDKs/SwiftSDK.swift index e0e75b96075..bef655063af 100644 --- a/Sources/PackageModel/SwiftSDKs/SwiftSDK.swift +++ b/Sources/PackageModel/SwiftSDKs/SwiftSDK.swift @@ -896,7 +896,7 @@ extension SwiftSDK { ) throws -> [SwiftSDK] { let wasmKitProperties = Toolset.ToolProperties( path: hostToolchainBinDir.appending("wasmkit"), - extraCLIOptions: ["run"] + extraCLIOptions: ["run", "--dir", "."] ) switch semanticVersion.schemaVersion { From 6023552a6a7700cfdffc342e0823be700cff32a3 Mon Sep 17 00:00:00 2001 From: Max Desiatov Date: Tue, 9 Sep 2025 20:48:50 +0100 Subject: [PATCH 2/3] SwiftSDKTests: fix expectation after update --- Tests/PackageModelTests/SwiftSDKTests.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/PackageModelTests/SwiftSDKTests.swift b/Tests/PackageModelTests/SwiftSDKTests.swift index d3c6b2f0643..999622ee993 100644 --- a/Tests/PackageModelTests/SwiftSDKTests.swift +++ b/Tests/PackageModelTests/SwiftSDKTests.swift @@ -578,7 +578,7 @@ final class SwiftSDKTests: XCTestCase { let wasmKitProperties = Toolset.ToolProperties( path: toolchainBinAbsolutePath.appending("wasmkit"), - extraCLIOptions: ["run"] + extraCLIOptions: ["run", "--dir", "."] ) XCTAssertEqual(wasiWithoutToolsetsDecoded[0].toolset.knownTools[.debugger], wasmKitProperties) From d5cc0e8edbc1280ab09fa0163badff7cbc19d9d4 Mon Sep 17 00:00:00 2001 From: Max Desiatov Date: Fri, 19 Sep 2025 12:53:52 +0100 Subject: [PATCH 3/3] Revert WasmKit special case in `SwiftTestCommand.swift` After https://github.com/swiftlang/swift/pull/80820 was merged this change is no longer needed. --- Sources/Commands/SwiftTestCommand.swift | 3 --- 1 file changed, 3 deletions(-) diff --git a/Sources/Commands/SwiftTestCommand.swift b/Sources/Commands/SwiftTestCommand.swift index ba9573dff50..669f04dab3b 100644 --- a/Sources/Commands/SwiftTestCommand.swift +++ b/Sources/Commands/SwiftTestCommand.swift @@ -966,9 +966,6 @@ final class TestRunner { args.append(runnerPath.pathString) args.append(contentsOf: runner.extraCLIOptions) args.append(testPath.relative(to: localFileSystem.currentWorkingDirectory!).pathString) - if runner.path?.components.last == "wasmkit" { - args.append("--") - } args.append(contentsOf: self.additionalArguments) } else { #if os(macOS)