Debian Codegraph @

llvm-project/clang-tools-extra/clangd/test/target_info.test

raw
1 # REQUIRES: arm-registered-target
2 # Mock 'compile_commands.json' to contain a driver name targeting armv7.
3 # Afterwards check that correct target is passed into clang.
4
5 # RUN: rm -rf %t.dir && mkdir -p %t.dir
6
7 # RUN: echo '[{"directory": "%/t.dir", "command": "%/t.dir/armv7-clang -x c++ the-file.cpp -v", "file": "the-file.cpp"}]' > %t.dir/compile_commands.json
8
9 # RUN: sed -e "s|INPUT_DIR|%/t.dir|g" %s > %t.test.1
10 # On Windows, we need the URI in didOpen to look like "uri":"file:///C:/..."
11 # (with the extra slash in the front), so we add it here.
12 # RUN: sed -E -e 's|"file://([A-Z]):/|"file:///\1:/|g' %t.test.1 > %t.test
13
14 # RUN: clangd -lit-test < %t.test 2>&1 | FileCheck -strict-whitespace %t.test
15 {"jsonrpc":"2.0","id":0,"method":"initialize","params":{}}
16 ---
17 {
18 "jsonrpc":"2.0",
19 "method":"textDocument/didOpen",
20 "params": {
21 "textDocument": {
22 "uri": "file://INPUT_DIR/the-file.cpp",
23 "languageId":"cpp",
24 "version":1,
25 "text":""
26 }
27 }
28 }
29 # Make sure we have target passed into cc1 driver, which is printed due to -v in
30 # the compile_commands.json
31 # CHECK: Target: armv7
32 ---
33 {"jsonrpc":"2.0","id":10000,"method":"shutdown"}
34 ---
35 {"jsonrpc":"2.0","method":"exit"}