Skip to content

Commit f646f2a

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 f646f2a

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

Tests/SourceKitLSPTests/BackgroundIndexingTests.swift

+8-4
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,10 @@ 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("checkouts")
251+
).only
249252
)
250253
let dependencyUri = DocumentURI(dependencyUrl)
251254
let testFileUri = try project.uri(for: "Test.swift")
@@ -1256,9 +1259,10 @@ final class BackgroundIndexingTests: XCTestCase {
12561259
try await project.testClient.send(PollIndexRequest())
12571260
project.testClient.send(
12581261
DidChangeWatchedFilesNotification(
1259-
changes: FileManager.default.findFiles(named: "Dependency.swift", in: project.scratchDirectory).map {
1260-
FileEvent(uri: DocumentURI($0), type: .changed)
1261-
}
1262+
changes: FileManager.default.findFiles(
1263+
named: "Dependency.swift",
1264+
in: project.scratchDirectory.appendingPathComponent("checkouts")
1265+
).map { FileEvent(uri: DocumentURI($0), type: .changed) }
12621266
)
12631267
)
12641268

0 commit comments

Comments
 (0)