Skip to content

Commit

Permalink
Restrict directories that we search for MyDependency.swift in tests
Browse files Browse the repository at this point in the history
It appears that moving the index-build directory to be a subdirectory of `.build` caused some file in the index-build directory to exceed the `MAX_PATH` length on the SourceKit-LSP PR testing job (but not the swift PR job because that has a shorter job name). Because of swiftlang/swift-foundation#1049, we would stop directory iteration at that file exceeding `MAX_PATH` and never find `MyDependency.swift`, causing these tests to fail.
  • Loading branch information
ahoppen committed Nov 16, 2024
1 parent c23b4ff commit a2bf954
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions Tests/SourceKitLSPTests/BackgroundIndexingTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,11 @@ final class BackgroundIndexingTests: XCTestCase {
)

let dependencyUrl = try XCTUnwrap(
FileManager.default.findFiles(named: "MyDependency.swift", in: project.scratchDirectory).only
FileManager.default.findFiles(
named: "MyDependency.swift",
in: project.scratchDirectory.appendingPathComponent(".build").appendingPathComponent("index-build")
.appendingPathComponent("checkouts")
).only
)
let dependencyUri = DocumentURI(dependencyUrl)
let testFileUri = try project.uri(for: "Test.swift")
Expand Down Expand Up @@ -1256,9 +1260,11 @@ final class BackgroundIndexingTests: XCTestCase {
try await project.testClient.send(PollIndexRequest())
project.testClient.send(
DidChangeWatchedFilesNotification(
changes: FileManager.default.findFiles(named: "Dependency.swift", in: project.scratchDirectory).map {
FileEvent(uri: DocumentURI($0), type: .changed)
}
changes: FileManager.default.findFiles(
named: "Dependency.swift",
in: project.scratchDirectory.appendingPathComponent(".build").appendingPathComponent("index-build")
.appendingPathComponent("checkouts")
).map { FileEvent(uri: DocumentURI($0), type: .changed) }
)
)

Expand Down

0 comments on commit a2bf954

Please sign in to comment.