Skip to content

Commit a10f663

Browse files
committed
First commit
1 parent 5c79ce1 commit a10f663

File tree

1 file changed

+41
-1
lines changed

1 file changed

+41
-1
lines changed

Tests/SwiftBuildSupportTests/SwiftBuildSystemTests.swift

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func withInstantiatedSwiftBuildSystem(
4646
let observabilitySystem: TestingObservability = ObservabilitySystem.makeForTesting()
4747
let toolchain = try UserToolchain.default
4848
let workspace = try Workspace(
49-
fileSystem: localFileSystem,
49+
fileSystem: Basics.localFileSystem,
5050
forRootPackage: fixturePath,
5151
customManifestLoader: ManifestLoader(toolchain: toolchain),
5252
)
@@ -158,4 +158,44 @@ struct SwiftBuildSystemTests {
158158
#expect(synthesizedArgs.table["CLANG_INDEX_STORE_PATH"] == expectedPathValue)
159159
}
160160
}
161+
162+
@Test(
163+
.serialized,
164+
arguments: [
165+
(linkerDeadStripUT: true, expectedValue: "YES"),
166+
(linkerDeadStripUT: false, expectedValue: nil),
167+
]
168+
)
169+
func validateDeadStripSetting(
170+
linkerDeadStripUT: Bool,
171+
expectedValue: String?
172+
) async throws {
173+
try await withInstantiatedSwiftBuildSystem(
174+
fromFixture: "PIFBuilder/Simple",
175+
buildParameters: mockBuildParameters(
176+
destination: .host,
177+
linkerDeadStrip: linkerDeadStripUT,
178+
),
179+
) { swiftBuild, session, observabilityScope, buildParameters in
180+
181+
#expect(false, "purposely failing")
182+
let buildSettings = try await swiftBuild.makeBuildParameters(
183+
session: session,
184+
symbolGraphOptions: nil,
185+
)
186+
187+
let expectedValue: String? = switch linkerDeadStripUT {
188+
case true:
189+
"YES"
190+
case false:
191+
nil
192+
}
193+
194+
let synthesizedArgs = try #require(buildSettings.overrides.synthesized)
195+
let actual = try #require(synthesizedArgs.table["DEAD_CODE_STRIPPING"], "Code stripping value should not be nil")
196+
print("dead strip: \(linkerDeadStripUT) >>> Actual: '\(actual)' expected: '\(expectedValue)'")
197+
#expect(actual == expectedValue)
198+
#expect(false, "purposely failing")
199+
}
200+
}
161201
}

0 commit comments

Comments
 (0)