| 1 |
# -*- Python -*- |
| 2 |
|
| 3 |
import os |
| 4 |
import shlex |
| 5 |
|
| 6 |
import lit.formats |
| 7 |
|
| 8 |
from lit.llvm import llvm_config |
| 9 |
|
| 10 |
# Configuration file for the 'lit' test runner. |
| 11 |
|
| 12 |
# name: The name of this test suite. |
| 13 |
config.name = "Clang Tools" |
| 14 |
|
| 15 |
# testFormat: The test format to use to interpret tests. |
| 16 |
config.test_format = lit.formats.ShTest(not llvm_config.use_lit_shell) |
| 17 |
|
| 18 |
# suffixes: A list of file extensions to treat as test files. |
| 19 |
config.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. |
| 36 |
config.excludes = ["Inputs"] |
| 37 |
|
| 38 |
# test_source_root: The root path where tests are located. |
| 39 |
config.test_source_root = os.path.dirname(__file__) |
| 40 |
|
| 41 |
# test_exec_root: The root path where tests should be run. |
| 42 |
config.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). |
| 45 |
llvm_config.use_clang(required=False) |
| 46 |
|
| 47 |
if config.clang_tidy_staticanalyzer: |
| 48 |
config.available_features.add("static-analyzer") |
| 49 |
|
| 50 |
python_exec = shlex.quote(config.python_executable) |
| 51 |
check_clang_tidy = os.path.join( |
| 52 |
config.test_source_root, "clang-tidy", "check_clang_tidy.py" |
| 53 |
) |
| 54 |
config.substitutions.append( |
| 55 |
("%check_clang_tidy", "%s %s" % (python_exec, check_clang_tidy)) |
| 56 |
) |
| 57 |
clang_tidy_diff = os.path.join( |
| 58 |
config.test_source_root, "..", "clang-tidy", "tool", "clang-tidy-diff.py" |
| 59 |
) |
| 60 |
config.substitutions.append( |
| 61 |
("%clang_tidy_diff", "%s %s" % (python_exec, clang_tidy_diff)) |
| 62 |
) |
| 63 |
run_clang_tidy = os.path.join( |
| 64 |
config.test_source_root, "..", "clang-tidy", "tool", "run-clang-tidy.py" |
| 65 |
) |
| 66 |
config.substitutions.append( |
| 67 |
("%run_clang_tidy", "%s %s" % (python_exec, run_clang_tidy)) |
| 68 |
) |
| 69 |
clang_tidy_headers = os.path.join( |
| 70 |
config.test_source_root, "clang-tidy", "checkers", "Inputs", "Headers" |
| 71 |
) |
| 72 |
config.substitutions.append(("%clang_tidy_headers", clang_tidy_headers)) |
| 73 |
|
| 74 |
# Plugins (loadable modules) |
| 75 |
if config.has_plugins and config.llvm_plugin_ext: |
| 76 |
config.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. |
| 81 |
config.environment["CLANG_NO_DEFAULT_CONFIG"] = "1" |