Commit Graph

30 Commits

Author SHA1 Message Date
Max Desiatov
effcb1c20a Move Platform to SwiftPM (#704) 2023-02-07 09:48:26 +00:00
Saleem Abdulrasool
4bbd74f105 SourceKit: sever dependency on TSCUtility
The dependency on `TSCUtility` was strictly for identifying the platform
of execution. This logic is relatively self-contained and effectively an
extension over an enumeration. Replicate this logic with updates for new
syntactic improvements. This allows us to partially reduce dependency on
swift-tools-support-core. The dependency on TSCBasic is more complicated
to remove due to the extensive use of `AbsolutePath`.

Co-authored-by: Alex Hoppen <alex@alexhoppen.de>
2023-01-02 12:30:28 -08:00
Alex Hoppen
fa9b5f96ac Add a test case checking that documentDependenciesUpdated works for clang
We weren’t sure if it works because it always sends 0 as the document’s version number, but everythig appears to be fine.
2022-12-02 09:53:19 +01:00
Alex Hoppen
df594e332c Set a default timeout duration
Instead of having ad-hoc timeout durations in all the test cases, specify a default timeout duration that can be used by tests.

This allows us increase the timeout duration for all tests if we discover that e.g. sourcekitd is slower in CI setups.

rdar://91615376
2022-06-14 17:26:06 +02:00
Alex Hoppen
97ccf1da0c Cache which workspace a document with a given URI should be opened in
Determining which workspace a document belongs to is potentially non-trivial (although it shouldn’t be too expensive either). But since it’s executed for every request, cache it.
2022-05-04 14:48:31 +02:00
Alex Hoppen
d917e40410 Prepare SourceKitServer for multiple workspaces
This makes SourceKitServer keep track of multiple workspaces and their handling. It does not include the functionality to determine which workspace a file belongs to.
2022-05-04 14:48:31 +02:00
Ben Langmuir
3927e639be Revert "Support opening multiple workspaces in a single sourcekit-lsp instance" 2022-05-03 13:47:19 -07:00
Alex Hoppen
46f3b0e97c Merge pull request #473 from ahoppen/pr/multiple-workspaces
Support opening multiple workspaces in a single sourcekit-lsp instance
2022-05-03 17:26:29 +02:00
Alex Hoppen
09f52e9122 Cache which workspace a document with a given URI should be opened in
Determining which workspace a document belongs to is potentially non-trivial (although it shouldn’t be too expensive either). But since it’s executed for every request, cache it.
2022-05-02 09:31:07 +02:00
Alex Hoppen
6425b0d212 Prepare SourceKitServer for multiple workspaces
This makes SourceKitServer keep track of multiple workspaces and their handling. It does not include the functionality to determine which workspace a file belongs to.
2022-04-29 14:33:01 +02:00
Alex Hoppen
733b5d0d1f Enable crash recovery tests again
It turned out that the test failures were not specific to the crash recovery tests and we needed to disable all SourceKit-LSP tests on Linux. There’s no need to disable the crash recovery tests specifically anymore
2022-04-27 11:31:29 +02:00
Alex Hoppen
7a4b027490 Disable crash recovery tests
These are sometimes causing memory corruption issues on Linux. Disable the tests until we have time to debug the root issue.
2022-03-14 11:57:53 +01:00
Saleem Abdulrasool
b6ca84ec10 explicitly indicate the TSCUtility interfaces used
This explicitly identifies the TSCUtility interfaces that SourceKit
depends on.  This helps identify a "burn down list" of interfaces that
remain in TSC(Utility) which are in use.  As these interfaces are
replaced, we can easily monitor the remaining interfaces that are in
use.
2022-02-02 13:29:03 -08:00
Alex Hoppen
c445225721 Delete LinuxMain and XCTestManifests and automatically discover test on Linux
Automatic test discovery is enabled by default since Swift 5.4. I think we can start relying on it.
2022-01-18 12:52:36 +01:00
Alex Hoppen
c34d004f19 Revert "Disable clangd crash recovery tests on Linux"
This reverts commit a239421247.

The underlying issue in swift-corelibs-foundation has been fixed in b07ad9271c8b8f4e41e239f39031869cd7d103c0.
2021-05-26 12:25:02 +02:00
Ben Langmuir
a239421247 Disable clangd crash recovery tests on Linux
Until we can fix whatever is sporadically crashing in CI.

rdar://78035044
2021-05-20 10:18:25 -07:00
Alex Hoppen
ee53f858c5 Globally ignore SIGPIPE on Linux
We receive a `SIGPIPE` if we write to a pipe that points to a crashed process. This in particular happens if the target of a `JSONRPCConnection` has crashed and we try to send it a message.
On Darwin, `DispatchIO` ignores `SIGPIPE` for the pipes handled by it, but that features is not available on Linux.
Instead, globally ignore `SIGPIPE` on Linux to prevent us from crashing if the `JSONRPCConnection`'s target crashes.

Fixes rdar://75580936
2021-03-22 22:40:47 +01:00
Ben Langmuir
c04656dbfc Disable clangd crash recovery tests on Linux/Windows
These are failing sometimes in CI, so disable while we investigate.

rdar://75580936
2021-03-18 11:07:56 -07:00
David Goldman
e6b0796cff Additions to the LSP module for workspace/didChangeWatchedFiles (#376)
* Additions to the LSP module for `workspace/didChangeWatchedFiles`

We can then use this functionality to allow a `BuildSystem` to watch
files (e.g. via the client or even in-process file watching),
which would allow us to do things like detect new files and provide
accurate build settings for them.

* Improve #file and #line for LSP test errors

Also regenerate Linux main

* Add `LSPAnyCodable` protocol requirement to RegistrationOptions

* Don't encode an optional documentSelector to null

* Skip running `testSourcekitdCrashRecovery` when not on macOS
2021-03-17 15:11:26 -04:00
Alex Hoppen
7e9e447d1e Merge pull request #367 from ahoppen/sourcekitd-crash-recovery
Fix a nondeterministic sourcektid crash recovery test failure
2021-02-04 18:37:11 +01:00
Alex Hoppen
08485b4de7 Fix a nondeterministic sourcektid crash recovery test failure
In some cases (especially if the system is under heavy load), we crash
sourcekitd before having handled the documentupdate we received from
either the open request. If we then perform the 0,0 replacetext
synchronously in handleDocumentUpdate to receive the semantic
diagnostics, sourcekitd blocks until it has restored semantic
functionality and thus the LSP server's queue is blocked for that entire
duration.

To avoid the data race, make sure the document is fully opened before
crashing sourcekitd.
2021-02-02 21:44:00 +01:00
Alex Hoppen
e5dedd5b7e Re-enable clang crash recovery tests
We now explicitly crash clangd using a SIGKILL instead of relying on it
crashing when we add a crash pragma to the source code.
2021-02-02 21:10:10 +01:00
Ben Langmuir
fa878ddb7b [test] Disable clangd crash recovery tests that are failing on rebranch
Clangd is failing to crash and restart.

rdar://73717447
2021-01-28 11:54:55 -08:00
Ben Langmuir
d9b2d65d03 Merge pull request #353 from ahoppen/crash-recovery-again
Restart sourcekitd and clangd after they have crashed
2021-01-19 09:28:29 -08:00
Alex Hoppen
a0c9b30a2a Restart sourcekitd and clangd after they have crashed 2021-01-18 13:30:35 +01:00
Andrew Trick
26c1451887 [CanonicalOSSA] sourcekit-lsp tests; fix weak reference lifetimes
Some SourceKit properties are weak references. Several test cases
assign weak references assuming they will outlive subsequent checks
without any subsequent use keeping the reference alive.

The SIL optimizer shortens object lifetimes, breaking the test at
-O. This may even happen at -Onone in the future. The optimizer has
always done this sort of optimization, but enabling OSSA makes it much
more likely to happen in practice.

Fixes rdar://73044531 ([CanonicalOSSA] sourcekit-lsp tests; fix weak
reference lifetimes)
2021-01-12 09:43:01 -08:00
Ben Langmuir
1653a8f120 [test] Fix notification handler test when run in serial
The test was passing with --parallel since each test was being run in
its own process, but not when run in serial since other documents could
trigger unexpected notifications. Also make the uniqueness of the path
reliable using a mutable workspace.
2020-06-08 11:01:00 -07:00
Ben Langmuir
0670fb5fc4 [test] Regenerate linuxmain 2020-06-03 14:51:04 -07:00
Ben Langmuir
68691e5dc9 [sourcekitd] Add a test for multiple notification handlers 2020-06-03 14:51:04 -07:00
Ben Langmuir
f6d7701048 [sourcekitd] Add a registry for sourcekitd instances
Protect ourselves from ever having multiple sourcekitd instances for the
same path live at once, which is not safe.
2020-06-03 14:51:04 -07:00