summaryrefslogtreecommitdiff
path: root/clangd/test/target_info.test
blob: 1e0cb99e59f53b9e492108347907ccb754db7c00 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# REQUIRES: x86-registered-target
# Mock 'compile_commands.json' to contain a driver name targeting fuchsia OS.
# Afterwards check that correct target is passed into clang.

# RUN: rm -rf %t.dir && mkdir -p %t.dir

# RUN: echo '[{"directory": "%/t.dir", "command": "%/t.dir/x86_64-fuchsia-clang -x c++ the-file.cpp -v", "file": "the-file.cpp"}]' > %t.dir/compile_commands.json

# RUN: sed -e "s|INPUT_DIR|%/t.dir|g" %s > %t.test.1
# On Windows, we need the URI in didOpen to look like "uri":"file:///C:/..."
# (with the extra slash in the front), so we add it here.
# RUN: sed -e "s|file://\([A-Z]\):/|file:///\1:/|g" %t.test.1 > %t.test

# RUN: clangd -lit-test < %t.test 2>&1 | FileCheck -strict-whitespace %t.test
{"jsonrpc":"2.0","id":0,"method":"initialize","params":{}}
---
{
  "jsonrpc":"2.0",
  "method":"textDocument/didOpen",
  "params": {
    "textDocument": {
      "uri": "file://INPUT_DIR/the-file.cpp",
      "languageId":"cpp",
      "version":1,
      "text":""
    }
  }
}
# Make sure we have target passed into cc1 driver, which is printed due to -v in
# the compile_commands.json
# CHECK: Target: x86_64-unknown-fuchsia
---
{"jsonrpc":"2.0","id":10000,"method":"shutdown"}
---
{"jsonrpc":"2.0","method":"exit"}