Index: lldb/lit/Breakpoint/case-insensitive.test =================================================================== --- lldb/lit/Breakpoint/case-insensitive.test +++ lldb/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: lldb/lit/Breakpoint/lit.local.cfg =================================================================== --- lldb/lit/Breakpoint/lit.local.cfg +++ /dev/null @@ -1 +0,0 @@ -config.suffixes = ['.test'] Index: lldb/lit/CMakeLists.txt =================================================================== --- lldb/lit/CMakeLists.txt +++ lldb/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: lldb/lit/Expr/TestIRMemoryMapWindows.test =================================================================== --- lldb/lit/Expr/TestIRMemoryMapWindows.test +++ lldb/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: lldb/lit/Expr/lit.local.cfg =================================================================== --- lldb/lit/Expr/lit.local.cfg +++ /dev/null @@ -1 +0,0 @@ -config.suffixes = ['.test'] Index: lldb/lit/Quit/lit.local.cfg =================================================================== --- lldb/lit/Quit/lit.local.cfg +++ /dev/null @@ -1 +0,0 @@ -config.suffixes = ['.test'] Index: lldb/lit/Settings/lit.local.cfg =================================================================== --- lldb/lit/Settings/lit.local.cfg +++ /dev/null @@ -1 +0,0 @@ -config.suffixes = ['.test'] Index: lldb/lit/SymbolFile/NativePDB/lit.local.cfg =================================================================== --- lldb/lit/SymbolFile/NativePDB/lit.local.cfg +++ /dev/null @@ -1 +0,0 @@ -config.suffixes = ['.test', '.cpp'] Index: lldb/lit/SymbolFile/PDB/ast-restore.test =================================================================== --- lldb/lit/SymbolFile/PDB/ast-restore.test +++ lldb/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: lldb/lit/SymbolFile/PDB/calling-conventions.test =================================================================== --- lldb/lit/SymbolFile/PDB/calling-conventions.test +++ lldb/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: lldb/lit/SymbolFile/PDB/class-layout.test =================================================================== --- lldb/lit/SymbolFile/PDB/class-layout.test +++ lldb/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: lldb/lit/SymbolFile/PDB/compilands.test =================================================================== --- lldb/lit/SymbolFile/PDB/compilands.test +++ lldb/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: lldb/lit/SymbolFile/PDB/enums-layout.test =================================================================== --- lldb/lit/SymbolFile/PDB/enums-layout.test +++ lldb/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: lldb/lit/SymbolFile/PDB/func-symbols.test =================================================================== --- lldb/lit/SymbolFile/PDB/func-symbols.test +++ lldb/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: lldb/lit/SymbolFile/PDB/function-level-linking.test =================================================================== --- lldb/lit/SymbolFile/PDB/function-level-linking.test +++ lldb/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: lldb/lit/SymbolFile/PDB/function-nested-block.test =================================================================== --- lldb/lit/SymbolFile/PDB/function-nested-block.test +++ lldb/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: lldb/lit/SymbolFile/PDB/lit.local.cfg =================================================================== --- lldb/lit/SymbolFile/PDB/lit.local.cfg +++ /dev/null @@ -1 +0,0 @@ -config.suffixes = ['.test'] Index: lldb/lit/SymbolFile/PDB/pointers.test =================================================================== --- lldb/lit/SymbolFile/PDB/pointers.test +++ lldb/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: lldb/lit/SymbolFile/PDB/type-quals.test =================================================================== --- lldb/lit/SymbolFile/PDB/type-quals.test +++ lldb/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: lldb/lit/SymbolFile/PDB/typedefs.test =================================================================== --- lldb/lit/SymbolFile/PDB/typedefs.test +++ lldb/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: lldb/lit/SymbolFile/PDB/udt-layout.test =================================================================== --- lldb/lit/SymbolFile/PDB/udt-layout.test +++ lldb/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: lldb/lit/SymbolFile/PDB/variables-locations.test =================================================================== --- lldb/lit/SymbolFile/PDB/variables-locations.test +++ lldb/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: lldb/lit/SymbolFile/PDB/variables.test =================================================================== --- lldb/lit/SymbolFile/PDB/variables.test +++ lldb/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: lldb/lit/Unit/lit.cfg.py =================================================================== --- lldb/lit/Unit/lit.cfg.py +++ lldb/lit/Unit/lit.cfg.py @@ -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.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: lldb/lit/Unit/lit.site.cfg.py.in =================================================================== --- lldb/lit/Unit/lit.site.cfg.py.in +++ lldb/lit/Unit/lit.site.cfg.py.in @@ -22,5 +22,8 @@ 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") Index: lldb/lit/lit.cfg =================================================================== --- lldb/lit/lit.cfg +++ /dev/null @@ -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: lldb/lit/lit.cfg.py =================================================================== --- /dev/null +++ lldb/lit/lit.cfg.py @@ -0,0 +1,130 @@ +# -*- 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): + features = [] + for arch in arch_string.split(): + features.append(arch.lower() + '-registered-target') + return features + +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 + +llvm_config.feature_config( + [('--assertion-mode', {'ON': 'asserts'}), + ('--build-mode', {'DEBUG': 'debug'}), + ('--targets-built', calculate_arch_features) + ]) Index: lldb/lit/lit.site.cfg.py.in =================================================================== --- lldb/lit/lit.site.cfg.py.in +++ lldb/lit/lit.site.cfg.py.in @@ -29,4 +29,4 @@ 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") Index: lldb/lit/tools/lldb-mi/breakpoint/break-insert-enable-pending.test =================================================================== --- lldb/lit/tools/lldb-mi/breakpoint/break-insert-enable-pending.test +++ lldb/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: lldb/lit/tools/lldb-mi/breakpoint/break-insert.test =================================================================== --- lldb/lit/tools/lldb-mi/breakpoint/break-insert.test +++ lldb/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: lldb/lit/tools/lldb-mi/data/data-info-line.test =================================================================== --- lldb/lit/tools/lldb-mi/data/data-info-line.test +++ lldb/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: lldb/lit/tools/lldb-mi/exec/exec-continue.test =================================================================== --- lldb/lit/tools/lldb-mi/exec/exec-continue.test +++ lldb/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: lldb/lit/tools/lldb-mi/exec/exec-finish.test =================================================================== --- lldb/lit/tools/lldb-mi/exec/exec-finish.test +++ lldb/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: lldb/lit/tools/lldb-mi/exec/exec-interrupt.test =================================================================== --- lldb/lit/tools/lldb-mi/exec/exec-interrupt.test +++ lldb/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: lldb/lit/tools/lldb-mi/exec/exec-next-instruction.test =================================================================== --- lldb/lit/tools/lldb-mi/exec/exec-next-instruction.test +++ lldb/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: lldb/lit/tools/lldb-mi/exec/exec-next.test =================================================================== --- lldb/lit/tools/lldb-mi/exec/exec-next.test +++ lldb/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: lldb/lit/tools/lldb-mi/exec/exec-step-instruction.test =================================================================== --- lldb/lit/tools/lldb-mi/exec/exec-step-instruction.test +++ lldb/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: lldb/lit/tools/lldb-mi/exec/exec-step.test =================================================================== --- lldb/lit/tools/lldb-mi/exec/exec-step.test +++ lldb/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: lldb/lit/tools/lldb-mi/symbol/symbol-list-lines.test =================================================================== --- lldb/lit/tools/lldb-mi/symbol/symbol-list-lines.test +++ lldb/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 Index: llvm/utils/lit/lit/llvm/config.py =================================================================== --- llvm/utils/lit/lit/llvm/config.py +++ llvm/utils/lit/lit/llvm/config.py @@ -55,6 +55,8 @@ 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