Skip to content

Commit fe1363c

Browse files
authored
Merge pull request #1666 from ahoppen/skip-was
Skip `testWasm` in CI if toolchain cannot compile for wasm
2 parents f07a30e + fffc783 commit fe1363c

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

Sources/SKTestSupport/SkipUnless.swift

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ package actor SkipUnless {
8484
}
8585

8686
private func skipUnlessSupported(
87+
allowSkippingInCI: Bool = false,
8788
featureName: String = #function,
8889
file: StaticString,
8990
line: UInt,
@@ -92,8 +93,8 @@ package actor SkipUnless {
9293
let checkResult: FeatureCheckResult
9394
if let cachedResult = checkCache[featureName] {
9495
checkResult = cachedResult
95-
} else if ProcessEnv.block["SWIFTCI_USE_LOCAL_DEPS"] != nil {
96-
// Never skip tests in CI. Toolchain should be up-to-date
96+
} else if ProcessEnv.block["SWIFTCI_USE_LOCAL_DEPS"] != nil && !allowSkippingInCI {
97+
// In general, don't skip tests in CI. Toolchain should be up-to-date
9798
checkResult = .featureSupported
9899
} else {
99100
checkResult = try await featureCheck()
@@ -466,7 +467,7 @@ package actor SkipUnless {
466467
file: StaticString = #filePath,
467468
line: UInt = #line
468469
) async throws {
469-
return try await shared.skipUnlessSupportedByToolchain(swiftVersion: SwiftVersion(6, 0), file: file, line: line) {
470+
return try await shared.skipUnlessSupported(allowSkippingInCI: true, file: file, line: line) {
470471
let swiftFrontend = try await unwrap(ToolchainRegistry.forTesting.default?.swift).parentDirectory
471472
.appending(component: "swift-frontend")
472473
return try await withTestScratchDir { scratchDirectory in
@@ -489,7 +490,10 @@ package actor SkipUnless {
489490
)
490491
try process.launch()
491492
let result = try await process.waitUntilExit()
492-
return result.exitStatus == .terminated(code: 0)
493+
if result.exitStatus == .terminated(code: 0) {
494+
return .featureSupported
495+
}
496+
return .featureUnsupported(skipMessage: "Skipping because toolchain can not compile for wasm")
493497
}
494498
}
495499
}

0 commit comments

Comments
 (0)