Skip to content

Commit a2bf954

Browse files
committed
Restrict directories that we search for MyDependency.swift in tests
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 https://github.com/swiftlang/swift-foundation/issues/1049, we would stop directory iteration at that file exceeding `MAX_PATH` and never find `MyDependency.swift`, causing these tests to fail.
1 parent c23b4ff commit a2bf954

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

Tests/SourceKitLSPTests/BackgroundIndexingTests.swift

+10-4
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,11 @@ final class BackgroundIndexingTests: XCTestCase {
245245
)
246246

247247
let dependencyUrl = try XCTUnwrap(
248-
FileManager.default.findFiles(named: "MyDependency.swift", in: project.scratchDirectory).only
248+
FileManager.default.findFiles(
249+
named: "MyDependency.swift",
250+
in: project.scratchDirectory.appendingPathComponent(".build").appendingPathComponent("index-build")
251+
.appendingPathComponent("checkouts")
252+
).only
249253
)
250254
let dependencyUri = DocumentURI(dependencyUrl)
251255
let testFileUri = try project.uri(for: "Test.swift")
@@ -1256,9 +1260,11 @@ final class BackgroundIndexingTests: XCTestCase {
12561260
try await project.testClient.send(PollIndexRequest())
12571261
project.testClient.send(
12581262
DidChangeWatchedFilesNotification(
1259-
changes: FileManager.default.findFiles(named: "Dependency.swift", in: project.scratchDirectory).map {
1260-
FileEvent(uri: DocumentURI($0), type: .changed)
1261-
}
1263+
changes: FileManager.default.findFiles(
1264+
named: "Dependency.swift",
1265+
in: project.scratchDirectory.appendingPathComponent(".build").appendingPathComponent("index-build")
1266+
.appendingPathComponent("checkouts")
1267+
).map { FileEvent(uri: DocumentURI($0), type: .changed) }
12621268
)
12631269
)
12641270

0 commit comments

Comments
 (0)