diff --git a/Sources/SwiftBuildSupport/PackagePIFProjectBuilder+Products.swift b/Sources/SwiftBuildSupport/PackagePIFProjectBuilder+Products.swift index 7292cddc7fe..1153a7cb579 100644 --- a/Sources/SwiftBuildSupport/PackagePIFProjectBuilder+Products.swift +++ b/Sources/SwiftBuildSupport/PackagePIFProjectBuilder+Products.swift @@ -1022,6 +1022,13 @@ extension PackagePIFProjectBuilder { // This should eventually be set universally for all package targets/products. settings[.LINKER_DRIVER] = "swiftc" + // A test-runner should always be adjacent to the dynamic library containing the tests, + // so add the appropriate rpaths. + settings[.LD_RUNPATH_SEARCH_PATHS] = [ + "$(inherited)", + "$(RPATH_ORIGIN)" + ] + let deploymentTargets = unitTestProduct.deploymentTargets settings[.MACOSX_DEPLOYMENT_TARGET] = deploymentTargets?[.macOS] ?? nil settings[.IPHONEOS_DEPLOYMENT_TARGET] = deploymentTargets?[.iOS] ?? nil diff --git a/Tests/CommandsTests/TestCommandTests.swift b/Tests/CommandsTests/TestCommandTests.swift index b7684acbd77..008094e18f2 100644 --- a/Tests/CommandsTests/TestCommandTests.swift +++ b/Tests/CommandsTests/TestCommandTests.swift @@ -663,8 +663,7 @@ struct TestCommandTests { } } } when: { - (buildSystem == .swiftbuild && .linux == ProcessInfo.hostOperatingSystem) - || ProcessInfo.hostOperatingSystem == .windows + ProcessInfo.hostOperatingSystem == .windows } } @@ -1011,7 +1010,7 @@ struct TestCommandTests { ) } } when: { - buildSystem == .swiftbuild && ProcessInfo.hostOperatingSystem != .macOS + buildSystem == .swiftbuild && ProcessInfo.hostOperatingSystem == .windows } }