Skip to content

Commit b7b1f8e

Browse files
Skip static stdlib test if the toolchain does not support it
This is usually the case when building with some of build-presets without `build-swift-static-stdlib` option.
1 parent e05c403 commit b7b1f8e

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

Tests/CommandsTests/PackageCommandTests.swift

+16
Original file line numberDiff line numberDiff line change
@@ -1578,6 +1578,22 @@ final class PackageCommandTests: CommandsTestCase {
15781578
}
15791579

15801580
func testBuildToolPluginWithStaticStdlib() async throws {
1581+
// Skip if the toolchain cannot compile a simple program with static stdlib.
1582+
do {
1583+
let args = try [
1584+
UserToolchain.default.swiftCompilerPath.pathString,
1585+
"-static-stdlib", "-emit-executable", "-o", "/dev/null", "-"
1586+
]
1587+
let process = AsyncProcess(arguments: args)
1588+
let stdin = try process.launch()
1589+
stdin.write(sequence: "".utf8)
1590+
try stdin.close()
1591+
let result = try await process.waitUntilExit()
1592+
try XCTSkipIf(
1593+
result.exitStatus != .terminated(code: 0),
1594+
"skipping because static stdlib is not supported by the toolchain"
1595+
)
1596+
}
15811597
try await testBuildToolPlugin(staticStdlib: true)
15821598
}
15831599

0 commit comments

Comments
 (0)