[docs] Fix build-docs.sh
[llvm-project.git] / compiler-rt / test / scudo / lit.cfg.py
blob236d645f3b940bf62467110b8fb75130bfb4d222
1 # -*- Python -*-
3 import os
5 # Setup config name.
6 config.name = 'Scudo' + config.name_suffix
8 # Setup source root.
9 config.test_source_root = os.path.dirname(__file__)
11 # Path to the shared library
12 shared_libscudo = os.path.join(config.compiler_rt_libdir, "libclang_rt.scudo%s.so" % config.target_suffix)
13 shared_minlibscudo = os.path.join(config.compiler_rt_libdir, "libclang_rt.scudo_minimal%s.so" % config.target_suffix)
15 # Test suffixes.
16 config.suffixes = ['.c', '.cpp', '.test']
18 # C & CXX flags.
19 c_flags = ([config.target_cflags] +
20 ["-pthread",
21 "-fPIE",
22 "-pie",
23 "-O0",
24 "-UNDEBUG",
25 "-ldl",
26 "-Wl,--gc-sections"])
28 # Android doesn't want -lrt.
29 if not config.android:
30 c_flags += ["-lrt"]
32 cxx_flags = (c_flags + config.cxx_mode_flags + ["-std=c++11"])
34 scudo_flags = ["-fsanitize=scudo"]
36 def build_invocation(compile_flags):
37 return " " + " ".join([config.clang] + compile_flags) + " "
39 # Add substitutions.
40 config.substitutions.append(("%clang ", build_invocation(c_flags)))
41 config.substitutions.append(("%clang_scudo ", build_invocation(c_flags + scudo_flags)))
42 config.substitutions.append(("%clangxx_scudo ", build_invocation(cxx_flags + scudo_flags)))
43 config.substitutions.append(("%shared_libscudo", shared_libscudo))
44 config.substitutions.append(("%shared_minlibscudo", shared_minlibscudo))
46 # Platform-specific default SCUDO_OPTIONS for lit tests.
47 default_scudo_opts = ''
48 if config.android:
49 # Android defaults to abort_on_error=1, which doesn't work for us.
50 default_scudo_opts = 'abort_on_error=0'
52 # Disable GWP-ASan for scudo internal tests.
53 if config.gwp_asan:
54 config.environment['GWP_ASAN_OPTIONS'] = 'Enabled=0'
56 if default_scudo_opts:
57 config.environment['SCUDO_OPTIONS'] = default_scudo_opts
58 default_scudo_opts += ':'
59 config.substitutions.append(('%env_scudo_opts=',
60 'env SCUDO_OPTIONS=' + default_scudo_opts))
62 # Hardened Allocator tests are currently supported on Linux only.
63 if config.host_os not in ['Linux']:
64 config.unsupported = True