Home | History | Annotate | Download | only in msan
      1 # -*- Python -*-
      2 
      3 import os
      4 
      5 # Setup config name.
      6 config.name = 'MemorySanitizer' + 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_msan_cflags = (["-fsanitize=memory",
     13                       "-mno-omit-leaf-frame-pointer",
     14                       "-fno-omit-frame-pointer",
     15                       "-fno-optimize-sibling-calls"] +
     16                       [config.target_cflags] +
     17                       config.debug_info_flags)
     18 # Some Msan tests leverage backtrace() which requires libexecinfo on FreeBSD.
     19 if config.host_os == 'FreeBSD':
     20   clang_msan_cflags += ["-lexecinfo"]
     21 clang_msan_cxxflags = config.cxx_mode_flags + clang_msan_cflags
     22 
     23 def build_invocation(compile_flags):
     24   return " " + " ".join([config.clang] + compile_flags) + " "
     25 
     26 config.substitutions.append( ("%clang_msan ", build_invocation(clang_msan_cflags)) )
     27 config.substitutions.append( ("%clangxx_msan ", build_invocation(clang_msan_cxxflags)) )
     28 
     29 # Default test suffixes.
     30 config.suffixes = ['.c', '.cc', '.cpp']
     31 
     32 # MemorySanitizer tests are currently supported on Linux only.
     33 if config.host_os not in ['Linux']:
     34   config.unsupported = True
     35 
     36 if config.target_arch != 'aarch64':
     37   config.available_features.add('stable-runtime')
     38