[MIParser] Set RegClassOrRegBank during instruction parsing
[llvm-complete.git] / utils / gn / secondary / clang-tools-extra / clangd / test / BUILD.gn
blob9cb43c8e2d1342a9532220ca793afc8c49594536
1 import("//clang-tools-extra/clangd/xpc/enable.gni")
2 import("//llvm/triples.gni")
3 import("//llvm/utils/gn/build/write_cmake_config.gni")
4 import("clangd_lit_site_cfg_files.gni")
6 template("write_lit_config") {
7   write_cmake_config(target_name) {
8     input = invoker.input
9     output = invoker.output
10     values = [
11       "LIT_SITE_CFG_IN_HEADER=## Autogenerated from $input, do not edit",
12       "LLVM_LIBS_DIR=",  # needed only for shared builds
13     ]
14     values += invoker.extra_values
15   }
18 write_lit_config("lit_site_cfg") {
19   # Fully-qualified instead of relative for LIT_SITE_CFG_IN_HEADER.
20   input = "//clang-tools-extra/clangd/test/lit.site.cfg.py.in"
21   output = clangd_lit_site_cfg_file
23   extra_values = [
24     "CMAKE_CURRENT_BINARY_DIR=" + rebase_path(
25             get_label_info("//clang-tools-extra/clangd/test", "target_out_dir")),
26     "CMAKE_CURRENT_SOURCE_DIR=" +
27         rebase_path("//clang-tools-extra/clangd/test"),
29     "CLANG_LIBS_DIR=",  # needed only for shared builds
30     "CLANG_TOOLS_DIR=",
31     "LLVM_HOST_TRIPLE=$llvm_current_triple",
32     "LLVM_LIT_TOOLS_DIR=",  # Intentionally empty, matches cmake build.
33     "LLVM_TOOLS_DIR=" + rebase_path("$root_out_dir/bin"),
34     "TARGET_TRIPLE=$llvm_target_triple",
35   ]
37   if (clangd_build_xpc) {
38     extra_values += [ "CLANGD_BUILD_XPC=1" ]
39   } else {
40     extra_values += [ "CLANGD_BUILD_XPC=0" ]
41   }
44 write_lit_config("lit_unit_site_cfg") {
45   # Fully-qualified instead of relative for LIT_SITE_CFG_IN_HEADER.
46   input = "//clang-tools-extra/clangd/unittests/lit.site.cfg.py.in"
47   output = clangd_lit_unit_site_cfg_file
48   extra_values = [
49     "CMAKE_CURRENT_BINARY_DIR=" +
50         rebase_path(get_label_info("//clang-tools-extra/clangd/unittests",
51                                    "target_out_dir")),
52     "CMAKE_CURRENT_SOURCE_DIR=" +
53         rebase_path("//clang-tools-extra/clangd/unittests"),
54   ]
55   if (host_os == "win") {
56     # See comment for Windows solink in llvm/utils/gn/build/toolchain/BUILD.gn
57     extra_values += [ "SHLIBDIR=" + rebase_path("$root_out_dir/bin") ]
58   } else {
59     extra_values += [ "SHLIBDIR=" + rebase_path("$root_out_dir/lib") ]
60   }
63 # This target should contain all dependencies of check-clangd.
64 # //:default depends on it, so that ninja's default target builds all
65 # prerequisites for check-clang but doesn't run check-clang itself.
66 group("test") {
67   deps = [
68     ":lit_site_cfg",
69     ":lit_unit_site_cfg",
70     "//clang-tools-extra/clangd/index/dex/dexp",
71     "//clang-tools-extra/clangd/indexer:clangd-indexer",
72     "//clang-tools-extra/clangd/tool:clangd",
73     "//clang-tools-extra/clangd/unittests:ClangdTests",
74     "//llvm/utils/FileCheck",
75     "//llvm/utils/llvm-lit",
76     "//llvm/utils/not",
77   ]
78   if (clangd_build_xpc) {
79     deps += [
80       "//clang-tools-extra/clangd/unittests/xpc:ClangdXpcTests",
81       "//clang-tools-extra/clangd/xpc/test-client:clangd-xpc-test-client",
82     ]
83   }
84   testonly = true
87 action("check-clangd") {
88   script = "$root_out_dir/bin/llvm-lit"
89   if (host_os == "win") {
90     script += ".py"
91   }
92   args = [
93     "-sv",
94     rebase_path(get_path_info(clangd_lit_site_cfg_file, "dir"), root_out_dir),
95     rebase_path(get_path_info(clangd_lit_unit_site_cfg_file, "dir"),
96                 root_out_dir),
97   ]
98   outputs = [
99     "$target_gen_dir/run-lit",  # Non-existing, so that ninja runs it each time.
100   ]
102   # Since check-clangd is always dirty, //:default doesn't depend on it so
103   # that it's not part of the default ninja target.  Hence, check-clangd
104   # shouldn't have any deps except :test. so that the default target is sure to
105   # build all the deps.
106   deps = [
107     ":test",
108   ]
109   testonly = true
111   pool = "//:console"