Skip to content

Commit a7f8121

Browse files
committed
[Tests] NFC: Improve SwiftCommandStateTests.testToolchaArgument
Drop `SWIFTPM_CUSTOM_BIN_DIR` and related files because they are not passed through to the `hostSwiftSDK` anyway and even if they were we cannot use non-existant binaries because `targetTriple` of host toolchain gets computed by invoking `swiftc -print-target-info`.
1 parent dfa56d3 commit a7f8121

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

Tests/CommandsTests/SwiftCommandStateTests.swift

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -321,22 +321,16 @@ final class SwiftCommandStateTests: CommandsTestCase {
321321
}
322322

323323
func testToolchainArgument() throws {
324-
let hostBinDir = AbsolutePath("/swiftpm/bin")
325-
let hostSwiftcPath = hostBinDir.appending(components: ["swiftc"])
326-
327324
let customTargetToolchain = AbsolutePath("/path/to/toolchain")
328325
let targetSwiftcPath = customTargetToolchain.appending(components: ["usr", "bin" , "swiftc"])
329326
let targetArPath = customTargetToolchain.appending(components: ["usr", "bin", "llvm-ar"])
330327

331328
let fs = InMemoryFileSystem(emptyFiles: [
332329
"/Pkg/Sources/exe/main.swift",
333-
hostSwiftcPath.pathString,
334330
targetSwiftcPath.pathString,
335331
targetArPath.pathString
336332
])
337333

338-
339-
try fs.updatePermissions(hostSwiftcPath, isExecutable: true)
340334
try fs.updatePermissions(targetSwiftcPath, isExecutable: true)
341335
try fs.updatePermissions(targetArPath, isExecutable: true)
342336

@@ -361,10 +355,7 @@ final class SwiftCommandStateTests: CommandsTestCase {
361355
)
362356
let swiftCommandState = try SwiftCommandState.makeMockState(
363357
options: options,
364-
fileSystem: fs,
365-
environment: [
366-
"SWIFTPM_CUSTOM_BIN_DIR": hostBinDir.pathString
367-
]
358+
fileSystem: fs
368359
)
369360
XCTAssertEqual(swiftCommandState.originalWorkingDirectory, fs.currentWorkingDirectory)
370361
XCTAssertEqual(

Tests/PackageModelTests/SwiftSDKBundleTests.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,10 @@ final class SwiftSDKBundleTests: XCTestCase {
447447
)
448448
XCTAssertEqual(targetSwiftSDK.architectures, archs)
449449
XCTAssertEqual(targetSwiftSDK.pathsConfiguration.sdkRootPath, customCompileSDK)
450+
XCTAssertEqual(
451+
targetSwiftSDK.toolset.rootPaths,
452+
[customCompileToolchain.appending(components: ["usr", "bin"])] + hostSwiftSDK.toolset.rootPaths
453+
)
450454
}
451455
}
452456
}

0 commit comments

Comments
 (0)