Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite test-sourcekit-lsp.py to not rely on --sync option in sourcekit-lsp #133

Merged
merged 2 commits into from
Mar 23, 2024

Conversation

ahoppen
Copy link
Member

@ahoppen ahoppen commented Mar 21, 2024

The test-sourcekit-lsp integration test sent all requests to sourcekit-lsp via stdin in one go and relies on the --sync option in sourcekit-lsp to handle one request at a time. It closes stdin when it reaches the end of the data it wants to send to sourcekit-lsp. With the refactored JSONRPCConnection implementation, this caused us to immediately close the connection, without waiting for any outstanding replies to be sent.

Rewrite test-sourcekit-lsp.py to actually wait for the request results. This also allows us to delete the --sync option of sourcekit-lsp and test a configuration of sourcekit-lsp that is a lot closer to what actual users are going to use.

rdar://125139888

Stderr contains log output from sourcekit-lsp but we want to match the LSP communication that happens over stdin/stdout. It seems that the additional stderr output can confuse `FileCheck`.

rdar://125139888
@ahoppen ahoppen requested a review from bnbarham March 21, 2024 07:59
@ahoppen ahoppen changed the title Don’t match stderr against FileCheck lines in test-sourcekit-lsp.py Rewrite test-sourcekit-lsp.py to not rely on --sync option in sourcekit-lsp Mar 21, 2024
…ekit-lsp

The `test-sourcekit-lsp` integration test sent all requests to `sourcekit-lsp` via stdin in one go and relies on the `--sync` option in sourcekit-lsp to handle one request at a time. It closes `stdin` when it reaches the end of the data it wants to send to sourcekit-lsp. With the refactored `JSONRPCConnection` implementation, this caused us to immediately close the connection, without waiting for any outstanding replies to be sent.

Rewrite `test-sourcekit-lsp.py` to actually wait for the request results. This also allows us to delete the `--sync` option of sourcekit-lsp and test a configuration of sourcekit-lsp that is a lot closer to what actual users are going to use.
@ahoppen ahoppen force-pushed the ahoppen/no-stderr-match-lsp branch from dbd4211 to 1bbf62d Compare March 22, 2024 07:20
@ahoppen
Copy link
Member Author

ahoppen commented Mar 22, 2024

✅ Toolchain build passed on swiftlang/swift#37710

},
)
print("foo() definition response")
# CHECK-LABEL: foo() definition response
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm tempted to say it would make more sense to check these in Python itself, rather than outputting and then running CHECK. But this seems reasonable to take either way 👍

@bnbarham bnbarham merged commit ef8ee97 into swiftlang:main Mar 23, 2024
@ahoppen ahoppen deleted the ahoppen/no-stderr-match-lsp branch March 25, 2024 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants