[clang-format] Handle C-style cast of member function pointer type (#126340)
[llvm-project.git] / compiler-rt / test / rtsan / lit.cfg.py
blob7c75515a7608d08f872ef2a15b7f3967cd460666
1 import os
3 # Setup config name.
4 config.name = "RTSAN" + config.name_suffix
7 default_rtsan_opts = "atexit_sleep_ms=0"
9 if config.host_os == "Darwin":
10 # On Darwin, we default to `abort_on_error=1`, which would make tests run
11 # much slower. Let's override this and run lit tests with 'abort_on_error=0'.
12 default_rtsan_opts += ":abort_on_error=0"
14 if default_rtsan_opts:
15 config.environment["RTSAN_OPTIONS"] = default_rtsan_opts
16 default_rtsan_opts += ":"
18 config.substitutions.append(
19 ("%env_rtsan_opts=", "env RTSAN_OPTIONS=" + default_rtsan_opts)
22 # Setup source root.
23 config.test_source_root = os.path.dirname(__file__)
25 # Setup default compiler flags use with -frtsan-instrument option.
26 clang_rtsan_cflags = ["-frtsan-instrument", config.target_cflags]
28 clang_rtsan_cxxflags = config.cxx_mode_flags + clang_rtsan_cflags
31 def build_invocation(compile_flags):
32 return " " + " ".join([config.clang] + compile_flags) + " "
35 # Assume that llvm-rtsan is in the config.llvm_tools_dir.
36 llvm_rtsan = os.path.join(config.llvm_tools_dir, "llvm-rtsan")
38 # Setup substitutions.
39 if config.host_os == "Linux":
40 libdl_flag = "-ldl"
41 else:
42 libdl_flag = ""
44 config.substitutions.append(("%clang ", build_invocation([config.target_cflags])))
45 config.substitutions.append(
46 ("%clangxx ", build_invocation(config.cxx_mode_flags + [config.target_cflags]))
48 config.substitutions.append(("%clang_rtsan ", build_invocation(clang_rtsan_cflags)))
49 config.substitutions.append(("%clangxx_rtsan", build_invocation(clang_rtsan_cxxflags)))
50 config.substitutions.append(("%llvm_rtsan", llvm_rtsan))
52 # Default test suffixes.
53 config.suffixes = [".c", ".cpp"]
55 if config.host_os not in ["Darwin", "FreeBSD", "Linux", "NetBSD", "OpenBSD"]:
56 config.unsupported = True
57 elif "64" not in config.host_arch:
58 if "arm" in config.host_arch:
59 if "-mthumb" in config.target_cflags:
60 config.unsupported = True
61 else:
62 config.unsupported = True
64 if config.host_os == "NetBSD":
65 config.substitutions.insert(0, ("%run", config.netbsd_nomprotect_prefix))