Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / ubsan_minimal / lit.common.cfg.py
blobd398d3a0a81626e854718165f19e6ddda21816ea
1 # -*- Python -*-
3 import os
6 def get_required_attr(config, attr_name):
7 attr_value = getattr(config, attr_name, None)
8 if attr_value == None:
9 lit_config.fatal(
10 "No attribute %r in test configuration! You may need to run "
11 "tests from your build directory or add this attribute "
12 "to lit.site.cfg.py " % attr_name
14 return attr_value
17 # Setup source root.
18 config.test_source_root = os.path.dirname(__file__)
19 config.name = "UBSan-Minimal-" + config.target_arch
22 def build_invocation(compile_flags):
23 return " " + " ".join([config.clang] + compile_flags) + " "
26 target_cflags = [get_required_attr(config, "target_cflags")]
27 clang_ubsan_cflags = ["-fsanitize-minimal-runtime"] + target_cflags
28 clang_ubsan_cxxflags = config.cxx_mode_flags + clang_ubsan_cflags
30 # Define %clang and %clangxx substitutions to use in test RUN lines.
31 config.substitutions.append(("%clang ", build_invocation(clang_ubsan_cflags)))
32 config.substitutions.append(("%clangxx ", build_invocation(clang_ubsan_cxxflags)))
34 # Default test suffixes.
35 config.suffixes = [".c", ".cpp"]
37 # Check that the host supports UndefinedBehaviorSanitizerMinimal tests
38 if config.host_os not in [
39 "Linux",
40 "FreeBSD",
41 "NetBSD",
42 "Darwin",
43 "OpenBSD",
44 "SunOS",
45 ]: # TODO: Windows
46 config.unsupported = True
48 # Don't target x86_64h if the test machine can't execute x86_64h binaries.
49 if "-arch x86_64h" in target_cflags and "x86_64h" not in config.available_features:
50 config.unsupported = True