1 # -*- Python -*- 2 3 import os 4 5 def get_required_attr(config, attr_name): 6 attr_value = getattr(config, attr_name, None) 7 if not attr_value: 8 lit.fatal("No attribute %r in test configuration! You may need to run " 9 "tests from your build directory or add this attribute " 10 "to lit.site.cfg " % attr_name) 11 return attr_value 12 13 lsan_lit_src_root = get_required_attr(config, "lsan_lit_src_root") 14 lsan_lit_cfg = os.path.join(lsan_lit_src_root, "lit.common.cfg") 15 if not os.path.exists(lsan_lit_cfg): 16 lit.fatal("Can't find common LSan lit config at: %r" % lsan_lit_cfg) 17 lit.load_config(config, lsan_lit_cfg) 18 19 config.name = 'LeakSanitizer-Standalone' 20 21 clang_lsan_cxxflags = config.clang_cxxflags + " -fsanitize=leak " 22 23 config.substitutions.append( ("%clangxx_lsan ", (" " + config.clang + " " + 24 clang_lsan_cxxflags + " ")) ) 25 26 config.environment['LSAN_SYMBOLIZER_PATH'] = config.llvm_symbolizer_path 27