llvm-project

Форк
0
/
lit.cfg.py 
140 строк · 4.2 Кб
1
# -*- Python -*-
2

3
import os
4
import platform
5
import re
6
import subprocess
7
import tempfile
8

9
import lit.formats
10
import lit.util
11

12
from lit.llvm import llvm_config
13
from lit.llvm.subst import ToolSubst
14
from lit.llvm.subst import FindTool
15

16
# Configuration file for the 'lit' test runner.
17

18
# name: The name of this test suite.
19
config.name = "BOLT"
20

21
# testFormat: The test format to use to interpret tests.
22
#
23
# For now we require '&&' between commands, until they get globally killed and
24
# the test runner updated.
25
config.test_format = lit.formats.ShTest(not llvm_config.use_lit_shell)
26

27
# suffixes: A list of file extensions to treat as test files.
28
config.suffixes = [
29
    ".c",
30
    ".cpp",
31
    ".cppm",
32
    ".m",
33
    ".mm",
34
    ".cu",
35
    ".ll",
36
    ".cl",
37
    ".s",
38
    ".S",
39
    ".modulemap",
40
    ".test",
41
    ".rs",
42
]
43

44
# excludes: A list of directories to exclude from the testsuite. The 'Inputs'
45
# subdirectories contain auxiliary inputs for various tests in their parent
46
# directories.
47
config.excludes = ["Inputs", "CMakeLists.txt", "README.txt", "LICENSE.txt"]
48

49
# test_source_root: The root path where tests are located.
50
config.test_source_root = os.path.dirname(__file__)
51

52
# test_exec_root: The root path where tests should be run.
53
config.test_exec_root = os.path.join(config.bolt_obj_root, "test")
54

55
# checking if maxIndividualTestTime is available on the platform and sets
56
# it to 60sec if so, declares lit-max-individual-test-time feature for
57
# further checking by tests.
58
supported, errormsg = lit_config.maxIndividualTestTimeIsSupported
59
if supported:
60
    config.available_features.add("lit-max-individual-test-time")
61
    lit_config.maxIndividualTestTime = 60
62
else:
63
    lit_config.warning(
64
        "Setting a timeout per test not supported. "
65
        + errormsg
66
        + " Some tests will be skipped."
67
    )
68

69
if config.bolt_enable_runtime:
70
    config.available_features.add("bolt-runtime")
71

72
if config.gnu_ld:
73
    config.available_features.add("gnu_ld")
74

75
if lit.util.which("fuser"):
76
    config.available_features.add("fuser")
77

78
llvm_config.use_default_substitutions()
79

80
llvm_config.config.environment["CLANG"] = config.bolt_clang
81
llvm_config.use_clang()
82

83
llvm_config.config.environment["LD_LLD"] = config.bolt_lld
84
ld_lld = llvm_config.use_llvm_tool("ld.lld", required=True, search_env="LD_LLD")
85
llvm_config.config.available_features.add("ld.lld")
86
llvm_config.add_tool_substitutions([ToolSubst(r"ld\.lld", command=ld_lld)])
87

88
config.substitutions.append(("%cflags", ""))
89
config.substitutions.append(("%cxxflags", ""))
90

91
link_fdata_cmd = os.path.join(config.test_source_root, "link_fdata.py")
92

93
tool_dirs = [config.llvm_tools_dir, config.test_source_root]
94

95
tools = [
96
    ToolSubst("llc", unresolved="fatal"),
97
    ToolSubst("llvm-dwarfdump", unresolved="fatal"),
98
    ToolSubst("llvm-bolt", unresolved="fatal"),
99
    ToolSubst("llvm-boltdiff", unresolved="fatal"),
100
    ToolSubst("llvm-bolt-heatmap", unresolved="fatal"),
101
    ToolSubst("llvm-bat-dump", unresolved="fatal"),
102
    ToolSubst("perf2bolt", unresolved="fatal"),
103
    ToolSubst("yaml2obj", unresolved="fatal"),
104
    ToolSubst("llvm-mc", unresolved="fatal"),
105
    ToolSubst("llvm-nm", unresolved="fatal"),
106
    ToolSubst("llvm-objdump", unresolved="fatal"),
107
    ToolSubst("llvm-objcopy", unresolved="fatal"),
108
    ToolSubst("llvm-strings", unresolved="fatal"),
109
    ToolSubst("llvm-strip", unresolved="fatal"),
110
    ToolSubst("llvm-readelf", unresolved="fatal"),
111
    ToolSubst(
112
        "link_fdata",
113
        command=sys.executable,
114
        unresolved="fatal",
115
        extra_args=[link_fdata_cmd],
116
    ),
117
    ToolSubst("merge-fdata", unresolved="fatal"),
118
    ToolSubst("llvm-readobj", unresolved="fatal"),
119
    ToolSubst("llvm-dwp", unresolved="fatal"),
120
    ToolSubst("split-file", unresolved="fatal"),
121
]
122
llvm_config.add_tool_substitutions(tools, tool_dirs)
123

124

125
def calculate_arch_features(arch_string):
126
    features = []
127
    for arch in arch_string.split():
128
        features.append(arch.lower() + "-registered-target")
129
    return features
130

131

132
llvm_config.feature_config(
133
    [
134
        ("--assertion-mode", {"ON": "asserts"}),
135
        ("--cxxflags", {r"-D_GLIBCXX_DEBUG\b": "libstdcxx-safe-mode"}),
136
        ("--targets-built", calculate_arch_features),
137
    ]
138
)
139

140
config.targets = frozenset(config.targets_to_build.split(";"))
141

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.