swiftlang / sourcekit-lsp

Language Server Protocol implementation for Swift and C-based languages
Apache License 2.0
3.3k stars 273 forks source link

Wait for cancellation to propagate in `testDontReturnEmptyDiagnosticsIfDiagnosticRequestIsCancelled` #1412

Closed ahoppen closed 4 months ago

ahoppen commented 4 months ago

I saw a few non-deterministic test failures. I think the issue was that handling of the CancelRequestNotification is done asynchronously, which left a short window in which the sourcekitd diagnostics request could run and return results instead of being cancelled. Wait for the diagnostic request to actually be cancelled before running it for real.

While doing this, also introduce proper sourcekitd test hooks instead of relying on the preparation test hooks, which just got run as a side effect.

ahoppen commented 4 months ago

@swift-ci Please test

ahoppen commented 4 months ago

@swift-ci Please test

ahoppen commented 4 months ago

@swift-ci Please test

ahoppen commented 4 months ago

@swift-ci Please test

ahoppen commented 4 months ago

@swift-ci Please test Windows