Skip to content

Commit c0c0f1f

Browse files
committed
Skip tests that use background indexing when running tests with a Swift 5.10 toolchain
#1714 changed the background preparation mode to `enabled` but a Swift 5.10 toolchain does not support `--experimental-prepare-for-indexing`. Thus, these tests fail. Skip tests that rely on background indexing when testing SourceKit-LSP with a Swift 5.10 host toolchain.
1 parent bce0993 commit c0c0f1f

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

Sources/SKTestSupport/TestSourceKitLSPClient.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,9 @@ package final class TestSourceKitLSPClient: MessageHandler, Sendable {
146146
preInitialization: ((TestSourceKitLSPClient) -> Void)? = nil,
147147
cleanUp: @Sendable @escaping () -> Void = {}
148148
) async throws {
149+
if enableBackgroundIndexing {
150+
try await SkipUnless.swiftPMSupportsExperimentalPrepareForIndexing()
151+
}
149152
var options = options
150153
if let globalModuleCache = try globalModuleCache {
151154
options.swiftPMOrDefault.swiftCompilerFlags =

Tests/SourceKitLSPTests/BackgroundIndexingTests.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,8 @@ final class BackgroundIndexingTests: XCTestCase {
542542
}
543543

544544
func testPrepareTargetAfterEditToDependency() async throws {
545+
try await SkipUnless.swiftPMSupportsExperimentalPrepareForIndexing()
546+
545547
var testHooks = TestHooks()
546548
let expectedPreparationTracker = ExpectedIndexTaskTracker(expectedPreparations: [
547549
[
@@ -641,6 +643,8 @@ final class BackgroundIndexingTests: XCTestCase {
641643
}
642644

643645
func testDontStackTargetPreparationForEditorFunctionality() async throws {
646+
try await SkipUnless.swiftPMSupportsExperimentalPrepareForIndexing()
647+
644648
let allDocumentsOpened = WrappedSemaphore(name: "All documents opened")
645649
let libBStartedPreparation = WrappedSemaphore(name: "LibB started preparing")
646650
let libDPreparedForEditing = WrappedSemaphore(name: "LibD prepared for editing")

0 commit comments

Comments
 (0)