blob: 9f64fd3d2ffa205ae88eae57430f59e69ad2a9b3 [file] [log] [blame]
Chandler Carruthc5062dc2012-08-07 07:09:141# -*- Python -*-
2
3import os
Sam McCall7f0df312022-03-10 22:57:054import shlex
Chandler Carruthc5062dc2012-08-07 07:09:145
Daniel Dunbar4d0a3ef2013-08-09 18:49:226import lit.formats
Chandler Carruthc5062dc2012-08-07 07:09:147
Sam McCall69924cc2022-03-10 22:09:468from lit.llvm import llvm_config
9
Chandler Carruthc5062dc2012-08-07 07:09:1410# Configuration file for the 'lit' test runner.
11
Chandler Carruth074a3562013-03-07 10:09:4712# name: The name of this test suite.
Tobias Hietadd3c26a2023-05-17 08:56:4913config.name = "Clang Tools"
Chandler Carruth074a3562013-03-07 10:09:4714
Chandler Carruthc5062dc2012-08-07 07:09:1415# testFormat: The test format to use to interpret tests.
Sam McCall69924cc2022-03-10 22:09:4616config.test_format = lit.formats.ShTest(not llvm_config.use_lit_shell)
Chandler Carruthc5062dc2012-08-07 07:09:1417
18# suffixes: A list of file extensions to treat as test files.
Tobias Hietadd3c26a2023-05-17 08:56:4919config.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]
Chandler Carruthc5062dc2012-08-07 07:09:1433
Edwin Vane9f7a1c12013-08-22 19:44:0734# Test-time dependencies located in directories called 'Inputs' are excluded
35# from test suites; there won't be any lit tests within them.
Tobias Hietadd3c26a2023-05-17 08:56:4936config.excludes = ["Inputs"]
Edwin Vane9f7a1c12013-08-22 19:44:0737
Chandler Carruth074a3562013-03-07 10:09:4738# 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.
Tobias Hietadd3c26a2023-05-17 08:56:4942config.test_exec_root = os.path.join(config.clang_tools_binary_dir, "test")
Chandler Carruth074a3562013-03-07 10:09:4743
Sam McCall2b69eb42022-03-10 23:29:1044# Tools need the same environment setup as clang (we don't need clang itself).
Tobias Hietadd3c26a2023-05-17 08:56:4945llvm_config.use_clang(required=False)
David Blaikied7086fb2012-09-04 22:23:3746
Nico Weber33c9dbb2020-09-03 23:37:2947if config.clang_tidy_staticanalyzer:
Tobias Hietadd3c26a2023-05-17 08:56:4948 config.available_features.add("static-analyzer")
Stephen Kellya3c42062018-10-01 20:24:2249
Sam McCall7f0df312022-03-10 22:57:0550python_exec = shlex.quote(config.python_executable)
Stephen Kellya3c42062018-10-01 20:24:2251check_clang_tidy = os.path.join(
Tobias Hietadd3c26a2023-05-17 08:56:4952 config.test_source_root, "clang-tidy", "check_clang_tidy.py"
53)
Stephen Kellya3c42062018-10-01 20:24:2254config.substitutions.append(
Tobias Hietadd3c26a2023-05-17 08:56:4955 ("%check_clang_tidy", "%s %s" % (python_exec, check_clang_tidy))
56)
Stephen Kellya3c42062018-10-01 20:24:2257clang_tidy_diff = os.path.join(
Tobias Hietadd3c26a2023-05-17 08:56:4958 config.test_source_root, "..", "clang-tidy", "tool", "clang-tidy-diff.py"
59)
Stephen Kellya3c42062018-10-01 20:24:2260config.substitutions.append(
Tobias Hietadd3c26a2023-05-17 08:56:4961 ("%clang_tidy_diff", "%s %s" % (python_exec, clang_tidy_diff))
62)
Stephen Kellya3c42062018-10-01 20:24:2263run_clang_tidy = os.path.join(
Tobias Hietadd3c26a2023-05-17 08:56:4964 config.test_source_root, "..", "clang-tidy", "tool", "run-clang-tidy.py"
65)
Stephen Kellya3c42062018-10-01 20:24:2266config.substitutions.append(
Tobias Hietadd3c26a2023-05-17 08:56:4967 ("%run_clang_tidy", "%s %s" % (python_exec, run_clang_tidy))
68)
Richard89a1d032022-06-17 01:02:4769clang_tidy_headers = os.path.join(
Tobias Hietadd3c26a2023-05-17 08:56:4970 config.test_source_root, "clang-tidy", "checkers", "Inputs", "Headers"
71)
72config.substitutions.append(("%clang_tidy_headers", clang_tidy_headers))
Kirill Bobyrev73c201d2018-09-12 07:49:4473
Jameson Nash84f137a2022-02-01 17:05:2074# Plugins (loadable modules)
75if config.has_plugins and config.llvm_plugin_ext:
Tobias Hietadd3c26a2023-05-17 08:56:4976 config.available_features.add("plugins")
Michał Górny52ce6772022-10-04 14:36:1577
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"