Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Tests/SwiftBuildSupportTests/PIFBuilderTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ struct PIFBuilderTests {
let releaseConfig = try pif.workspace
.project(named: "BasicExecutable")
.target(named: "Executable")
.buildConfig(named: "Release")
.buildConfig(named: .release)

for platform in ProjectModel.BuildSettings.Platform.allCases {
let search_paths = releaseConfig.impartedBuildProperties.settings[.LIBRARY_SEARCH_PATHS, platform]
Expand Down
36 changes: 35 additions & 1 deletion Tests/SwiftBuildSupportTests/SwiftBuildSystemTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func withInstantiatedSwiftBuildSystem(
let observabilitySystem: TestingObservability = ObservabilitySystem.makeForTesting()
let toolchain = try UserToolchain.default
let workspace = try Workspace(
fileSystem: localFileSystem,
fileSystem: fileSystem,
forRootPackage: fixturePath,
customManifestLoader: ManifestLoader(toolchain: toolchain),
)
Expand Down Expand Up @@ -158,4 +158,38 @@ struct SwiftBuildSystemTests {
#expect(synthesizedArgs.table["CLANG_INDEX_STORE_PATH"] == expectedPathValue)
}
}

@Test(
.serialized,
arguments: [
(linkerDeadStripUT: true, expectedValue: "YES"),
(linkerDeadStripUT: false, expectedValue: nil),
]
)
func validateDeadStripSetting(
linkerDeadStripUT: Bool,
expectedValue: String?
) async throws {
try await withInstantiatedSwiftBuildSystem(
fromFixture: "PIFBuilder/Simple",
buildParameters: mockBuildParameters(
destination: .host,
linkerDeadStrip: linkerDeadStripUT,
),
) { swiftBuild, session, observabilityScope, buildParameters in

let buildSettings = try await swiftBuild.makeBuildParameters(
session: session,
symbolGraphOptions: nil,
setToolchainSetting: false, // Set this to false as SwiftBuild checks the toolchain path
)

let synthesizedArgs = try #require(buildSettings.overrides.synthesized)
let actual = synthesizedArgs.table["DEAD_CODE_STRIPPING"]
#expect(
actual == expectedValue,
"dead strip: \(linkerDeadStripUT) >>> Actual: '\(actual)' expected: '\(String(describing: expectedValue))'",
)
}
}
}