[PATCH] D75985: clangd doc: Show a test case for clangd with some commands
Sam McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 11 11:19:07 PDT 2020
sammccall added a comment.
Thanks for the context!
In D75985#1917163 <https://reviews.llvm.org/D75985#1917163>, @sylvestre.ledru wrote:
> With my Debian/Ubuntu hat, i have been interested to write some dumb integration tests to be sure that clangd, as a package, works as expected.
> I just need to make sure that the binary starts, that I can send some data and I am getting some outputs which makes sense.
> https://salsa.debian.org/pkg-llvm-team/llvm-toolchain/-/blob/10/debian/qualify-clang.sh#L106-266 (I know it is ugly :)
That test looks pretty good to me! If you want to smoke-test the install a little more, one of the ways clangd can be setup wrong is unable to find the c++ standard library or the clang builtin headers. If you example has `#include <map>` or so and you scan for `"diagnostics": []` in the output, you'll detect that.
This perspective seems fairly niche though, I'm not sure we need to cover it prominently in the docs.
> With my Mozilla hat, I was interested to see how clangd works and we could call it from tooling. I think this doc helps understanding how it works quickly. Without spending too much time reading LSP or reading at the code of extensions.
Yeah, I think we should cover this one somehow. LSP spec isn't terribly readable if you want to get a flavour.
I think we could use a page on the new site "embedding" or "programmatic use" of clangd or something (not sure of the best title). It'd cover this (use features via LSP on stdio), using the C++ API, and the tradeoffs between the two. Is it OK if I take a stab at this and incorporates parts from here?
(Happy to discuss tooling use cases BTW - we've not got much experience for using outside a fairly standard language client/server setup)
> About the -lit-test thing, it is because I am a noob :) I would be interested to know if there is a better way!
`-lit-test` is the right thing to use for the type of testing you're doing, but not anything else (including explaining clangd).
clangd -help-hidden | grep lit-test
--lit-test - Abbreviation for -input-style=delimited -pretty -sync -enable-test-scheme -log=verbose. Intended to simplify lit tests
For explanations `-input-style=delimited -pretty` is probably useful (and we should probably explain the former).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D75985/new/
https://reviews.llvm.org/D75985
More information about the cfe-commits
mailing list