• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# -*- Python -*-
2
3import os
4
5# Setup config name.
6config.name = 'MemorySanitizer'
7
8# Setup source root.
9config.test_source_root = os.path.dirname(__file__)
10
11# Setup default compiler flags used with -fsanitize=memory option.
12clang_msan_cflags = ["-fsanitize=memory",
13                     "-mno-omit-leaf-frame-pointer",
14                     "-fno-omit-frame-pointer",
15                     "-fno-optimize-sibling-calls",
16                     "-m64"] + config.debug_info_flags
17# Some Msan tests leverage backtrace() which requires libexecinfo on FreeBSD.
18if config.host_os == 'FreeBSD':
19  clang_msan_cflags += ["-lexecinfo"]
20clang_msan_cxxflags = config.cxx_mode_flags + clang_msan_cflags
21
22def build_invocation(compile_flags):
23  return " " + " ".join([config.clang] + compile_flags) + " "
24
25config.substitutions.append( ("%clang_msan ", build_invocation(clang_msan_cflags)) )
26config.substitutions.append( ("%clangxx_msan ", build_invocation(clang_msan_cxxflags)) )
27
28# Default test suffixes.
29config.suffixes = ['.c', '.cc', '.cpp']
30
31# MemorySanitizer tests are currently supported on Linux only.
32if config.host_os not in ['Linux']:
33  config.unsupported = True
34