1import("//llvm/lib/DebugInfo/PDB/enable_dia.gni") 2import("//llvm/triples.gni") 3import("//llvm/utils/gn/build/libs/xml/enable.gni") 4import("//llvm/utils/gn/build/libs/zlib/enable.gni") 5import("//llvm/utils/gn/build/write_cmake_config.gni") 6import("lld_lit_site_cfg_files.gni") 7 8# The bits common to writing lit.site.cfg.py.in and Unit/lit.site.cfg.py.in. 9template("write_lit_cfg") { 10 write_cmake_config(target_name) { 11 input = invoker.input 12 output = invoker.output 13 values = [ 14 "LIT_SITE_CFG_IN_HEADER=## Autogenerated from $input, do not edit", 15 "LLD_BINARY_DIR=" + 16 rebase_path(get_label_info("//lld", "target_out_dir")), 17 "LLD_SOURCE_DIR=" + rebase_path("//lld"), 18 "LLVM_BINARY_DIR=" + 19 rebase_path(get_label_info("//llvm", "target_out_dir")), 20 "LLVM_LIBRARY_OUTPUT_INTDIR=", # FIXME: for shared builds only (?) 21 "LLVM_LIBS_DIR=", # needed only for shared builds 22 "LLVM_LIT_TOOLS_DIR=", # Intentionally empty, matches cmake build. 23 "LLVM_RUNTIME_OUTPUT_INTDIR=" + rebase_path("$root_out_dir/bin"), 24 "LLVM_SOURCE_DIR=" + rebase_path("//llvm"), 25 "LLVM_TOOLS_DIR=" + rebase_path("$root_out_dir/bin"), 26 "PYTHON_EXECUTABLE=$python_path", 27 "TARGET_TRIPLE=$llvm_target_triple", 28 ] 29 values += invoker.extra_values 30 } 31} 32 33write_lit_cfg("lit_site_cfg") { 34 # Fully-qualified instead of relative for LIT_SITE_CFG_IN_HEADER. 35 input = "//lld/test/lit.site.cfg.py.in" 36 output = lld_lit_site_cfg_file 37 38 extra_values = [] 39 if (llvm_enable_dia_sdk) { 40 extra_values += [ "LLVM_ENABLE_DIA_SDK=1" ] 41 } else { 42 extra_values += [ "LLVM_ENABLE_DIA_SDK=0" ] # Must be 0. 43 } 44 45 if (llvm_enable_libxml2) { 46 extra_values += [ "LLVM_LIBXML2_ENABLED=1" ] 47 } else { 48 extra_values += [ "LLVM_LIBXML2_ENABLED=0" ] # Must be 0. 49 } 50 51 if (llvm_enable_zlib) { 52 extra_values += [ "HAVE_LIBZ=1" ] 53 } else { 54 extra_values += [ "HAVE_LIBZ=0" ] # Must be 0. 55 } 56 57 if (current_cpu == "x64" || current_cpu == "arm64" || 58 current_cpu == "ppc64") { 59 extra_values += [ "CMAKE_SIZEOF_VOID_P=8" ] 60 } else { 61 extra_values += [ "CMAKE_SIZEOF_VOID_P=4" ] 62 } 63} 64 65write_lit_cfg("lit_unit_site_cfg") { 66 # Fully-qualified instead of relative for LIT_SITE_CFG_IN_HEADER. 67 input = "//lld/test/Unit/lit.site.cfg.py.in" 68 output = lld_lit_unit_site_cfg_file 69 extra_values = [ "LLVM_BUILD_MODE=." ] 70} 71 72# This target should contain all dependencies of check-lld. 73# //:default depends on it, so that ninja's default target builds all 74# prerequisites for check-lld but doesn't run check-lld itself. 75group("test") { 76 deps = [ 77 ":lit_site_cfg", 78 ":lit_unit_site_cfg", 79 "//lld/tools/lld:symlinks", 80 "//lld/unittests", 81 "//llvm/tools/llc", 82 "//llvm/tools/llvm-ar:symlinks", 83 "//llvm/tools/llvm-as", 84 "//llvm/tools/llvm-bcanalyzer", 85 "//llvm/tools/llvm-cvtres", 86 "//llvm/tools/llvm-dis", 87 "//llvm/tools/llvm-dwarfdump", 88 "//llvm/tools/llvm-mc", 89 "//llvm/tools/llvm-nm:symlinks", 90 "//llvm/tools/llvm-objcopy:symlinks", 91 "//llvm/tools/llvm-objdump:symlinks", 92 "//llvm/tools/llvm-pdbutil", 93 "//llvm/tools/llvm-readobj:symlinks", 94 "//llvm/tools/obj2yaml", 95 "//llvm/tools/opt", 96 "//llvm/tools/yaml2obj", 97 "//llvm/utils/FileCheck", 98 "//llvm/utils/count", 99 "//llvm/utils/llvm-lit", 100 "//llvm/utils/not", 101 ] 102 testonly = true 103} 104 105# This is the action that runs all of lld's tests, check-lld. 106action("check-lld") { 107 script = "$root_out_dir/bin/llvm-lit" 108 if (host_os == "win") { 109 script += ".py" 110 } 111 args = [ 112 "-sv", 113 "--param", 114 "lld_site_config=" + rebase_path(lld_lit_site_cfg_file, root_out_dir), 115 "--param", 116 "lld_unit_site_config=" + 117 rebase_path(lld_lit_unit_site_cfg_file, root_out_dir), 118 rebase_path(".", root_out_dir), 119 ] 120 outputs = [ 121 "$target_gen_dir/run-lit", # Non-existing, so that ninja runs it each time. 122 ] 123 124 # Since check-lld is always dirty, //:default doesn't depend on it so that 125 # it's not part of the default ninja target. Hence, check-lld shouldn't 126 # have any deps except :test, so that the default target is sure to build 127 # all the deps. 128 deps = [ 129 ":test", 130 ] 131 testonly = true 132 133 pool = "//:console" 134} 135