xref: /llvm-project/compiler-rt/test/dfsan/lit.cfg.py (revision 280d163887eade88bb9c2c300337b0bc414d6301)
1# -*- Python -*-
2
3import os
4
5# Setup config name.
6config.name = "DataFlowSanitizer" + config.name_suffix
7
8# Setup source root.
9config.test_source_root = os.path.dirname(__file__)
10
11# Setup default compiler flags used with -fsanitize=dataflow option.
12clang_dfsan_cflags = ["-fsanitize=dataflow"] + [config.target_cflags]
13
14clang_dfsan_cxxflags = config.cxx_mode_flags + clang_dfsan_cflags
15
16
17def build_invocation(compile_flags):
18    return " " + " ".join([config.clang] + compile_flags) + " "
19
20
21config.substitutions.append(("%clang_dfsan ", build_invocation(clang_dfsan_cflags)))
22config.substitutions.append(("%clangxx_dfsan ", build_invocation(clang_dfsan_cxxflags)))
23
24# Default test suffixes.
25config.suffixes = [".c", ".cpp"]
26
27# DataFlowSanitizer tests are currently supported on Linux only.
28if not (config.host_os in ["Linux"] and config.target_arch in ["aarch64", "x86_64", "loongarch64"]):
29    config.unsupported = True
30