1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217
|
import("//llvm/triples.gni")
#import("//llvm/utils/gn/build/libs/xar/enable.gni")
import("//llvm/utils/gn/build/libs/xml/enable.gni")
import("//llvm/utils/gn/build/libs/zlib/enable.gni")
import("//llvm/utils/gn/build/write_cmake_config.gni")
import("lldb_lit_site_cfg_files.gni")
# The bits common to writing lit.site.cfg.py.in, API/lit.site.cfg.py,
# Shell/lit.site.cfg.py, and Unit/lit.site.cfg.py.in.
template("write_lit_cfg") {
write_cmake_config(target_name) {
input = invoker.input
output = invoker.output
values = [
"LIT_SITE_CFG_IN_HEADER=## Autogenerated from $input, do not edit",
"LLDB_BINARY_DIR=" +
rebase_path(get_label_info("//lldb", "target_out_dir")),
"LLDB_SOURCE_DIR=" + rebase_path("//lldb"),
"LLVM_BINARY_DIR=" +
rebase_path(get_label_info("//llvm", "target_out_dir")),
"LLVM_LIBS_DIR=", # needed only for shared builds
"LLVM_LIT_TOOLS_DIR=", # Intentionally empty, matches cmake build.
"LLVM_SOURCE_DIR=" + rebase_path("//llvm"),
"LLVM_TOOLS_DIR=" + rebase_path("$root_out_dir/bin"),
"Python3_EXECUTABLE=$python_path",
"LLVM_TARGET_TRIPLE=$llvm_target_triple",
]
values += invoker.extra_values
}
}
write_cmake_config("lit-lldb-init") {
input = "//lldb/test/Shell/lit-lldb-init.in"
# XXX nicer way to get this path
output = "$root_out_dir/obj/lldb/test/Shell/lit-lldb-init"
values = [ "LLDB_TEST_MODULE_CACHE_LLDB=" +
rebase_path(
"$target_gen_dir/lldb-test-build.noindex/module-cache-lldb") ]
}
write_lit_cfg("lit_site_cfg") {
# Fully-qualified instead of relative for LIT_SITE_CFG_IN_HEADER.
input = "//lldb/test/lit.site.cfg.py.in"
output = lldb_lit_site_cfg_file
extra_values = [ "LLVM_BUILD_MODE=." ]
}
write_lit_cfg("lit_api_site_cfg") {
# Fully-qualified instead of relative for LIT_SITE_CFG_IN_HEADER.
input = "//lldb/test/API/lit.site.cfg.py.in"
output = lldb_lit_api_site_cfg_file
extra_values = [
"LIBCXX_LIBRARY_DIR=" + rebase_path("$root_build_dir/lib"),
"LIBCXX_GENERATED_INCLUDE_DIR=" +
rebase_path("$root_build_dir/include/c++/v1"),
"LIBCXX_GENERATED_INCLUDE_TARGET_DIR=",
"LLDB_BUILD_INTEL_PT=0",
"LLDB_TEST_COMMON_ARGS=",
"LLDB_TEST_USER_ARGS=",
"LLDB_ENABLE_PYTHON=0",
"LLDB_HAS_LIBCXX=0", # FIXME: support this (?)
"LLDB_LIBS_DIR=", # FIXME: for shared builds only (?)
"LLDB_TEST_ARCH=$current_cpu",
"LLDB_TEST_COMPILER=" + rebase_path("$root_build_dir/bin/clang"),
"LLDB_TEST_BUILD_DIRECTORY=" + rebase_path("$target_gen_dir/test_build"),
"LLDB_TEST_DSYMUTIL=" + rebase_path("$root_build_dir/bin/dsymutil"),
"LLDB_TEST_EXECUTABLE=" + rebase_path("$root_build_dir/bin/lldb"),
"LLDB_TEST_MODULE_CACHE_CLANG=" +
rebase_path(
"$target_gen_dir/lldb-test-build.noindex/module-cache-clang"),
"LLDB_TEST_MODULE_CACHE_LLDB=" +
rebase_path(
"$target_gen_dir/lldb-test-build.noindex/module-cache-lldb"),
"LLVM_BUILD_MODE=.",
"LLVM_ENABLE_SHARED_LIBS=0",
"LLVM_HOST_TRIPLE=$llvm_current_triple",
"LLVM_INCLUDE_DIR=" + rebase_path("$root_out_dir/include"),
"LLVM_USE_SANITIZER=",
"Lua_EXECUTABLE=",
"LLDB_FRAMEWORK_DIR=XXX_framework_dir",
"CMAKE_CXX_COMPILER=c++", # XXX use bin/clang++ instead?
"HOST_OS=$host_os", # XXX
]
dir = get_path_info(output, "dir")
if (host_os == "win") {
# See comment for Windows solink in llvm/utils/gn/build/toolchain/BUILD.gn
extra_values += [ "SHLIBDIR=" + rebase_path("$root_out_dir/bin", dir) ]
} else {
extra_values += [ "SHLIBDIR=" + rebase_path("$root_out_dir/lib", dir) ]
}
}
write_lit_cfg("lit_shell_site_cfg") {
# Fully-qualified instead of relative for LIT_SITE_CFG_IN_HEADER.
input = "//lldb/test/Shell/lit.site.cfg.py.in"
output = lldb_lit_shell_site_cfg_file
extra_values = [
"CMAKE_SYSROOT=",
"LLDB_ENABLE_LUA=0", # FIXME: gn arg, use in Config.h
"LLDB_ENABLE_LZMA=0", # FIXME: gn arg, use in Config.h
"LLDB_ENABLE_PYTHON=0", # FIXME: gn arg, use in Config.h
"LLDB_IS_64_BITS=1",
"LLDB_LIBS_DIR=", # FIXME: for shared builds only (?)
"LLDB_LIT_TOOLS_DIR=", # Intentionally empty, matches cmake build.
"LLDB_TEST_BUILD_DIRECTORY=" + rebase_path("$target_gen_dir/test_build"),
"LLDB_TEST_MODULE_CACHE_CLANG=" +
rebase_path(
"$target_gen_dir/lldb-test-build.noindex/module-cache-clang"),
"LLDB_TEST_MODULE_CACHE_LLDB=" +
rebase_path(
"$target_gen_dir/lldb-test-build.noindex/module-cache-lldb"),
"LLDB_TEST_OBJC_GNUSTEP_DIR=",
"LLDB_TOOL_LLDB_SERVER_BUILD=1",
"LLDB_TOOLS_DIR=" + rebase_path("$root_out_dir/bin"),
"LLDB_USE_SYSTEM_DEBUGSERVER=1", # XXX port //lldb/tools/debugserver (?)
"LLVM_HOST_TRIPLE=$llvm_current_triple",
]
if (llvm_enable_zlib) {
extra_values += [ "LLVM_ENABLE_ZLIB=1" ]
} else {
extra_values += [ "LLVM_ENABLE_ZLIB=0" ] # Must be 0.
}
dir = get_path_info(output, "dir")
if (host_os == "win") {
# See comment for Windows solink in llvm/utils/gn/build/toolchain/BUILD.gn
extra_values += [ "SHLIBDIR=" + rebase_path("$root_out_dir/bin", dir) ]
} else {
extra_values += [ "SHLIBDIR=" + rebase_path("$root_out_dir/lib", dir) ]
}
}
write_lit_cfg("lit_unit_site_cfg") {
# Fully-qualified instead of relative for LIT_SITE_CFG_IN_HEADER.
input = "//lldb/test/Unit/lit.site.cfg.py.in"
output = lldb_lit_unit_site_cfg_file
extra_values = [ "LLVM_BUILD_MODE=." ]
}
action("lit-lldb-init-quiet") {
script = "//llvm/utils/gn/build/write_file.py"
outputs = [ "$root_out_dir/obj/lldb/test/Shell/lit-lldb-init-quiet" ]
args = [
rebase_path(outputs[0], root_build_dir),
"command source -C --silent-run true lit-lldb-init",
]
}
# This target should contain all dependencies of check-lldb.
# //:default depends on it, so that ninja's default target builds all
# prerequisites for check-lldb but doesn't run check-lldb itself.
group("test") {
deps = [
":lit-lldb-init",
":lit-lldb-init-quiet",
":lit_api_site_cfg",
":lit_shell_site_cfg",
":lit_site_cfg",
":lit_unit_site_cfg",
"//clang/tools/driver:symlinks",
"//lld/tools/lld:symlinks",
"//lldb/tools/lldb-dap",
"//lldb/tools/driver:lldb",
# XXX lldb-instr, darwin-debug, etc
"//lldb/tools/lldb-server",
"//lldb/tools/lldb-test",
"//lldb/utils/lit-cpuid",
#"//lldb/unittests",
"//llvm/tools/dsymutil",
"//llvm/tools/llc",
"//llvm/tools/lli",
"//llvm/tools/llvm-config",
"//llvm/tools/llvm-dwarfdump",
"//llvm/tools/llvm-dwp",
"//llvm/tools/llvm-mc",
"//llvm/tools/llvm-nm:symlinks",
"//llvm/tools/llvm-objcopy:symlinks",
"//llvm/tools/llvm-pdbutil",
"//llvm/tools/llvm-readobj:symlinks",
"//llvm/tools/yaml2obj",
"//llvm/utils/FileCheck",
"//llvm/utils/count",
"//llvm/utils/llvm-lit",
"//llvm/utils/not",
"//llvm/utils/split-file",
]
testonly = true
}
# This is the action that runs all of lldb's tests, check-lldb.
action("check-lldb") {
script = "$root_out_dir/bin/llvm-lit"
if (host_os == "win") {
script += ".py"
}
args = [
"-sv",
rebase_path(".", root_out_dir),
]
outputs = [ "$target_gen_dir/run-lit" ] # Non-existing, so that ninja runs it
# each time.
# Since check-lldb 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"
}
|