diff options
Diffstat (limited to 'lib/lsan/lit_tests/AsanConfig/lit.cfg')
-rw-r--r-- | lib/lsan/lit_tests/AsanConfig/lit.cfg | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/lsan/lit_tests/AsanConfig/lit.cfg b/lib/lsan/lit_tests/AsanConfig/lit.cfg new file mode 100644 index 000000000000..ae9198173ffc --- /dev/null +++ b/lib/lsan/lit_tests/AsanConfig/lit.cfg @@ -0,0 +1,32 @@ +# -*- Python -*- + +import os + +def get_required_attr(config, attr_name): + attr_value = getattr(config, attr_name, None) + if not attr_value: + lit_config.fatal( + "No attribute %r in test configuration! You may need to run " + "tests from your build directory or add this attribute " + "to lit.site.cfg " % attr_name) + return attr_value + +lsan_lit_src_root = get_required_attr(config, "lsan_lit_src_root") +lsan_lit_cfg = os.path.join(lsan_lit_src_root, "lit.common.cfg") +if not os.path.exists(lsan_lit_cfg): + lit_config.fatal("Can't find common LSan lit config at: %r" % lsan_lit_cfg) +lit_config.load_config(config, lsan_lit_cfg) + +config.name = 'LeakSanitizer-AddressSanitizer' + +clang_lsan_cxxflags = config.clang_cxxflags + " -fsanitize=address " + +config.substitutions.append( ("%clangxx_lsan ", (" " + config.clang + " " + + clang_lsan_cxxflags + " ")) ) + +clang_lsan_cflags = config.clang_cflags + " -fsanitize=address " + +config.substitutions.append( ("%clang_lsan ", (" " + config.clang + " " + + clang_lsan_cflags + " ")) ) + +config.environment['ASAN_OPTIONS'] = 'detect_leaks=1' |