[clang-tools-extra] 101a69d - [clangd] Reland target_info_test
Kadir Cetinkaya via cfe-commits
cfe-commits at lists.llvm.org
Sun Apr 12 07:10:22 PDT 2020
Author: Kadir Cetinkaya
Date: 2020-04-12T16:10:04+02:00
New Revision: 101a69d71b93f901561621508ed36b187e594d91
URL: https://github.com/llvm/llvm-project/commit/101a69d71b93f901561621508ed36b187e594d91
DIFF: https://github.com/llvm/llvm-project/commit/101a69d71b93f901561621508ed36b187e594d91.diff
LOG: [clangd] Reland target_info_test
Added:
clang-tools-extra/clangd/test/target_info.test
Modified:
Removed:
################################################################################
diff --git a/clang-tools-extra/clangd/test/target_info.test b/clang-tools-extra/clangd/test/target_info.test
new file mode 100644
index 000000000000..6017dbd321fa
--- /dev/null
+++ b/clang-tools-extra/clangd/test/target_info.test
@@ -0,0 +1,35 @@
+# REQUIRES: arm-registered-target
+# Mock 'compile_commands.json' to contain a driver name targeting armv7.
+# 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/armv7-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 -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: armv7
+---
+{"jsonrpc":"2.0","id":10000,"method":"shutdown"}
+---
+{"jsonrpc":"2.0","method":"exit"}
More information about the cfe-commits
mailing list