91 lines · python
1# -*- Python -*-2 3import os4import shlex5 6import lit.formats7 8from lit.llvm import llvm_config9 10# Configuration file for the 'lit' test runner.11 12# name: The name of this test suite.13config.name = "Clang Tools"14 15# testFormat: The test format to use to interpret tests.16# We prefer the lit internal shell which provides a better user experience on17# failures and is faster unless the user explicitly disables it with18# LIT_USE_INTERNAL_SHELL=0 env var.19use_lit_shell = True20lit_shell_env = os.environ.get("LIT_USE_INTERNAL_SHELL")21if lit_shell_env:22 use_lit_shell = lit.util.pythonize_bool(lit_shell_env)23 24config.test_format = lit.formats.ShTest(not use_lit_shell)25 26# suffixes: A list of file extensions to treat as test files.27config.suffixes = [28 ".c",29 ".cpp",30 ".hpp",31 ".m",32 ".mm",33 ".cu",34 ".ll",35 ".cl",36 ".s",37 ".modularize",38 ".module-map-checker",39 ".test",40]41 42# Test-time dependencies located in directories called 'Inputs' are excluded43# from test suites; there won't be any lit tests within them.44config.excludes = ["Inputs"]45 46# test_source_root: The root path where tests are located.47config.test_source_root = os.path.dirname(__file__)48 49# test_exec_root: The root path where tests should be run.50config.test_exec_root = os.path.join(config.clang_tools_binary_dir, "test")51 52# Tools need the same environment setup as clang (we don't need clang itself).53llvm_config.clang_setup()54 55if config.clang_tidy_staticanalyzer:56 config.available_features.add("static-analyzer")57if config.clang_tidy_custom_check:58 config.available_features.add("custom-check")59python_exec = shlex.quote(config.python_executable)60check_clang_tidy = os.path.join(61 config.test_source_root, "clang-tidy", "check_clang_tidy.py"62)63config.substitutions.append(64 ("%check_clang_tidy", "%s %s" % (python_exec, check_clang_tidy))65)66clang_tidy_diff = os.path.join(67 config.test_source_root, "..", "clang-tidy", "tool", "clang-tidy-diff.py"68)69config.substitutions.append(70 ("%clang_tidy_diff", "%s %s" % (python_exec, clang_tidy_diff))71)72run_clang_tidy = os.path.join(73 config.test_source_root, "..", "clang-tidy", "tool", "run-clang-tidy.py"74)75config.substitutions.append(76 ("%run_clang_tidy", "%s %s" % (python_exec, run_clang_tidy))77)78clang_tidy_headers = os.path.join(79 config.test_source_root, "clang-tidy", "checkers", "Inputs", "Headers"80)81config.substitutions.append(("%clang_tidy_headers", clang_tidy_headers))82 83# Plugins (loadable modules)84if config.has_plugins and config.llvm_plugin_ext:85 config.available_features.add("plugins")86 87# It is not realistically possible to account for all options that could88# possibly be present in system and user configuration files, so disable89# default configs for the test runs.90config.environment["CLANG_NO_DEFAULT_CONFIG"] = "1"91