diff options
Diffstat (limited to 'llvm/utils/gn/secondary/lld/test/BUILD.gn')
-rw-r--r-- | llvm/utils/gn/secondary/lld/test/BUILD.gn | 137 |
1 files changed, 137 insertions, 0 deletions
diff --git a/llvm/utils/gn/secondary/lld/test/BUILD.gn b/llvm/utils/gn/secondary/lld/test/BUILD.gn new file mode 100644 index 00000000000..7178ce86278 --- /dev/null +++ b/llvm/utils/gn/secondary/lld/test/BUILD.gn @@ -0,0 +1,137 @@ +import("//llvm/lib/DebugInfo/PDB/enable_dia.gni") +import("//llvm/triples.gni") +import("//llvm/utils/gn/build/libs/xml/enable.gni") +import("//llvm/utils/gn/build/libs/zlib/enable.gni") +import("lld_lit_site_cfg_files.gni") + +# The bits common to writing lit.site.cfg.py.in and Unit/lit.site.cfg.py.in. +template("write_lit_cfg") { + action(target_name) { + script = "//llvm/utils/gn/build/write_cmake_config.py" + + sources = [ + invoker.input, + ] + outputs = [ + invoker.output, + ] + + args = [ + "-o", + rebase_path(outputs[0], root_out_dir), + rebase_path(sources[0], root_out_dir), + + "LIT_SITE_CFG_IN_HEADER=## Autogenerated from ${sources[0]}, do not edit", + "LLD_BINARY_DIR=" + + rebase_path(get_label_info("//lld", "target_out_dir")), + "LLD_SOURCE_DIR=" + rebase_path("//lld"), + "LLVM_BINARY_DIR=" + + rebase_path(get_label_info("//llvm", "target_out_dir")), + "LLVM_LIBRARY_OUTPUT_INTDIR=", # FIXME: for shared builds only (?) + "LLVM_LIBS_DIR=", # needed only for shared builds + "LLVM_LIT_TOOLS_DIR=", # Intentionally empty, matches cmake build. + "LLVM_RUNTIME_OUTPUT_INTDIR=" + rebase_path("$root_out_dir/bin"), + "LLVM_SOURCE_DIR=" + rebase_path("//llvm"), + "LLVM_TOOLS_DIR=" + rebase_path("$root_out_dir/bin"), + "PYTHON_EXECUTABLE=$python_path", + "TARGET_TRIPLE=$llvm_target_triple", + ] + args += invoker.extra_args + } +} + +write_lit_cfg("lit_site_cfg") { + # Fully-qualified instead of relative for LIT_SITE_CFG_IN_HEADER. + input = "//lld/test/lit.site.cfg.py.in" + output = lld_lit_site_cfg_file + + extra_args = [] + if (llvm_enable_dia_sdk) { + extra_args += [ "LLVM_ENABLE_DIA_SDK=1" ] + } else { + extra_args += [ "LLVM_ENABLE_DIA_SDK=0" ] # Must be 0. + } + + if (llvm_enable_libxml2) { + extra_args += [ "LLVM_LIBXML2_ENABLED=1" ] + } else { + extra_args += [ "LLVM_LIBXML2_ENABLED=" ] # Must be empty. + } + + if (llvm_enable_zlib) { + extra_args += [ "HAVE_LIBZ=1" ] + } else { + extra_args += [ "HAVE_LIBZ=0" ] # Must be 0. + } +} + +write_lit_cfg("lit_unit_site_cfg") { + # Fully-qualified instead of relative for LIT_SITE_CFG_IN_HEADER. + input = "//lld/test/Unit/lit.site.cfg.py.in" + output = lld_lit_unit_site_cfg_file + extra_args = [ "LLVM_BUILD_MODE=." ] +} + +# This target should contain all dependencies of check-lld. +# //:default depends on it, so that ninja's default target builds all +# prerequisites for check-lld but doesn't run check-lld itself. +group("test") { + deps = [ + ":lit_site_cfg", + ":lit_unit_site_cfg", + "//lld/tools/lld:symlinks", + "//llvm/tools/llc", + "//llvm/tools/llvm-ar:symlinks", + "//llvm/tools/llvm-as", + "//llvm/tools/llvm-bcanalyzer", + "//llvm/tools/llvm-dis", + "//llvm/tools/llvm-dwarfdump", + "//llvm/tools/llvm-mc", + "//llvm/tools/llvm-nm:symlinks", + "//llvm/tools/llvm-objcopy:symlinks", + "//llvm/tools/llvm-objdump:symlinks", + "//llvm/tools/llvm-pdbutil", + "//llvm/tools/llvm-readobj:symlinks", + "//llvm/tools/obj2yaml", + "//llvm/tools/opt", + "//llvm/tools/yaml2obj", + "//llvm/utils/FileCheck", + "//llvm/utils/count", + "//llvm/utils/llvm-lit", + "//llvm/utils/not", + ] + testonly = true + + # FIXME: Add dep on "//lld/unittests" target once it exists. +} + +# This is the action that runs all of lld's tests, check-lld. +action("check-lld") { + script = "$root_out_dir/bin/llvm-lit" + if (host_os == "win") { + script += ".py" + } + args = [ + "-sv", + "--param", + "lld_site_config=" + rebase_path(lld_lit_site_cfg_file, root_out_dir), + "--param", + "lld_unit_site_config=" + + rebase_path(lld_lit_unit_site_cfg_file, root_out_dir), + rebase_path(".", root_out_dir), + ] + outputs = [ + "$target_gen_dir/run-lit", # Non-existing, so that ninja runs it each time. + ] + + # Since check-lld is always dirty, //:default doesn't depend on it so that + # it's not part of the default ninja target. Hence, check-lld shouldn't + # have any deps except :test, so that the default target is sure to build + # all the deps. + deps = [ + ":test", + ] + testonly = true + + pool = "//:console" +} |