Index: debuginfo-tests/dexter-tests/lit.local.cfg =================================================================== --- /dev/null +++ debuginfo-tests/dexter-tests/lit.local.cfg @@ -0,0 +1,2 @@ +if 'dexter' not in config.available_features: + config.unsupported = True Index: debuginfo-tests/dexter/feature_tests/lit.local.cfg =================================================================== --- debuginfo-tests/dexter/feature_tests/lit.local.cfg +++ debuginfo-tests/dexter/feature_tests/lit.local.cfg @@ -1,2 +1,5 @@ +if 'dexter' not in config.available_features: + config.unsupported = True + config.name = "DExTer feature tests" config.suffixes = ['.cpp', '.c', '.test'] Index: debuginfo-tests/lit.cfg.py =================================================================== --- debuginfo-tests/lit.cfg.py +++ debuginfo-tests/lit.cfg.py @@ -83,9 +83,41 @@ # Propagate path to symbolizer for ASan/MSan. llvm_config.with_system_environment( ['ASAN_SYMBOLIZER_PATH', 'MSAN_SYMBOLIZER_PATH']) -llvm_config.with_environment('PATHTOCLANG', llvm_config.config.clang) -llvm_config.with_environment('PATHTOCLANGPP', llvm_config.use_llvm_tool('clang++')) -llvm_config.with_environment('PATHTOCLANGCL', llvm_config.use_llvm_tool('clang-cl')) + +def add_host_triple(clang): + return '{} --target={}'.format(clang, config.host_triple) + +# The set of arches we can build. +targets = set(config.targets_to_build) +# Add aliases to the target set. +if 'AArch64' in targets: + targets.add('arm64') +if 'ARM' in config.targets_to_build: + targets.add('thumbv7') + +def can_target_host(): + # Check if the targets set contains anything that looks like our host arch. + # The arch name in the triple and targets set may be spelled differently + # (e.g. x86 vs X86). + return any(config.host_triple.lower().startswith(x.lower()) + for x in targets) + +# Dexter tests run on the host machine. If the host arch is supported add +# 'dexter' as an available feature and force the dexter tests to use the host +# triple. +if can_target_host(): + config.available_features.add('dexter') + if config.host_triple != config.target_triple: + print('Forcing dexter tests to use host triple {}.'.format(config.host_triple)) + llvm_config.with_environment('PATHTOCLANG', + add_host_triple(llvm_config.config.clang)) + llvm_config.with_environment('PATHTOCLANGPP', + add_host_triple(llvm_config.use_llvm_tool('clang++'))) + llvm_config.with_environment('PATHTOCLANGCL', + add_host_triple(llvm_config.use_llvm_tool('clang-cl'))) +else: + print('Host triple {} not supported. Skipping dexter tests in the ' + 'debuginfo-tests project.'.format(config.host_triple)) # Check which debuggers are available: built_lldb = llvm_config.use_llvm_tool('lldb', search_env='CLANG') Index: debuginfo-tests/lit.site.cfg.py.in =================================================================== --- debuginfo-tests/lit.site.cfg.py.in +++ debuginfo-tests/lit.site.cfg.py.in @@ -4,7 +4,7 @@ import lit.util config.test_exec_root = "@CMAKE_BINARY_DIR@" - +config.targets_to_build = "@TARGETS_TO_BUILD@".split() config.llvm_src_root = "@LLVM_SOURCE_DIR@" config.llvm_obj_root = "@LLVM_BINARY_DIR@" config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"