llvm-project
81 строка · 2.4 Кб
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.
16config.test_format = lit.formats.ShTest(not llvm_config.use_lit_shell)17
18# suffixes: A list of file extensions to treat as test files.
19config.suffixes = [20".c",21".cpp",22".hpp",23".m",24".mm",25".cu",26".ll",27".cl",28".s",29".modularize",30".module-map-checker",31".test",32]
33
34# Test-time dependencies located in directories called 'Inputs' are excluded
35# from test suites; there won't be any lit tests within them.
36config.excludes = ["Inputs"]37
38# test_source_root: The root path where tests are located.
39config.test_source_root = os.path.dirname(__file__)40
41# test_exec_root: The root path where tests should be run.
42config.test_exec_root = os.path.join(config.clang_tools_binary_dir, "test")43
44# Tools need the same environment setup as clang (we don't need clang itself).
45llvm_config.use_clang(required=False)46
47if config.clang_tidy_staticanalyzer:48config.available_features.add("static-analyzer")49
50python_exec = shlex.quote(config.python_executable)51check_clang_tidy = os.path.join(52config.test_source_root, "clang-tidy", "check_clang_tidy.py"53)
54config.substitutions.append(55("%check_clang_tidy", "%s %s" % (python_exec, check_clang_tidy))56)
57clang_tidy_diff = os.path.join(58config.test_source_root, "..", "clang-tidy", "tool", "clang-tidy-diff.py"59)
60config.substitutions.append(61("%clang_tidy_diff", "%s %s" % (python_exec, clang_tidy_diff))62)
63run_clang_tidy = os.path.join(64config.test_source_root, "..", "clang-tidy", "tool", "run-clang-tidy.py"65)
66config.substitutions.append(67("%run_clang_tidy", "%s %s" % (python_exec, run_clang_tidy))68)
69clang_tidy_headers = os.path.join(70config.test_source_root, "clang-tidy", "checkers", "Inputs", "Headers"71)
72config.substitutions.append(("%clang_tidy_headers", clang_tidy_headers))73
74# Plugins (loadable modules)
75if config.has_plugins and config.llvm_plugin_ext:76config.available_features.add("plugins")77
78# It is not realistically possible to account for all options that could
79# possibly be present in system and user configuration files, so disable
80# default configs for the test runs.
81config.environment["CLANG_NO_DEFAULT_CONFIG"] = "1"82