0f1fdbd1ee47002df80fa03fc487eefc58e07a11
[lldb.git] / compiler-rt / test / hwasan / lit.cfg
1 # -*- Python -*-
2
3 import os
4
5 # Setup config name.
6 config.name = 'HWAddressSanitizer' + getattr(config, 'name_suffix', 'default')
7
8 # Setup source root.
9 config.test_source_root = os.path.dirname(__file__)
10
11 # Setup default compiler flags used with -fsanitize=memory option.
12 clang_cflags = [config.target_cflags] + config.debug_info_flags
13 clang_cxxflags = config.cxx_mode_flags + clang_cflags
14 clang_hwasan_cflags = ["-fsanitize=hwaddress", "-mllvm", "-hwasan-generate-tags-with-calls",
15                        "-mllvm", "-hwasan-allow-ifunc"] + clang_cflags
16 clang_hwasan_cxxflags = config.cxx_mode_flags + clang_hwasan_cflags
17
18 def build_invocation(compile_flags):
19   return " " + " ".join([config.clang] + compile_flags) + " "
20
21 config.substitutions.append( ("%clangxx ", build_invocation(clang_cxxflags)) )
22 config.substitutions.append( ("%clang_hwasan ", build_invocation(clang_hwasan_cflags)) )
23 config.substitutions.append( ("%clangxx_hwasan ", build_invocation(clang_hwasan_cxxflags)) )
24 config.substitutions.append( ("%compiler_rt_libdir", config.compiler_rt_libdir) )
25
26 default_hwasan_opts_str = ':'.join(['disable_allocator_tagging=1', 'random_tags=0'] + config.default_sanitizer_opts)
27 if default_hwasan_opts_str:
28   config.environment['HWASAN_OPTIONS'] = default_hwasan_opts_str
29   default_hwasan_opts_str += ':'
30 config.substitutions.append(('%env_hwasan_opts=',
31                              'env HWASAN_OPTIONS=' + default_hwasan_opts_str))
32
33 # Default test suffixes.
34 config.suffixes = ['.c', '.cc', '.cpp']
35
36 if config.host_os not in ['Linux', 'Android']:
37   config.unsupported = True