[AMDGPU] Test codegen'ing True16 additions.
[llvm-project.git] / llvm / utils / gn / secondary / lld / test / BUILD.gn
blob356d93bf052a6fcbf21d1435ba400d61d17dbd68
1 import("//llvm/lib/DebugInfo/PDB/enable_dia.gni")
2 import("//llvm/triples.gni")
3 import("//llvm/utils/gn/build/libs/xml/enable.gni")
4 import("//llvm/utils/gn/build/libs/zlib/enable.gni")
5 import("//llvm/utils/gn/build/write_cmake_config.gni")
6 import("//llvm/utils/llvm-lit/lit_path_function.gni")
7 import("lld_lit_site_cfg_files.gni")
9 # The bits common to writing lit.site.cfg.py.in and Unit/lit.site.cfg.py.in.
10 template("write_lit_cfg") {
11   write_cmake_config(target_name) {
12     input = invoker.input
13     output = invoker.output
14     dir = get_path_info(output, "dir")
15     values = [
16       "LIT_SITE_CFG_IN_HEADER=" +
17           "## Autogenerated from $input, do not edit\n\n" + lit_path_function,
18       "LLD_BINARY_DIR=" +
19           rebase_path(get_label_info("//lld", "target_out_dir"), dir),
20       "LLD_SOURCE_DIR=" + rebase_path("//lld", dir),
21     ]
22     if (host_os == "win") {
23       # See comment for Windows solink in llvm/utils/gn/build/toolchain/BUILD.gn
24       values += [ "SHLIBDIR=" + rebase_path("$root_out_dir/bin", dir) ]
25     } else {
26       values += [ "SHLIBDIR=" + rebase_path("$root_out_dir/lib", dir) ]
27     }
28     values += invoker.extra_values
29   }
32 write_lit_cfg("lit_site_cfg") {
33   # Fully-qualified instead of relative for LIT_SITE_CFG_IN_HEADER.
34   input = "//lld/test/lit.site.cfg.py.in"
35   output = lld_lit_site_cfg_file
36   dir = get_path_info(output, "dir")
38   extra_values = [
39     "CURRENT_LIBS_DIR=",  # FIXME: for shared builds only (?)
40     "CURRENT_TOOLS_DIR=" + rebase_path("$root_out_dir/bin", dir),
41     "ENABLE_BACKTRACES=1",
42     "LLVM_BINARY_DIR=" +
43         rebase_path(get_label_info("//llvm", "target_out_dir"), dir),
44     "LLVM_HOST_TRIPLE=$llvm_current_triple",
45     "LLVM_LIBS_DIR=",  # needed only for shared builds
46     "LLVM_LIT_TOOLS_DIR=",  # Intentionally empty, matches cmake build.
47     "LLVM_SOURCE_DIR=" + rebase_path("//llvm", dir),
48     "LLVM_TOOLS_DIR=" + rebase_path("$root_out_dir/bin", dir),
49     "Python3_EXECUTABLE=$python_path",
50     "LLVM_TARGET_TRIPLE=$llvm_target_triple",
52     "LLD_DEFAULT_LD_LLD_IS_MINGW=0",
53     "LLVM_BUILD_EXAMPLES=0",
54     "LLVM_ENABLE_ZSTD=0",
55     "LLVM_BYE_LINK_INTO_TOOLS=0",
56   ]
58   if (host_os == "win") {
59     extra_values += [
60       "LLVM_LIT_ERRC_MESSAGES=no such file or directory;is a directory;" +
61           "invalid argument;permission denied",
62       "LLVM_ENABLE_PLUGINS=0",
63     ]
64   } else {
65     extra_values += [
66       "LLVM_LIT_ERRC_MESSAGES=",
67       "LLVM_ENABLE_PLUGINS=1",
68     ]
69   }
71   if (host_os == "mac") {
72     extra_values += [ "SHLIBEXT=.dylib" ]
73   } else if (host_os == "win") {
74     extra_values += [ "SHLIBEXT=.dll" ]
75   } else {
76     extra_values += [ "SHLIBEXT=.so" ]
77   }
79   if (llvm_enable_dia_sdk) {
80     extra_values += [ "LLVM_ENABLE_DIA_SDK=1" ]
81   } else {
82     extra_values += [ "LLVM_ENABLE_DIA_SDK=0" ]  # Must be 0.
83   }
85   if (llvm_enable_libxml2) {
86     extra_values += [ "LLVM_ENABLE_LIBXML2=1" ]
87   } else {
88     extra_values += [ "LLVM_ENABLE_LIBXML2=0" ]  # Must be 0.
89   }
91   if (llvm_enable_zlib) {
92     extra_values += [ "LLVM_ENABLE_ZLIB=1" ]
93   } else {
94     extra_values += [ "LLVM_ENABLE_ZLIB=0" ]  # Must be 0.
95   }
97   if (current_cpu == "x64" || current_cpu == "arm64" ||
98       current_cpu == "ppc64") {
99     extra_values += [ "CMAKE_SIZEOF_VOID_P=8" ]
100   } else {
101     extra_values += [ "CMAKE_SIZEOF_VOID_P=4" ]
102   }
105 write_lit_cfg("lit_unit_site_cfg") {
106   # Fully-qualified instead of relative for LIT_SITE_CFG_IN_HEADER.
107   input = "//lld/test/Unit/lit.site.cfg.py.in"
108   output = lld_lit_unit_site_cfg_file
109   extra_values = [ "LLVM_BUILD_MODE=." ]
112 # This target should contain all dependencies of check-lld.
113 # //:default depends on it, so that ninja's default target builds all
114 # prerequisites for check-lld but doesn't run check-lld itself.
115 group("test") {
116   deps = [
117     ":lit_site_cfg",
118     ":lit_unit_site_cfg",
119     "//lld/tools/lld:symlinks",
120     "//lld/unittests",
121     "//llvm/tools/dsymutil",
122     "//llvm/tools/llc",
123     "//llvm/tools/llvm-ar:symlinks",
124     "//llvm/tools/llvm-as",
125     "//llvm/tools/llvm-bcanalyzer",
126     "//llvm/tools/llvm-cvtres",
127     "//llvm/tools/llvm-dis",
128     "//llvm/tools/llvm-dwarfdump",
129     "//llvm/tools/llvm-lipo:symlinks",
130     "//llvm/tools/llvm-mc",
131     "//llvm/tools/llvm-nm:symlinks",
132     "//llvm/tools/llvm-objcopy:symlinks",
133     "//llvm/tools/llvm-objdump:symlinks",
134     "//llvm/tools/llvm-pdbutil",
135     "//llvm/tools/llvm-profdata",
136     "//llvm/tools/llvm-readobj:symlinks",
137     "//llvm/tools/llvm-symbolizer:symlinks",
138     "//llvm/tools/obj2yaml",
139     "//llvm/tools/opt",
140     "//llvm/tools/yaml2obj",
141     "//llvm/utils/FileCheck",
142     "//llvm/utils/count",
143     "//llvm/utils/llvm-lit",
144     "//llvm/utils/not",
145     "//llvm/utils/split-file",
146   ]
147   testonly = true
150 # This is the action that runs all of lld's tests, check-lld.
151 action("check-lld") {
152   script = "$root_out_dir/bin/llvm-lit"
153   if (host_os == "win") {
154     script += ".py"
155   }
156   args = [
157     "-sv",
158     rebase_path(".", root_out_dir),
159   ]
160   outputs = [ "$target_gen_dir/run-lit" ]  # Non-existing, so that ninja runs it
161                                            # each time.
163   # Since check-lld is always dirty, //:default doesn't depend on it so that
164   # it's not part of the default ninja target.  Hence, check-lld shouldn't
165   # have any deps except :test, so that the default target is sure to build
166   # all the deps.
167   deps = [ ":test" ]
168   testonly = true
170   pool = "//:console"