1*7c3d14c8STreehugger Robot# -*- Python -*- 2*7c3d14c8STreehugger Robot 3*7c3d14c8STreehugger Robotimport os 4*7c3d14c8STreehugger Robot 5*7c3d14c8STreehugger Robot# Setup config name. 6*7c3d14c8STreehugger Robotconfig.name = 'MemorySanitizer' + getattr(config, 'name_suffix', 'default') 7*7c3d14c8STreehugger Robot 8*7c3d14c8STreehugger Robot# Setup source root. 9*7c3d14c8STreehugger Robotconfig.test_source_root = os.path.dirname(__file__) 10*7c3d14c8STreehugger Robot 11*7c3d14c8STreehugger Robot# Setup default compiler flags used with -fsanitize=memory option. 12*7c3d14c8STreehugger Robotclang_msan_cflags = (["-fsanitize=memory", 13*7c3d14c8STreehugger Robot "-mno-omit-leaf-frame-pointer", 14*7c3d14c8STreehugger Robot "-fno-omit-frame-pointer", 15*7c3d14c8STreehugger Robot "-fno-optimize-sibling-calls"] + 16*7c3d14c8STreehugger Robot [config.target_cflags] + 17*7c3d14c8STreehugger Robot config.debug_info_flags) 18*7c3d14c8STreehugger Robot# Some Msan tests leverage backtrace() which requires libexecinfo on FreeBSD. 19*7c3d14c8STreehugger Robotif config.host_os == 'FreeBSD': 20*7c3d14c8STreehugger Robot clang_msan_cflags += ["-lexecinfo"] 21*7c3d14c8STreehugger Robotclang_msan_cxxflags = config.cxx_mode_flags + clang_msan_cflags 22*7c3d14c8STreehugger Robot 23*7c3d14c8STreehugger Robotdef build_invocation(compile_flags): 24*7c3d14c8STreehugger Robot return " " + " ".join([config.clang] + compile_flags) + " " 25*7c3d14c8STreehugger Robot 26*7c3d14c8STreehugger Robotconfig.substitutions.append( ("%clang_msan ", build_invocation(clang_msan_cflags)) ) 27*7c3d14c8STreehugger Robotconfig.substitutions.append( ("%clangxx_msan ", build_invocation(clang_msan_cxxflags)) ) 28*7c3d14c8STreehugger Robot 29*7c3d14c8STreehugger Robot# Default test suffixes. 30*7c3d14c8STreehugger Robotconfig.suffixes = ['.c', '.cc', '.cpp'] 31*7c3d14c8STreehugger Robot 32*7c3d14c8STreehugger Robot# MemorySanitizer tests are currently supported on Linux only. 33*7c3d14c8STreehugger Robotif config.host_os not in ['Linux']: 34*7c3d14c8STreehugger Robot config.unsupported = True 35*7c3d14c8STreehugger Robot 36*7c3d14c8STreehugger Robotif config.target_arch != 'aarch64': 37*7c3d14c8STreehugger Robot config.available_features.add('stable-runtime') 38