mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-27 07:31:28 +00:00
Refactor the lit configuration files
A year or so ago, I re-wrote most of the lit infrastructure in LLVM so that it wasn't so boilerplate-y. I added lots of common helper type stuff, simplifed usage patterns, and made the code more elegant and maintainable. We migrated to this in LLVM, clang, and lld's lit files, but not in LLDBs. This started to bite me recently, as the 4 most recent times I tried to run the lit test suite in LLDB on a fresh checkout the first thing that would happen is that python would just start crashing with unhelpful backtraces and I would have to spend time investigating. You can reproduce this today by doing a fresh cmake generation, doing ninja lldb and then python bin/llvm-lit.py -sv ~/lldb/lit/SymbolFile at which point you'll get a segfault that tells you nothing about what your problem is. I started trying to fix the issues with bandaids, but it became clear that the proper solution was to just bring in the work I did in the rest of the projects. The side benefit of this is that the lit configuration files become much cleaner and more understandable as a result. Differential Revision: https://reviews.llvm.org/D54009 llvm-svn: 346008
This commit is contained in:
parent
7bafaf8ffe
commit
b6355cc561
@ -1,5 +1,5 @@
|
||||
# REQUIRES: windows
|
||||
# XFAIL: windows
|
||||
# REQUIRES: system-windows
|
||||
# XFAIL: system-windows
|
||||
# -> llvm.org/pr24528
|
||||
#
|
||||
# RUN: %cc %p/Inputs/case-sensitive.c -g -o %t
|
||||
|
@ -1 +0,0 @@
|
||||
config.suffixes = ['.test']
|
@ -51,11 +51,13 @@ llvm_canonicalize_cmake_booleans(
|
||||
LLVM_ENABLE_ZLIB)
|
||||
|
||||
configure_lit_site_cfg(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg)
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py
|
||||
MAIN_CONFIG
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py)
|
||||
configure_lit_site_cfg(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg)
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.py.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg.py)
|
||||
configure_lit_site_cfg(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Suite/lit.site.cfg.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/Suite/lit.site.cfg)
|
||||
@ -67,14 +69,8 @@ if(NOT LLDB_BUILT_STANDALONE)
|
||||
)
|
||||
endif()
|
||||
|
||||
set(LLDB_TEST_PARAMS
|
||||
lldb_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
|
||||
)
|
||||
|
||||
add_lit_testsuite(check-lldb-lit "Running lldb lit test suite"
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
PARAMS lldb_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
|
||||
lldb_unit_site_config=${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
|
||||
DEPENDS ${LLDB_TEST_DEPS}
|
||||
)
|
||||
|
||||
@ -88,7 +84,5 @@ endif()
|
||||
|
||||
add_lit_testsuites(LLDB
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
PARAMS lldb_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
|
||||
lldb_unit_site_config=${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
|
||||
DEPENDS ${LLDB_TEST_DEPS}
|
||||
)
|
||||
|
@ -1,4 +1,4 @@
|
||||
# REQUIRES: windows
|
||||
# REQUIRES: system-windows
|
||||
|
||||
# RUN: clang-cl /Zi %p/Inputs/call-function.cpp -o %t
|
||||
|
||||
|
@ -1 +0,0 @@
|
||||
config.suffixes = ['.test']
|
@ -1 +0,0 @@
|
||||
config.suffixes = ['.test']
|
@ -1 +0,0 @@
|
||||
config.suffixes = ['.test']
|
@ -1 +0,0 @@
|
||||
config.suffixes = ['.test', '.cpp']
|
@ -1,4 +1,4 @@
|
||||
REQUIRES: windows
|
||||
REQUIRES: system-windows
|
||||
RUN: cl /Zi /GS- /c %S/Inputs/AstRestoreTest.cpp /Fo%t.obj
|
||||
RUN: link /debug:full /nodefaultlib /entry:main %t.obj /out:%t.exe
|
||||
RUN: lldb-test symbols -dump-ast %t.exe | FileCheck --check-prefix=ENUM %s
|
||||
|
@ -1,4 +1,4 @@
|
||||
REQUIRES: windows, lld
|
||||
REQUIRES: system-windows, lld
|
||||
RUN: clang-cl -m32 /Zi /GS- /c %S/Inputs/CallingConventionsTest.cpp /o %t.obj
|
||||
RUN: lld-link /debug:full /nodefaultlib /entry:main %t.obj /out:%t.exe
|
||||
RUN: lldb-test symbols -dump-ast %t.exe | FileCheck %s
|
||||
|
@ -1,4 +1,4 @@
|
||||
REQUIRES: windows
|
||||
REQUIRES: system-windows
|
||||
RUN: clang-cl -m32 /Z7 /c /GS- %S/Inputs/ClassLayoutTest.cpp /o %T/ClassLayoutTest.cpp.obj
|
||||
RUN: link %T/ClassLayoutTest.cpp.obj /DEBUG /nodefaultlib /ENTRY:main /OUT:%T/ClassLayoutTest.cpp.exe
|
||||
RUN: lldb-test symbols %T/ClassLayoutTest.cpp.exe | FileCheck %s
|
||||
|
@ -1,4 +1,4 @@
|
||||
REQUIRES: windows
|
||||
REQUIRES: system-windows
|
||||
RUN: clang-cl /Z7 %S/Inputs/CompilandsTest.cpp /o %T/CompilandsTest.cpp.exe
|
||||
RUN: lldb-test symbols %T/CompilandsTest.cpp.exe | FileCheck %s
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
REQUIRES: windows
|
||||
REQUIRES: system-windows
|
||||
RUN: clang-cl -m32 /Z7 /c /GS- %S/Inputs/SimpleTypesTest.cpp /o %T/SimpleTypesTest.cpp.enums.obj
|
||||
RUN: link %T/SimpleTypesTest.cpp.enums.obj /DEBUG /nodefaultlib /ENTRY:main /OUT:%T/SimpleTypesTest.cpp.enums.exe
|
||||
RUN: lldb-test symbols %T/SimpleTypesTest.cpp.enums.exe | FileCheck %s
|
||||
|
@ -1,4 +1,4 @@
|
||||
REQUIRES: windows
|
||||
REQUIRES: system-windows
|
||||
RUN: clang-cl -m32 /Z7 /c /GS- %S/Inputs/FuncSymbolsTestMain.cpp /o %T/FuncSymbolsTestMain.cpp.obj
|
||||
RUN: clang-cl -m32 /Z7 /c /GS- %S/Inputs/FuncSymbols.cpp /o %T/FuncSymbols.cpp.obj
|
||||
RUN: link %T/FuncSymbolsTestMain.cpp.obj %T/FuncSymbols.cpp.obj /DEBUG /nodefaultlib /Entry:main /OUT:%T/FuncSymbolsTest.exe
|
||||
|
@ -1,4 +1,4 @@
|
||||
REQUIRES: windows, lld
|
||||
REQUIRES: system-windows, lld
|
||||
RUN: clang-cl /c /Zi /Gy %S/Inputs/FunctionLevelLinkingTest.cpp /o %t.obj
|
||||
RUN: lld-link /debug:full /nodefaultlib /entry:main /order:@%S/Inputs/FunctionLevelLinkingTest.ord %t.obj /out:%t.exe
|
||||
RUN: lldb-test symbols -verify %t.exe
|
||||
|
@ -1,4 +1,4 @@
|
||||
REQUIRES: windows, lld
|
||||
REQUIRES: system-windows, lld
|
||||
RUN: clang-cl /c /Zi %S/Inputs/FunctionNestedBlockTest.cpp /o %t.obj
|
||||
RUN: lld-link /debug:full /nodefaultlib /entry:main %t.obj /out:%t.exe
|
||||
RUN: lldb-test symbols -find=function -file FunctionNestedBlockTest.cpp -line 4 %t.exe | FileCheck --check-prefix=CHECK-FUNCTION %s
|
||||
|
@ -1 +0,0 @@
|
||||
config.suffixes = ['.test']
|
@ -1,4 +1,4 @@
|
||||
REQUIRES: windows
|
||||
REQUIRES: system-windows
|
||||
RUN: clang-cl -m32 /Z7 /c /GS- %S/Inputs/PointerTypeTest.cpp /o %T/PointerTypeTest.cpp.obj
|
||||
RUN: link %T/PointerTypeTest.cpp.obj /DEBUG /nodefaultlib /ENTRY:main /OUT:%T/PointerTypeTest.cpp.exe
|
||||
RUN: lldb-test symbols %T/PointerTypeTest.cpp.exe | FileCheck %s
|
||||
|
@ -1,4 +1,4 @@
|
||||
REQUIRES: windows
|
||||
REQUIRES: system-windows
|
||||
RUN: clang-cl -m32 /Z7 /c /GS- %S/Inputs/TypeQualsTest.cpp /o %T/TypeQualsTest.cpp.obj
|
||||
RUN: link %T/TypeQualsTest.cpp.obj /DEBUG /nodefaultlib /ENTRY:main /OUT:%T/TypeQualsTest.cpp.exe
|
||||
RUN: lldb-test symbols %T/TypeQualsTest.cpp.exe | FileCheck %s
|
||||
|
@ -1,4 +1,4 @@
|
||||
REQUIRES: windows
|
||||
REQUIRES: system-windows
|
||||
RUN: clang-cl -m32 /Z7 /c /GS- %S/Inputs/SimpleTypesTest.cpp /o %T/SimpleTypesTest.cpp.typedefs.obj
|
||||
RUN: link %T/SimpleTypesTest.cpp.typedefs.obj /DEBUG /nodefaultlib /ENTRY:main /OUT:%T/SimpleTypesTest.cpp.typedefs.exe
|
||||
RUN: lldb-test symbols %T/SimpleTypesTest.cpp.typedefs.exe | FileCheck %s
|
||||
|
@ -1,4 +1,4 @@
|
||||
REQUIRES: windows
|
||||
REQUIRES: system-windows
|
||||
RUN: clang-cl /Zi %S/Inputs/UdtLayoutTest.cpp /o %t.exe
|
||||
RUN: %lldb -b -s %S/Inputs/UdtLayoutTest.script -- %t.exe | FileCheck %s
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
REQUIRES: windows
|
||||
REQUIRES: system-windows
|
||||
RUN: clang-cl /Zi %S/Inputs/VariablesLocationsTest.cpp /o %t.exe
|
||||
RUN: %lldb -b -s %S/Inputs/VariablesLocationsTest.script -- %t.exe | FileCheck %s
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
REQUIRES: windows
|
||||
REQUIRES: system-windows
|
||||
RUN: clang-cl -m64 /Z7 /c /GS- %S/Inputs/VariablesTest.cpp /o %T/VariablesTest.cpp.obj
|
||||
RUN: link %T/VariablesTest.cpp.obj /DEBUG /nodefaultlib /ENTRY:main /OUT:%T/VariablesTest.cpp.exe
|
||||
RUN: lldb-test symbols %T/VariablesTest.cpp.exe | FileCheck %s
|
||||
|
@ -3,8 +3,10 @@
|
||||
# Configuration file for the 'lit' test runner.
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
import lit.formats
|
||||
from lit.llvm import llvm_config
|
||||
|
||||
# name: The name of this test suite.
|
||||
config.name = 'lldb-Unit'
|
||||
@ -17,5 +19,12 @@ config.suffixes = []
|
||||
config.test_source_root = os.path.join(config.lldb_obj_root, 'unittests')
|
||||
config.test_exec_root = config.test_source_root
|
||||
|
||||
# One of our unit tests dynamically links against python.dll, and on Windows
|
||||
# it needs to be able to find it at runtime. This is fine if Python is on your
|
||||
# system PATH, but if it's not, then this unit test executable will fail to run.
|
||||
# We can solve this by forcing the Python directory onto the system path here.
|
||||
llvm_config.with_system_environment('PATH')
|
||||
llvm_config.with_environment('PATH', os.path.dirname(sys.executable), append_path=True)
|
||||
|
||||
# testFormat: The test format to use to interpret tests.
|
||||
config.test_format = lit.formats.GoogleTest(config.llvm_build_mode, 'Tests')
|
@ -22,5 +22,8 @@ except KeyError as e:
|
||||
key, = e.args
|
||||
lit_config.fatal("unable to find %r parameter, use '--param=%s=VALUE'" % (key,key))
|
||||
|
||||
import lit.llvm
|
||||
lit.llvm.initialize(lit_config, config)
|
||||
|
||||
# Let the main config do the real work.
|
||||
lit_config.load_config(config, "@LLDB_SOURCE_DIR@/lit/Unit/lit.cfg")
|
||||
lit_config.load_config(config, "@LLDB_SOURCE_DIR@/lit/Unit/lit.cfg.py")
|
183
lldb/lit/lit.cfg
183
lldb/lit/lit.cfg
@ -1,183 +0,0 @@
|
||||
# -*- Python -*-
|
||||
|
||||
import os
|
||||
import platform
|
||||
import re
|
||||
import subprocess
|
||||
import locale
|
||||
|
||||
import lit.formats
|
||||
import lit.util
|
||||
|
||||
def binary_feature(on, feature, off_prefix):
|
||||
return feature if on else off_prefix + feature
|
||||
|
||||
# Configuration file for the 'lit' test runner.
|
||||
|
||||
# name: The name of this test suite.
|
||||
config.name = 'lldb'
|
||||
|
||||
# testFormat: The test format to use to interpret tests.
|
||||
#
|
||||
# For now we require '&&' between commands, until they get globally killed and
|
||||
# the test runner updated.
|
||||
execute_external = (platform.system() != 'Windows'
|
||||
or lit_config.getBashPath() not in [None, ""])
|
||||
config.test_format = lit.formats.ShTest(execute_external)
|
||||
|
||||
# suffixes: We only support unit tests
|
||||
config.suffixes = []
|
||||
|
||||
config.excludes = ['Inputs']
|
||||
|
||||
# test_source_root: The root path where tests are located.
|
||||
config.test_source_root = os.path.dirname(__file__)
|
||||
|
||||
# test_exec_root: The root path where tests should be run.
|
||||
config.test_exec_root = os.path.join(config.lldb_obj_root, 'lit')
|
||||
|
||||
# Tweak the PATH to include the tools dir and the scripts dir.
|
||||
lldb_tools_dir = config.lldb_tools_dir
|
||||
llvm_tools_dir = config.llvm_tools_dir
|
||||
path = os.path.pathsep.join((config.lldb_tools_dir, config.llvm_tools_dir, config.environment['PATH']))
|
||||
|
||||
config.environment['PATH'] = path
|
||||
|
||||
path = os.path.pathsep.join((config.lldb_libs_dir, config.llvm_libs_dir,
|
||||
config.environment.get('LD_LIBRARY_PATH','')))
|
||||
config.environment['LD_LIBRARY_PATH'] = path
|
||||
|
||||
# Propagate LLVM_SRC_ROOT into the environment.
|
||||
config.environment['LLVM_SRC_ROOT'] = getattr(config, 'llvm_src_root', '')
|
||||
|
||||
# Propagate PYTHON_EXECUTABLE into the environment
|
||||
config.environment['PYTHON_EXECUTABLE'] = getattr(config, 'python_executable', '')
|
||||
|
||||
# Register substitutions
|
||||
config.substitutions.append(('%python', '"%s"' % (config.python_executable)))
|
||||
|
||||
if platform.system() in ['Darwin']:
|
||||
debugserver = lit.util.which('debugserver', lldb_tools_dir)
|
||||
else:
|
||||
debugserver = lit.util.which('lldb-server', lldb_tools_dir)
|
||||
lldb = "%s -S %s/lit-lldb-init" % (lit.util.which('lldb', lldb_tools_dir),
|
||||
config.test_source_root)
|
||||
|
||||
lldbmi = lit.util.which('lldb-mi', lldb_tools_dir)
|
||||
if lldbmi:
|
||||
config.available_features.add('lldb-mi')
|
||||
|
||||
if not os.path.exists(config.cc):
|
||||
config.cc = lit.util.which(config.cc, config.environment['PATH'])
|
||||
|
||||
if not os.path.exists(config.cxx):
|
||||
config.cxx = lit.util.which(config.cxx, config.environment['PATH'])
|
||||
|
||||
if platform.system() in ['Darwin']:
|
||||
try:
|
||||
out = subprocess.check_output(['xcrun', '--show-sdk-path']).strip()
|
||||
res = 0
|
||||
except OSError:
|
||||
res = -1
|
||||
if res == 0 and out:
|
||||
sdk_path = lit.util.to_string(out)
|
||||
lit_config.note('using SDKROOT: %r' % sdk_path)
|
||||
config.cc += " -isysroot %s" % sdk_path
|
||||
config.cxx += " -isysroot %s" % sdk_path
|
||||
|
||||
if platform.system() in ['OpenBSD']:
|
||||
config.cc += " -pthread"
|
||||
config.cxx += " -pthread"
|
||||
|
||||
config.substitutions.append(('%cc', config.cc))
|
||||
config.substitutions.append(('%cxx', config.cxx))
|
||||
|
||||
if lldbmi:
|
||||
config.substitutions.append(('%lldbmi', lldbmi + " --synchronous"))
|
||||
config.substitutions.append(('%lldb', lldb))
|
||||
|
||||
if debugserver is not None:
|
||||
if platform.system() in ['Darwin']:
|
||||
config.substitutions.append(('%debugserver', debugserver))
|
||||
else:
|
||||
config.substitutions.append(('%debugserver', debugserver + ' gdbserver'))
|
||||
|
||||
for pattern in [r"\bFileCheck\b",
|
||||
r"\blldb-test\b",
|
||||
r"\byaml2obj\b",
|
||||
r"\| \bnot\b"]:
|
||||
tool_match = re.match(r"^(\\)?((\| )?)\W+b([0-9A-Za-z-_]+)\\b\W*$",
|
||||
pattern)
|
||||
tool_pipe = tool_match.group(2)
|
||||
tool_name = tool_match.group(4)
|
||||
tool_path = lit.util.which(tool_name, config.environment['PATH'])
|
||||
if not tool_path:
|
||||
# Warn, but still provide a substitution.
|
||||
lit_config.note(
|
||||
'Did not find ' + tool_name + ' in ' + config.environment['PATH'])
|
||||
config.substitutions.append((pattern, tool_pipe + tool_path))
|
||||
|
||||
# Shell execution
|
||||
if platform.system() not in ['Windows'] or lit_config.getBashPath() != '':
|
||||
config.available_features.add('shell')
|
||||
|
||||
# Running on Darwin OS
|
||||
if platform.system() in ['Darwin']:
|
||||
config.available_features.add('darwin')
|
||||
config.available_features.add('system-linker-mach-o')
|
||||
|
||||
# Running on ELF based *nix
|
||||
if platform.system() in ['FreeBSD', 'Linux']:
|
||||
config.available_features.add('system-linker-elf')
|
||||
if platform.system() in ['FreeBSD']:
|
||||
config.available_features.add('freebsd')
|
||||
else:
|
||||
config.available_features.add('linux')
|
||||
|
||||
config.available_features.add(
|
||||
binary_feature(platform.system() in ['Windows'], 'windows', 'no'))
|
||||
|
||||
if re.match(r'^arm(hf.*-linux)|(.*-linux-gnuabihf)', config.target_triple):
|
||||
config.available_features.add("armhf-linux")
|
||||
|
||||
if re.match(r'icc', config.cc):
|
||||
config.available_features.add("compiler-icc")
|
||||
elif re.match(r'clang', config.cc):
|
||||
config.available_features.add("compiler-clang")
|
||||
elif re.match(r'gcc', config.cc):
|
||||
config.available_features.add("compiler-gcc")
|
||||
elif re.match(r'cl', config.cc):
|
||||
config.available_features.add("compiler-msvc")
|
||||
|
||||
config.available_features.add(binary_feature(config.have_zlib, "zlib", "no"))
|
||||
if config.have_lld:
|
||||
config.available_features.add("lld")
|
||||
|
||||
# llvm-config knows whether it is compiled with asserts (and)
|
||||
# whether we are operating in release/debug mode.
|
||||
import subprocess
|
||||
try:
|
||||
llvm_config_cmd = \
|
||||
subprocess.Popen([os.path.join(llvm_tools_dir, 'llvm-config'),
|
||||
'--build-mode', '--assertion-mode', '--targets-built'],
|
||||
stdout = subprocess.PIPE)
|
||||
except OSError as why:
|
||||
print("Could not find llvm-config in " + llvm_tools_dir)
|
||||
exit(42)
|
||||
|
||||
llvm_config_output = llvm_config_cmd.stdout.read().decode('utf_8')
|
||||
llvm_config_output_list = llvm_config_output.split("\n")
|
||||
|
||||
if re.search(r'DEBUG', llvm_config_output_list[0]):
|
||||
config.available_features.add('debug')
|
||||
if re.search(r'ON', llvm_config_output_list[1]):
|
||||
config.available_features.add('asserts')
|
||||
if re.search(r'ARM', llvm_config_output_list[2]):
|
||||
config.available_features.add('arm')
|
||||
if re.search(r'Mips', llvm_config_output_list[2]):
|
||||
config.available_features.add('mips')
|
||||
if re.search(r'PowerPC', llvm_config_output_list[2]):
|
||||
config.available_features.add('powerpc')
|
||||
if re.search(r'X86', llvm_config_output_list[2]):
|
||||
config.available_features.add('x86')
|
||||
llvm_config_cmd.wait()
|
126
lldb/lit/lit.cfg.py
Normal file
126
lldb/lit/lit.cfg.py
Normal file
@ -0,0 +1,126 @@
|
||||
# -*- Python -*-
|
||||
|
||||
import os
|
||||
import sys
|
||||
import re
|
||||
import platform
|
||||
import subprocess
|
||||
|
||||
|
||||
import lit.util
|
||||
import lit.formats
|
||||
from lit.llvm import llvm_config
|
||||
from lit.llvm.subst import FindTool
|
||||
from lit.llvm.subst import ToolSubst
|
||||
|
||||
# name: The name of this test suite.
|
||||
config.name = 'LLDB'
|
||||
|
||||
# testFormat: The test format to use to interpret tests.
|
||||
config.test_format = lit.formats.ShTest(not llvm_config.use_lit_shell)
|
||||
|
||||
# suffixes: A list of file extensions to treat as test files. This is overriden
|
||||
# by individual lit.local.cfg files in the test subdirectories.
|
||||
config.suffixes = ['.test', '.cpp', '.s']
|
||||
|
||||
# excludes: A list of directories to exclude from the testsuite. The 'Inputs'
|
||||
# subdirectories contain auxiliary inputs for various tests in their parent
|
||||
# directories.
|
||||
config.excludes = ['Inputs', 'CMakeLists.txt', 'README.txt', 'LICENSE.txt']
|
||||
|
||||
# test_source_root: The root path where tests are located.
|
||||
config.test_source_root = os.path.dirname(__file__)
|
||||
|
||||
# test_exec_root: The root path where tests should be run.
|
||||
config.test_exec_root = os.path.join(config.lldb_obj_root, 'lit')
|
||||
|
||||
# Tweak the PATH to include the tools dir.
|
||||
llvm_config.with_system_environment('PATH')
|
||||
llvm_config.with_environment('PATH', config.lldb_tools_dir, append_path=True)
|
||||
llvm_config.with_environment('PATH', config.llvm_tools_dir, append_path=True)
|
||||
|
||||
llvm_config.with_environment('LD_LIBRARY_PATH', config.lldb_libs_dir, append_path=True)
|
||||
llvm_config.with_environment('LD_LIBRARY_PATH', config.llvm_libs_dir, append_path=True)
|
||||
llvm_config.with_system_environment('LD_LIBRARY_PATH', append_path=True)
|
||||
|
||||
|
||||
llvm_config.use_default_substitutions()
|
||||
|
||||
if platform.system() in ['Darwin']:
|
||||
debugserver = lit.util.which('debugserver', config.lldb_tools_dir)
|
||||
else:
|
||||
debugserver = lit.util.which('lldb-server', config.lldb_tools_dir)
|
||||
lldb = "%s -S %s/lit-lldb-init" % (lit.util.which('lldb', config.lldb_tools_dir),
|
||||
config.test_source_root)
|
||||
|
||||
lldbmi = lit.util.which('lldb-mi', config.lldb_tools_dir)
|
||||
if lldbmi:
|
||||
config.available_features.add('lldb-mi')
|
||||
|
||||
config.cc = llvm_config.use_llvm_tool(config.cc, required=True)
|
||||
config.cxx = llvm_config.use_llvm_tool(config.cxx, required=True)
|
||||
|
||||
if platform.system() in ['Darwin']:
|
||||
try:
|
||||
out = subprocess.check_output(['xcrun', '--show-sdk-path']).strip()
|
||||
res = 0
|
||||
except OSError:
|
||||
res = -1
|
||||
if res == 0 and out:
|
||||
sdk_path = lit.util.to_string(out)
|
||||
lit_config.note('using SDKROOT: %r' % sdk_path)
|
||||
config.cc += " -isysroot %s" % sdk_path
|
||||
config.cxx += " -isysroot %s" % sdk_path
|
||||
|
||||
if platform.system() in ['OpenBSD']:
|
||||
config.cc += " -pthread"
|
||||
config.cxx += " -pthread"
|
||||
|
||||
config.substitutions.append(('%cc', config.cc))
|
||||
config.substitutions.append(('%cxx', config.cxx))
|
||||
|
||||
if lldbmi:
|
||||
config.substitutions.append(('%lldbmi', lldbmi + " --synchronous"))
|
||||
config.substitutions.append(('%lldb', lldb))
|
||||
|
||||
if debugserver is not None:
|
||||
if platform.system() in ['Darwin']:
|
||||
config.substitutions.append(('%debugserver', debugserver))
|
||||
else:
|
||||
config.substitutions.append(('%debugserver', debugserver + ' gdbserver'))
|
||||
|
||||
tools = ['lldb-test', 'yaml2obj', 'obj2yaml', 'llvm-pdbutil']
|
||||
llvm_config.add_tool_substitutions(tools, [config.llvm_tools_dir, config.lldb_tools_dir])
|
||||
|
||||
if re.match(r'^arm(hf.*-linux)|(.*-linux-gnuabihf)', config.target_triple):
|
||||
config.available_features.add("armhf-linux")
|
||||
|
||||
print("config.cc = {}".format(config.cc))
|
||||
if re.match(r'icc', config.cc):
|
||||
config.available_features.add("compiler-icc")
|
||||
elif re.match(r'clang', config.cc):
|
||||
config.available_features.add("compiler-clang")
|
||||
elif re.match(r'gcc', config.cc):
|
||||
config.available_features.add("compiler-gcc")
|
||||
elif re.match(r'cl', config.cc):
|
||||
config.available_features.add("compiler-msvc")
|
||||
|
||||
if config.have_lld:
|
||||
config.available_features.add("lld")
|
||||
|
||||
def calculate_arch_features(arch_string):
|
||||
# This will add a feature such as x86, arm, mips, etc for each built
|
||||
# target
|
||||
features = []
|
||||
for arch in arch_string.split():
|
||||
features.append(arch.lower())
|
||||
return features
|
||||
|
||||
# Run llvm-config and add automatically add features for whether we have
|
||||
# assertions enabled, whether we are in debug mode, and what targets we
|
||||
# are built for.
|
||||
llvm_config.feature_config(
|
||||
[('--assertion-mode', {'ON': 'asserts'}),
|
||||
('--build-mode', {'DEBUG': 'debug'}),
|
||||
('--targets-built', calculate_arch_features)
|
||||
])
|
@ -29,4 +29,4 @@ except KeyError as e:
|
||||
lit_config.fatal("unable to find %r parameter, use '--param=%s=VALUE'" % (key,key))
|
||||
|
||||
# Let the main config do the real work.
|
||||
lit_config.load_config(config, "@LLDB_SOURCE_DIR@/lit/lit.cfg")
|
||||
lit_config.load_config(config, "@LLDB_SOURCE_DIR@/lit/lit.cfg.py")
|
@ -1,4 +1,4 @@
|
||||
# XFAIL: windows
|
||||
# XFAIL: system-windows
|
||||
# -> llvm.org/pr24452
|
||||
#
|
||||
# RUN: %cc -o %t %p/inputs/break-insert-pending.c -g
|
||||
|
@ -1,4 +1,4 @@
|
||||
# XFAIL: windows
|
||||
# XFAIL: system-windows
|
||||
# -> llvm.org/pr24452
|
||||
#
|
||||
# RUN: %cc -o a.exe %p/inputs/break-insert.c -g
|
||||
|
@ -1,4 +1,4 @@
|
||||
# XFAIL: windows
|
||||
# XFAIL: system-windows
|
||||
# -> llvm.org/pr24452
|
||||
#
|
||||
# RUN: %cc -o %t %p/inputs/data-info-line.c -g
|
||||
|
@ -1,4 +1,4 @@
|
||||
# XFAIL: windows
|
||||
# XFAIL: system-windows
|
||||
# -> llvm.org/pr24452
|
||||
#
|
||||
# RUN: %cc -o %t %p/inputs/main.c -g
|
||||
|
@ -1,4 +1,4 @@
|
||||
# XFAIL: windows
|
||||
# XFAIL: system-windows
|
||||
# -> llvm.org/pr24452
|
||||
#
|
||||
# RUN: %cc -o %t %p/inputs/main.c -g
|
||||
|
@ -1,4 +1,4 @@
|
||||
# XFAIL: windows
|
||||
# XFAIL: system-windows
|
||||
# -> llvm.org/pr24452
|
||||
#
|
||||
# RUN: %cc -o %t %p/inputs/main.c -g
|
||||
|
@ -1,4 +1,4 @@
|
||||
# XFAIL: windows
|
||||
# XFAIL: system-windows
|
||||
# -> llvm.org/pr24452
|
||||
#
|
||||
# RUN: %cc -o %t %p/inputs/main.c -g
|
||||
|
@ -1,4 +1,4 @@
|
||||
# XFAIL: windows
|
||||
# XFAIL: system-windows
|
||||
# -> llvm.org/pr24452
|
||||
#
|
||||
# RUN: %cc -o %t %p/inputs/main.c -g
|
||||
|
@ -1,4 +1,4 @@
|
||||
# XFAIL: windows
|
||||
# XFAIL: system-windows
|
||||
# -> llvm.org/pr24452
|
||||
#
|
||||
# RUN: %cc -o %t %p/inputs/main.c -g
|
||||
|
@ -1,4 +1,4 @@
|
||||
# XFAIL: windows
|
||||
# XFAIL: system-windows
|
||||
# -> llvm.org/pr24452
|
||||
#
|
||||
# RUN: %cc -o %t %p/inputs/main.c -g
|
||||
|
@ -1,4 +1,4 @@
|
||||
# XFAIL: windows
|
||||
# XFAIL: system-windows
|
||||
# -> llvm.org/pr24452
|
||||
#
|
||||
# RUN: %cc -o %t %p/inputs/main.c %p/inputs/symbol-list-lines.c %p/inputs/list-lines-helper.c -g
|
||||
|
@ -55,6 +55,8 @@ class LLVMConfig(object):
|
||||
features.add('system-windows')
|
||||
elif platform.system() == "Linux":
|
||||
features.add('system-linux')
|
||||
elif platform.system() in ['FreeBSD']:
|
||||
config.available_features.add('system-freebsd')
|
||||
|
||||
# Native compilation: host arch == default triple arch
|
||||
# Both of these values should probably be in every site config (e.g. as
|
||||
|
Loading…
Reference in New Issue
Block a user