Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[clangd] Add integration test for crash handling
This replaces the test removed in 51be706 It is more principled and tests more critical cases: a crash while parsing. We need two pieces of plumbing: - a way to re-enable the crashing #pragmas via a flag, to test parse crashes - a bit of reshuffling around ASTWorker execution so that we set up the crash handler in both sync/async modes. Sync mode is useful for debugging, so I tested both. Differential Revision: https://reviews.llvm.org/D112565
- Loading branch information
1 parent
c472378
commit 9cc08cb
Showing
6 changed files
with
78 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# RUN: not --crash clangd -lit-test < %s 2> %t.err | ||
# RUN: FileCheck %s < %t.err --check-prefixes=CHECK,CHECK-SYNC | ||
# RUN: not --crash clangd -lit-test -sync=0 < %s 2> %t.async.err | ||
# RUN: FileCheck %s < %t.async.err | ||
{"jsonrpc":"2.0","id":0,"method":"initialize","params":{}} | ||
--- | ||
{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{ | ||
"uri":"test:///foo.cc", | ||
"languageId":"cpp", | ||
"text":"int x;\n#pragma clang __debug llvm_fatal_error" | ||
}}} | ||
--- | ||
{"jsonrpc":"2.0","id":1,"method":"sync","params":{}} | ||
# CHECK: Signalled during AST worker action: Build AST | ||
# CHECK-NEXT: Filename: foo.cc | ||
# CHECK-SYNC: Signalled during AST worker action: Update | ||
# CHECK-SYNC: Filename: foo.cc | ||
# CHECK-SYNC: Signalled while processing message: | ||
# CHECK-SYNC: "languageId":"cpp" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# RUN: not --crash clangd -lit-test < %s 2> %t.err | ||
# RUN: FileCheck %s < %t.err --check-prefixes=CHECK,CHECK-SYNC | ||
# RUN: not --crash clangd -lit-test -sync=0 < %s 2> %t.async.err | ||
# RUN: FileCheck %s < %t.async.err | ||
{"jsonrpc":"2.0","id":0,"method":"initialize","params":{}} | ||
--- | ||
{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{ | ||
"uri":"test:///foo.cc", | ||
"languageId":"cpp", | ||
"text":"#pragma clang __debug llvm_fatal_error" | ||
}}} | ||
--- | ||
{"jsonrpc":"2.0","id":1,"method":"sync","params":{}} | ||
# CHECK: Signalled while building preamble | ||
# CHECK-NEXT: Filename: foo.cc | ||
# CHECK-SYNC: Signalled during AST worker action: Update | ||
# CHECK-SYNC: Filename: foo.cc | ||
# CHECK-SYNC: Signalled while processing message: | ||
# CHECK-SYNC: "languageId":"cpp" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters