Index: lit/Breakpoint/case-insensitive.test =================================================================== --- lit/Breakpoint/case-insensitive.test +++ lit/Breakpoint/case-insensitive.test @@ -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 Index: lit/Breakpoint/lit.local.cfg =================================================================== --- lit/Breakpoint/lit.local.cfg +++ lit/Breakpoint/lit.local.cfg @@ -1 +0,0 @@ -config.suffixes = ['.test'] Index: lit/CMakeLists.txt =================================================================== --- lit/CMakeLists.txt +++ lit/CMakeLists.txt @@ -51,11 +51,13 @@ 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 @@ ) 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 @@ 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} ) Index: lit/Expr/TestIRMemoryMapWindows.test =================================================================== --- lit/Expr/TestIRMemoryMapWindows.test +++ lit/Expr/TestIRMemoryMapWindows.test @@ -1,4 +1,4 @@ -# REQUIRES: windows +# REQUIRES: system-windows # RUN: clang-cl /Zi %p/Inputs/call-function.cpp -o %t Index: lit/Expr/lit.local.cfg =================================================================== --- lit/Expr/lit.local.cfg +++ lit/Expr/lit.local.cfg @@ -1 +0,0 @@ -config.suffixes = ['.test'] Index: lit/Quit/lit.local.cfg =================================================================== --- lit/Quit/lit.local.cfg +++ lit/Quit/lit.local.cfg @@ -1 +0,0 @@ -config.suffixes = ['.test'] Index: lit/Settings/lit.local.cfg =================================================================== --- lit/Settings/lit.local.cfg +++ lit/Settings/lit.local.cfg @@ -1 +0,0 @@ -config.suffixes = ['.test'] Index: lit/SymbolFile/NativePDB/lit.local.cfg =================================================================== --- lit/SymbolFile/NativePDB/lit.local.cfg +++ lit/SymbolFile/NativePDB/lit.local.cfg @@ -1 +0,0 @@ -config.suffixes = ['.test', '.cpp'] Index: lit/SymbolFile/PDB/ast-restore.test =================================================================== --- lit/SymbolFile/PDB/ast-restore.test +++ lit/SymbolFile/PDB/ast-restore.test @@ -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 Index: lit/SymbolFile/PDB/calling-conventions.test =================================================================== --- lit/SymbolFile/PDB/calling-conventions.test +++ lit/SymbolFile/PDB/calling-conventions.test @@ -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 Index: lit/SymbolFile/PDB/class-layout.test =================================================================== --- lit/SymbolFile/PDB/class-layout.test +++ lit/SymbolFile/PDB/class-layout.test @@ -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 Index: lit/SymbolFile/PDB/compilands.test =================================================================== --- lit/SymbolFile/PDB/compilands.test +++ lit/SymbolFile/PDB/compilands.test @@ -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 Index: lit/SymbolFile/PDB/enums-layout.test =================================================================== --- lit/SymbolFile/PDB/enums-layout.test +++ lit/SymbolFile/PDB/enums-layout.test @@ -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 Index: lit/SymbolFile/PDB/func-symbols.test =================================================================== --- lit/SymbolFile/PDB/func-symbols.test +++ lit/SymbolFile/PDB/func-symbols.test @@ -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 Index: lit/SymbolFile/PDB/function-level-linking.test =================================================================== --- lit/SymbolFile/PDB/function-level-linking.test +++ lit/SymbolFile/PDB/function-level-linking.test @@ -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 Index: lit/SymbolFile/PDB/function-nested-block.test =================================================================== --- lit/SymbolFile/PDB/function-nested-block.test +++ lit/SymbolFile/PDB/function-nested-block.test @@ -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 Index: lit/SymbolFile/PDB/lit.local.cfg =================================================================== --- lit/SymbolFile/PDB/lit.local.cfg +++ lit/SymbolFile/PDB/lit.local.cfg @@ -1 +0,0 @@ -config.suffixes = ['.test'] Index: lit/SymbolFile/PDB/pointers.test =================================================================== --- lit/SymbolFile/PDB/pointers.test +++ lit/SymbolFile/PDB/pointers.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 Index: lit/SymbolFile/PDB/type-quals.test =================================================================== --- lit/SymbolFile/PDB/type-quals.test +++ lit/SymbolFile/PDB/type-quals.test @@ -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 Index: lit/SymbolFile/PDB/typedefs.test =================================================================== --- lit/SymbolFile/PDB/typedefs.test +++ lit/SymbolFile/PDB/typedefs.test @@ -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 Index: lit/SymbolFile/PDB/udt-layout.test =================================================================== --- lit/SymbolFile/PDB/udt-layout.test +++ lit/SymbolFile/PDB/udt-layout.test @@ -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 Index: lit/SymbolFile/PDB/variables-locations.test =================================================================== --- lit/SymbolFile/PDB/variables-locations.test +++ lit/SymbolFile/PDB/variables-locations.test @@ -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 Index: lit/SymbolFile/PDB/variables.test =================================================================== --- lit/SymbolFile/PDB/variables.test +++ lit/SymbolFile/PDB/variables.test @@ -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 Index: lit/Unit/lit.cfg =================================================================== --- lit/Unit/lit.cfg +++ lit/Unit/lit.cfg @@ -1,21 +0,0 @@ -# -*- Python -*- - -# Configuration file for the 'lit' test runner. - -import os - -import lit.formats - -# name: The name of this test suite. -config.name = 'lldb-Unit' - -# suffixes: A list of file extensions to treat as test files. -config.suffixes = [] - -# test_source_root: The root path where unit test binaries are located. -# test_exec_root: The root path where tests should be run. -config.test_source_root = os.path.join(config.lldb_obj_root, 'unittests') -config.test_exec_root = config.test_source_root - -# testFormat: The test format to use to interpret tests. -config.test_format = lit.formats.GoogleTest(config.llvm_build_mode, 'Tests') Index: lit/Unit/lit.cfg.py =================================================================== --- lit/Unit/lit.cfg.py +++ lit/Unit/lit.cfg.py @@ -0,0 +1,30 @@ +# -*- Python -*- + +# 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' + +# suffixes: A list of file extensions to treat as test files. +config.suffixes = [] + +# test_source_root: The root path where unit test binaries are located. +# test_exec_root: The root path where tests should be run. +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') Index: lit/Unit/lit.site.cfg.in =================================================================== --- lit/Unit/lit.site.cfg.in +++ lit/Unit/lit.site.cfg.in @@ -1,26 +0,0 @@ -@LIT_SITE_CFG_IN_HEADER@ - -config.test_exec_root = "@LLVM_BINARY_DIR@" -config.llvm_src_root = "@LLVM_SOURCE_DIR@" -config.llvm_obj_root = "@LLVM_BINARY_DIR@" -config.llvm_tools_dir = "@LLVM_TOOLS_DIR@" -config.llvm_libs_dir = "@LLVM_LIBS_DIR@" -config.llvm_build_mode = "@LLVM_BUILD_MODE@" -config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@" -config.lldb_obj_root = "@LLDB_BINARY_DIR@" -config.lldb_src_root = "@LLDB_SOURCE_DIR@" -config.target_triple = "@TARGET_TRIPLE@" -config.python_executable = "@PYTHON_EXECUTABLE@" - -# Support substitution of the tools and libs dirs with user parameters. This is -# used when we can't determine the tool dir at configuration time. -try: - config.llvm_tools_dir = config.llvm_tools_dir % lit_config.params - config.llvm_libs_dir = config.llvm_libs_dir % lit_config.params - config.llvm_build_mode = config.llvm_build_mode % lit_config.params -except KeyError as e: - key, = e.args - 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/Unit/lit.cfg") Index: lit/Unit/lit.site.cfg.py.in =================================================================== --- lit/Unit/lit.site.cfg.py.in +++ lit/Unit/lit.site.cfg.py.in @@ -0,0 +1,29 @@ +@LIT_SITE_CFG_IN_HEADER@ + +config.test_exec_root = "@LLVM_BINARY_DIR@" +config.llvm_src_root = "@LLVM_SOURCE_DIR@" +config.llvm_obj_root = "@LLVM_BINARY_DIR@" +config.llvm_tools_dir = "@LLVM_TOOLS_DIR@" +config.llvm_libs_dir = "@LLVM_LIBS_DIR@" +config.llvm_build_mode = "@LLVM_BUILD_MODE@" +config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@" +config.lldb_obj_root = "@LLDB_BINARY_DIR@" +config.lldb_src_root = "@LLDB_SOURCE_DIR@" +config.target_triple = "@TARGET_TRIPLE@" +config.python_executable = "@PYTHON_EXECUTABLE@" + +# Support substitution of the tools and libs dirs with user parameters. This is +# used when we can't determine the tool dir at configuration time. +try: + config.llvm_tools_dir = config.llvm_tools_dir % lit_config.params + config.llvm_libs_dir = config.llvm_libs_dir % lit_config.params + config.llvm_build_mode = config.llvm_build_mode % lit_config.params +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.py") Index: lit/lit.cfg =================================================================== --- lit/lit.cfg +++ 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() Index: lit/lit.cfg.py =================================================================== --- lit/lit.cfg.py +++ lit/lit.cfg.py @@ -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) + ]) Index: lit/lit.site.cfg.in =================================================================== --- lit/lit.site.cfg.in +++ lit/lit.site.cfg.in @@ -1,32 +0,0 @@ -@LIT_SITE_CFG_IN_HEADER@ - -config.llvm_src_root = "@LLVM_SOURCE_DIR@" -config.llvm_obj_root = "@LLVM_BINARY_DIR@" -config.llvm_tools_dir = "@LLVM_TOOLS_DIR@" -config.llvm_libs_dir = "@LLVM_LIBS_DIR@" -config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@" -config.lldb_obj_root = "@LLDB_BINARY_DIR@" -config.lldb_libs_dir = "@LLDB_LIBS_DIR@" -config.lldb_tools_dir = "@LLDB_TOOLS_DIR@" -config.target_triple = "@TARGET_TRIPLE@" -config.python_executable = "@PYTHON_EXECUTABLE@" -config.cc = "@LLDB_TEST_C_COMPILER@" -config.cxx = "@LLDB_TEST_CXX_COMPILER@" -config.have_zlib = @LLVM_ENABLE_ZLIB@ -config.have_lld = @LLDB_HAVE_LLD@ - -# Support substitution of the tools and libs dirs with user parameters. This is -# used when we can't determine the tool dir at configuration time. -try: - config.llvm_tools_dir = config.llvm_tools_dir % lit_config.params - config.llvm_libs_dir = config.llvm_libs_dir % lit_config.params - config.lldb_libs_dir = config.lldb_libs_dir % lit_config.params - config.lldb_tools_dir = config.lldb_tools_dir % lit_config.params - config.cc = config.cc % lit_config.params - config.cxx = config.cxx % lit_config.params -except KeyError as e: - key, = e.args - 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") Index: lit/lit.site.cfg.py.in =================================================================== --- lit/lit.site.cfg.py.in +++ lit/lit.site.cfg.py.in @@ -0,0 +1,32 @@ +@LIT_SITE_CFG_IN_HEADER@ + +config.llvm_src_root = "@LLVM_SOURCE_DIR@" +config.llvm_obj_root = "@LLVM_BINARY_DIR@" +config.llvm_tools_dir = "@LLVM_TOOLS_DIR@" +config.llvm_libs_dir = "@LLVM_LIBS_DIR@" +config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@" +config.lldb_obj_root = "@LLDB_BINARY_DIR@" +config.lldb_libs_dir = "@LLDB_LIBS_DIR@" +config.lldb_tools_dir = "@LLDB_TOOLS_DIR@" +config.target_triple = "@TARGET_TRIPLE@" +config.python_executable = "@PYTHON_EXECUTABLE@" +config.cc = "@LLDB_TEST_C_COMPILER@" +config.cxx = "@LLDB_TEST_CXX_COMPILER@" +config.have_zlib = @LLVM_ENABLE_ZLIB@ +config.have_lld = @LLDB_HAVE_LLD@ + +# Support substitution of the tools and libs dirs with user parameters. This is +# used when we can't determine the tool dir at configuration time. +try: + config.llvm_tools_dir = config.llvm_tools_dir % lit_config.params + config.llvm_libs_dir = config.llvm_libs_dir % lit_config.params + config.lldb_libs_dir = config.lldb_libs_dir % lit_config.params + config.lldb_tools_dir = config.lldb_tools_dir % lit_config.params + config.cc = config.cc % lit_config.params + config.cxx = config.cxx % lit_config.params +except KeyError as e: + key, = e.args + 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.py") Index: lit/tools/lldb-mi/breakpoint/break-insert-enable-pending.test =================================================================== --- lit/tools/lldb-mi/breakpoint/break-insert-enable-pending.test +++ lit/tools/lldb-mi/breakpoint/break-insert-enable-pending.test @@ -1,4 +1,4 @@ -# XFAIL: windows +# XFAIL: system-windows # -> llvm.org/pr24452 # # RUN: %cc -o %t %p/inputs/break-insert-pending.c -g Index: lit/tools/lldb-mi/breakpoint/break-insert.test =================================================================== --- lit/tools/lldb-mi/breakpoint/break-insert.test +++ lit/tools/lldb-mi/breakpoint/break-insert.test @@ -1,4 +1,4 @@ -# XFAIL: windows +# XFAIL: system-windows # -> llvm.org/pr24452 # # RUN: %cc -o a.exe %p/inputs/break-insert.c -g Index: lit/tools/lldb-mi/data/data-info-line.test =================================================================== --- lit/tools/lldb-mi/data/data-info-line.test +++ lit/tools/lldb-mi/data/data-info-line.test @@ -1,4 +1,4 @@ -# XFAIL: windows +# XFAIL: system-windows # -> llvm.org/pr24452 # # RUN: %cc -o %t %p/inputs/data-info-line.c -g Index: lit/tools/lldb-mi/exec/exec-continue.test =================================================================== --- lit/tools/lldb-mi/exec/exec-continue.test +++ lit/tools/lldb-mi/exec/exec-continue.test @@ -1,4 +1,4 @@ -# XFAIL: windows +# XFAIL: system-windows # -> llvm.org/pr24452 # # RUN: %cc -o %t %p/inputs/main.c -g Index: lit/tools/lldb-mi/exec/exec-finish.test =================================================================== --- lit/tools/lldb-mi/exec/exec-finish.test +++ lit/tools/lldb-mi/exec/exec-finish.test @@ -1,4 +1,4 @@ -# XFAIL: windows +# XFAIL: system-windows # -> llvm.org/pr24452 # # RUN: %cc -o %t %p/inputs/main.c -g Index: lit/tools/lldb-mi/exec/exec-interrupt.test =================================================================== --- lit/tools/lldb-mi/exec/exec-interrupt.test +++ lit/tools/lldb-mi/exec/exec-interrupt.test @@ -1,4 +1,4 @@ -# XFAIL: windows +# XFAIL: system-windows # -> llvm.org/pr24452 # # RUN: %cc -o %t %p/inputs/main.c -g Index: lit/tools/lldb-mi/exec/exec-next-instruction.test =================================================================== --- lit/tools/lldb-mi/exec/exec-next-instruction.test +++ lit/tools/lldb-mi/exec/exec-next-instruction.test @@ -1,4 +1,4 @@ -# XFAIL: windows +# XFAIL: system-windows # -> llvm.org/pr24452 # # RUN: %cc -o %t %p/inputs/main.c -g Index: lit/tools/lldb-mi/exec/exec-next.test =================================================================== --- lit/tools/lldb-mi/exec/exec-next.test +++ lit/tools/lldb-mi/exec/exec-next.test @@ -1,4 +1,4 @@ -# XFAIL: windows +# XFAIL: system-windows # -> llvm.org/pr24452 # # RUN: %cc -o %t %p/inputs/main.c -g Index: lit/tools/lldb-mi/exec/exec-step-instruction.test =================================================================== --- lit/tools/lldb-mi/exec/exec-step-instruction.test +++ lit/tools/lldb-mi/exec/exec-step-instruction.test @@ -1,4 +1,4 @@ -# XFAIL: windows +# XFAIL: system-windows # -> llvm.org/pr24452 # # RUN: %cc -o %t %p/inputs/main.c -g Index: lit/tools/lldb-mi/exec/exec-step.test =================================================================== --- lit/tools/lldb-mi/exec/exec-step.test +++ lit/tools/lldb-mi/exec/exec-step.test @@ -1,4 +1,4 @@ -# XFAIL: windows +# XFAIL: system-windows # -> llvm.org/pr24452 # # RUN: %cc -o %t %p/inputs/main.c -g Index: lit/tools/lldb-mi/symbol/symbol-list-lines.test =================================================================== --- lit/tools/lldb-mi/symbol/symbol-list-lines.test +++ lit/tools/lldb-mi/symbol/symbol-list-lines.test @@ -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