This is meant to cause a visible fail when clangd gets invalid JSON payload in -lit-test mode.
Based on discussion in https://reviews.llvm.org/D50641 (and http://lists.llvm.org/pipermail/clangd-dev/2018-August/000072.html).
Differential D50785
[clangd][tests] Add exit(EXIT_FAILURE) in case of JSON parsing failure in TestMode jkorous on Aug 15 2018, 9:16 AM. Authored by
Details
This is meant to cause a visible fail when clangd gets invalid JSON payload in -lit-test mode. Based on discussion in https://reviews.llvm.org/D50641 (and http://lists.llvm.org/pipermail/clangd-dev/2018-August/000072.html).
Diff Detail
Event TimelineComment Actions I think propagating the 'test' yes/no value is not the best way to describe the intention of this change. Comment Actions +1 to having a separate option for that. More generally, wouldn't we want to exit on more kinds errors in the future? How about a more generic option that would force clangd to have non-zero error code whenever even a single error was emitted via elog()?
Could be fixed by specifying a valid rootPath in all clangd tests.
IIUC, this happens on empty preambles, the fix is to not emit an error in that case. In general, whenever preamble is not built, this is probably due to changes in some headers and that case should be considered valid input for clangd, so arguably this shouldn't be an error in the first place.-
That doesn't look like a long list, so it shouldn't be too hard. What are your thoughts on a more generic option like that?
Comment Actions Oh, I thought that what everyone wanted was test-specific behaviour. I like both approaches you propose much more! Just to be sure we are all on the same page:
Based on quick grepping if we'd like to propagate errors probably the biggest challenge would be ASTWorker. |
Alternative would be to run input parsing to completion, propagate if any error was encountered to main and exit with a predefined error code in that case.
Exiting prematurely might hide some important errors that we would otherwise catch even before seeing an error code from clangd, e.g. infinite loops in the input handling on invalid inputs, etc.