[ASan] turn on leak checking for ASan tests and fix a few discovered leaks
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@190274 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/lit.common.unit.cfg b/lib/lit.common.unit.cfg
index ccc3ffa..2bd8f37 100644
--- a/lib/lit.common.unit.cfg
+++ b/lib/lit.common.unit.cfg
@@ -15,6 +15,13 @@
# Setup test suffixes.
config.suffixes = []
+# Tweak PATH to include llvm tools dir.
+llvm_tools_dir = getattr(config, 'llvm_tools_dir', None)
+if (not llvm_tools_dir) or (not os.path.exists(llvm_tools_dir)):
+ lit_config.fatal("Invalid llvm_tools_dir config attribute: %r" % llvm_tools_dir)
+path = os.path.pathsep.join((llvm_tools_dir, config.environment['PATH']))
+config.environment['PATH'] = path
+
# Propagate the temp directory. Windows requires this because it uses \Windows\
# if none of these are present.
if 'TMP' in os.environ: